CFmorzization

Provide a CF-compilation version of a variable within a file. See further details at:

varaddattr(values, ncfile, varn)
  values=[dimvarns]:[globattrfile]:[projectfile]
    [dimvarns]: ',' separated list for identification of axes, dimensions and
      variable-dimensions as '[AXIS]|[dimn]|[vardimn]'
        [AXIS]: axis of the file: 'X', 'Y', 'Z', or 'T'
        [dimn]: name of the current name of the dimension of the given axis
        [vardimn]: name of the current name of the variable-dimension of the
          given axis
    [globattrfilen]: name of ASCII file with the given metadata to be added as global attributes
      with a line per attribute [attrname] [value](use '!' for spaces] (underparenthesis
        for description)
      use '#' for comments
      File has to have at least:
        institute_id [value] (CV)
        institution [value]
        model_id [value] (CORDEX starts with <institute_id>-)
        experiment_id [value] (same CV as CMIP5 with "evaluation" in addition)
        experiment [value] (long version of "experiment_id")
        contact [value] ([Name], [email] of contact person)
        product [value] (single value: "output")
        Conventions [value] (later than CF1.4 if present / single value: "CF-1.4")
        creation_date [value] ([YYYY-MM-DDTHH:MM:SSZ] format according to UNIDATA
          conventions, same in CMIP5 & CORDEX)
        frequency [value] (same CV as CMIP5 with "sem" in addition; 3hr highest
          freq. in CORDEX; no "yr")
        driving_model_id [value] (CMIP5 institute_id, <CMIP5 institute_id>-
          <member in CMIP5 CV list of model_id>)
        driving_model_ensemble_member [value] (CMIP5 CV, e.g. "r1i1p1")
        driving_experiment_name [value] ("evaluation" or <member in CMIP5 CV
          list of experiment_id>)
        driving_experiment [value] ("<driving_model_id>,<driving_experiment_name>,<driving_model_ensemble_member>",
          members of the CMIP5 list of forcing agents are not necessarily
          forcing agents of RCM (besides implicitly
          in driving_experimnt)
        rcm_version_id [value] (<free text string>; valid characters only
          indicates model modifs during the project e.g.: parameterizations,
          small upgrades)
        project_id [value] (single value)
        CORDEX_domain [value] ((e.g.: "AFR-44", "AFR-44i", includes resolution acronym)
        tracking_id [value] (not required or explained in ADD; it is, however,
          strongly recommended to include it as prescribed CMIP5.)
        basetime [value] (reference time "1949-12-01T00:00:00Z" formatted acording
          to UNIDATA conventions)
        calendar [value] (CF conventions as in driving model)
        grid [value] (according to CF conventions)
    [projectfile]: ASCII file with all the CF-mandatory projection information. A line for each
      attribute. Name of the variable to be used to refer the projection inside the file will
      be the same as global attribute `grid'
      See more information from: CF-conventions
         (...) (specific projection attributes and values)
         [name] [value] [kind] ('I': integer, 'R': float, 'D': double float, 'S': string)
       Add three more attributes for the resolution of the projection:
         x_resolution [value] (resolution along x-axis)
         y_resoltuion [value] (resolution along y-axis)
         proj_units [value] (units of the resoltion of the projection)
  ncfile= netCDF file to use
  variable= ',' list of [varfn]@[method]@[Tbnds] to CF transform. A separated file will be
    created for each variable
    use [varfn]@instantaneous@None for instantaneous values
    NOTE: CF values will be taken from 'variables_values.dat'
      [varfn]: name of the variable inside the file
      [method]: cell_method of the variable ('!' for spaces) uing, standard CF description:
        CF-conventions cell representation
      [var_time_bnds]: variable with the time_bnds values, or:
        * 'WRFtime_bnds'|[tunit]|[quantity], to be computed directly from WRF for a
          given period of time as:
            [tunit]: unit of time: 'c' century, 'y' year, 'm' month, 'w' week, 'd' day,
              'h' hour, 'i' minute, 's' second
          [quantity] = amount (integer) of [tunit] to cover a period of time_bnds
        * 'Ctime_bnds'|[tvarn]|[tunit]|[quantity], to be computed directly from a
          variable from a given period of time as:
            [tvarn]: name of the variable
            [tunit]: unit of time: 'c' century, 'y' year, 'm' month, 'w' week, 'd' day,
              'h' hour, 'i' minute, 's' second
            [quantity] = amount (integer) of [tunit] to cover a period of time_bnds
$ python ${pyHOME}/nc_var.py -o CFmorzization -S 'X|west_east|XLONG,Y|south_north|XLAT,T|Time|WRFtime,Z|
  bottom_top|ZNU:GlobalAttr1995.inf:proj1995.inf' -f ~/PY/wrfout_d01_1995-01-01_00\:00\:00
  -v QFX@instantaneous@None
$ python ${pyHOME}/nc_var.py -o CFmorzization -S 'X|west_east|XLONG,Y|south_north|XLAT,T|Time|WRFtime,Z|
  bottom_top|ZNU:GlobalAttr1995.inf:proj1995.inf' -f ~/PY/wrfout_d01_1995-01-01_00\:00\:00
  -v 'RAINC@time:!accumulation@WRFtime_bnds|h|3'