Skip to content

Gridpp command line client

Thomas Nipen edited this page Jun 18, 2020 · 1 revision

The Gridpp command-line tool is a convenient way to apply gridpp methods to variables in NetCDF files. The tool processes NetCDF files as follows:

gridpp <input_file> <output_file> -v <variable> -d <downscaler> -c <calibrator>

where input_file is a NetCDF file with forecast or analysis data and output_file is a NetCDF template file with a desired output grid. Gridpp will process variables found in the input file by specifying a variable name using -v. This variable is downscaled by a method specified by -d and finally calibrated by methods specified by -c.

Downscalers interpolate data from the grid found in the input file onto the grid found in the output file. Calibrators adjusts the downscaled data on the final output grid. Multiple calibrators can be chained one after the other by specifying -c several times.

As an example, the following will downscale the 2m temperature field in the input (2.5 km resolution) onto the output grid (1.0 km resolution) and then apply a smoothing filter with a 3 gridpoint (i.e. 3km) radius:

gridpp input.nc output.nc -v air_temperature_2m -d bilinear
                          -c neighbourhood radius=3 stat=mean

In the above example, radius=3 is an option to the neighborhood calibrator. In gridpp, options are always specified as option=value.

Same input as output

If only one filename is provided, then gridpp will use this as both input and output. For example:

gridpp input.nc -v air_temperature_2m -d bilinear
                -c neighbourhood radius=3

Will overwrite air_temperature_2m in the input file.

Processing multiple variables

Multiple variables can be processed in a single command. This is done by stringing several -v -d -c options together:

gridpp <input_file> <output_file> -v <var1> -d <d1> -c <c1>\
                                  -v <var2> -d <d2> -c <c2>

The same result can be achieved with two invocations of the gridpp command:

gridpp <input_file> <output_file> -v <var1> -d <d1> -c <c1>
gridpp <input_file> <output_file> -v <var2> -d <d2> -c <c2>

Using two separate invocations takes longer since any caching of nearest neighbours used in the downscaling is lost. Also, if the processing of the second variable involves results from the first variable, then the variable has to be read a second time. However, the overall memory requirement is lower, since only one variable is kept in memory at a time.

Clone this wiki locally