CFmorzization

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

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