-
Notifications
You must be signed in to change notification settings - Fork 16
Variables
Gridpp processes fields based on their variable names in the NetCDF files. The variable is not required to exist in the output file. Gridpp will simply write a new variable. Variables to be processed are specified by -v
.
The NetCDF/CF standard requires that variables are annotated with units and standard_name attributes. Gridpp does not contain any logic to figure out what these should be, so these must be provided by the user. Gridpp will write attributes into the output file if it knows what they are. They are determined in this order:
- Attributes are provided on the command-line
- Attributes are already present in the variable in the output file
- Attributes are copied from the variable in the input file
Attributes can be specified on the command-line as follows:
gridpp <input_file> <output_file> -v precip units=mm standardName=precipitation_amount
By default, -v assumes that the name of the variable in the input file is the same as in the output file. There are two cases where this might not be desired:
- You are performing an operation on a variable where it makes sense to name the output something else
- The input and output files have different conventions for variable names and you want to maintain both
Use the -vi
option to specify a different variable from the input file. The -v
option will then only apply to the output file. The following creates accumulates the precip variable and names it precip_acc in the output file:
gridpp <input_file> <output_file> -vi precip -v precip_acc -c accumulate
Some downscalers need specially defined variables. This can abe achieved using the -va argument, which creates a variable alias. In the following example, a temporary variable called tlevel1 is first defined, then used by the gradient downscaler:
gridpp input.nc output.nc -va tlevel1 name=air_temperature_ml level=1\
-v air_temperature_2m -d gradient elevGradientVariable=tlevel1
By default, all variables specified by -v
get written to the output. In some cases, a variable might be computed as a temporary input in another calibrator. For example to compute the wetbulb temperature can be used to calculate precipitation phase, however it might not be present in the input file.
gridpp input.nc output.nc\
-v wetbulb write=0\
-c diagnoseHumidity\
temperature=air_temperature_2m\
pressure=surface_air_pressure\
rh=relative_humidity_2m\
-v phase\
-c phase\
temperature=wetbulb\
precipitation=precipitation_amount
The write=0
option to the wetbulb variable ensures that the variable is not written to the output file.