Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section


Column
width76px


Column

This icon takes data from a GRIB source and performs a variety of operations on it, including spectral to grid conversion, regridding using a large variety of powerful and flexible interpolation techniques, nabla operators and special consideration of wind fields.

This module is designed with re-use in mind. The first time a particular interpolation is performed, it might take some time to compute, but it will create cache files that can be re-used, meaning that the same interpolation will be much faster on subsequent runs.

The macro/python language equivalent is regrid(). The listed parameters can all be supplied as named parameters with the spaces replaced by underscores, e.g. nearest_method='sorted_sample'.

(warning) The last sentence above is not correct; The canonical MIR parameters are in lowercase + hyphens, always sanitized before passing in. The underscore is not a good recommendation, a space is better and an hyphen even better.

The Regrid Editor

Data input

Input data may be specified either by giving a path in the Source parameter or by giving a GRIB-based data object in the Data parameter. Note that you should specify either Source or Data, not both.

Source

Specifies the GRIB file path.

Data



The Regrid Editor

Table of Contents
maxLevel3

Input definition

...

Input data may be specified either by giving a path in the Source parameter or by giving a GRIB-based data object in the Data parameter. Note that you should specify either Source or Data, not both.

  • Source: path to a GRIB file
  • Data: GRIB-based data object

Drop a MARS Retrieval or a GRIB file icon inside this icon field. In Python or Macro, supply a Fieldset object.

Output

...

definition

...

Grid Definition Mode

Select a method for specifying the output grid.

  • Grid: supply a valid string or list of numbers in the Grid parameter (see below)
  • Template: supply a template GRIB file, whose grid structure will be used to generate the output GRIB; use either Template Source or Template Data to specify the template (not both). Note that only GRIB fields on regular lat/lon or regular/reduced Gaussian grids may currently be used as templates.
  • Lambert Conformal: supply details of the output grid in the set of Lambert grid definition parameters
  • Lambert Azimuthal Equal Area:  supply details of the output grid in the set of Lambert grid definition parameters
  • Filter: in this mode, the output grid will be the same as the input grid, with k-nearest neighbours interpolation supporting the filtering

Template Source

...

Grid Definition Mode

...

Grid

Grid

Supply a grid definition as described here: grid - keyword in MARS/Dissemination request.

Examples of valid grid definitions:

GUIPython / MacroResult
1/1[1

Template Data

If Grid Definition Mode is set to Template, supply a GRIB-based data object in the Template Data parameter; the output GRIB will use the same grid as the template.

Grid

Supply a grid definition as described here: grid - keyword in MARS/Dissemination request.

Examples of valid grid definitions:

GUIPython / MacroResult
1/1[1, 1] or "1/1'"A regular lat/lon grid with 1x1 degree point spacing
0.25/0.25[0.25, 0.25] or "0.25/0.25"A regular lat/lon grid with 0.25x0.25 degree point spacing
O1280"O1280"An octahedral reduced Gaussian grid, octahedral with 1280 latitude lines between the pole and equator
N640"N640"An 'original' reduced Gaussian grid, with 640 latitude lines between the pole and equator
F400"F400"A regular Gaussian grid, with 400 latitude lines between the pole and equator

Area

Supply a grid definition as described here: area - keyword in MARS/Dissemination request (swapping north/south).

Specifies the geographical area that the output fields will cover, the default being for the whole globe. Enter lat/lon in degree bounds of an area separated by a "/" (south/west/north/east), or in Macro or Python provide a list, e.g. [south, west, north, east]; alternatively, use the assist button to define the area graphically.

For example, this set of parameters generates the following output data:

Code Block
languagepy
t01 = mv.regrid(
    grid     = [0.1,0.1],
    area     = [31,-17,64,38],
    data     = t_2m
    )

mv.plot(t01)

This parameter can be left empty to preserve the grid properties (regular/reduced lat/lon or Gaussian) while performing other kinds of post-processing (changing bits per value, calculation of gradients, etc.). 

Grid Definition Mode: Template

This mode configures regridding to output the same grid as the provided template, using one of the following parameters:

  • Template Source: path to a GRIB file

  • Template Data: GRIB-based data object

Grid Definition Mode: Lambert Conformal or Lambert Azimuthal Equal Area

These projections require setting several parameters, named following the convention in their descriptions:

Most of these parameters are required and do not have default values, meaning that they must be filled in. The parameters are:

  • First Point: defines the North/West (or top/left) point in the unprojected frame (lat/lon)
  • Dx In Metres: x-direction increment in the projected frame (x/y)
  • Dy In Metres: y-direction ...
  • Nx: number of points along x-direction in the projected frame (x/y)
  • Ny: number of points along y-direction ...
  • Specific to Lambert Conformal:
    • LaD In Degrees
    • LoV In Degrees 
    • Latin 1 In Degrees (defaults to LaD In Degrees)
    • Latin 2 In Degrees (defaults to LaD In Degrees)
  • Specific to Lambert Azimuthal Equal Area:
    • Standard Parallel In Degrees
    • Central Longitude In Degrees

Here are examples of generating Lambert grids.

Image Added

Image Added


Code Block
languagepy
regrid_lambert_conformal = mv.regrid(
    grid_definition_mode = "lambert_conformal",
    first_point          = [50.88,-1.66],
    dx_in_metres         = 2500,
    dy_in_metres         = 2500,
    nx                   = 739,
    ny                   = 949,
    lad_in_degrees       = 63,
    lov_in_degrees       = 15,
    data                 = t_2m_rgg
    )


Image Added

Image Added


Code Block
languagepy
regrid_lambert_azimuthal = mv.regrid(
    grid_definition_mode         = "lambert_azimuthal_equal_area",
    first_point                  = [50.88,-1.66],
    dx_in_metres                 = 2500,
    dy_in_metres                 = 2500,
    nx                 

...

Image Removed

Frame

Specifies the width of a frame within a given sub-area. The width of the frame is specified as an integer number of grid points inwards from a given area. See also frame - keyword in MARS/Dissemination request.

The following plots show a sub-area with Frame=10.

...

Image Removed

...

Image Removed

Rotation

Position of the South Pole of the intended rotated grid as lat/lon in degree, as described here: rotation - keyword in MARS/Dissemination request.

This is applicable to regular lat/lon or regular/reduced Gaussian grids. Enter lat/lon in degree, or in Macro or Python, enter [lat, lon]; alternatively, use the  assist button to select the point graphically.

Output Lambert grid definition

These parameters are available if Grid Definition Mode is set to Lambert Conformal or Lambert Azimuthal Equal Area. The names follow the naming convention in the descriptions of these projections here:

Most of these parameters are required and do not have default values, meaning that they must be filled in.

The parameters are:

  • First Point: defines the North/West (or top/left) point in the unprojected frame (lat/lon)
  • Dx In Metres: x-direction increment in the projected frame (x/y)
  • Dy In Metres: y-direction ...
  • Nx: number of points along x-direction in the projected frame (x/y)
  • Ny: y-direction ...
  • Specific to Lambert Conformal:
    • LaD In Degrees
    • LoV In Degrees 
    • Latin 1 In Degrees (defaults to LaD In Degrees)
    • Latin 2 In Degrees (defaults to LaD In Degrees)
  • Specific to Lambert Azimuthal Equal Area:
    • Standard Parallel In Degrees
    • Central Longitude In Degrees

Here are examples of generating Lambert grids.

Image Removed

Image Removed

Code Block
languagepy
regrid_lambert_conformal = mv.regrid( grid_definition_mode = "lambert_conformal", first_point
          = 
[50.88,-1.66],
739,
    
dx_in_metres
ny         
=
 
2500,
    
dy_in_metres
         
=
 
2500,
   = 
nx
949,
    standard_parallel_in_degrees = 0,
    
central_longitude_in_degrees = 
739
0,
    
ny
data                   
=
 
949,
    
lad_in_degrees
 
= 
63, lov_in_degrees = 15, data = t_2m_rgg )

Image Removed

Image Removed

Code Block
languagepy
regrid_lambert_azimuthal = mv.regrid(
    grid_definition_mode         = "lambert_azimuthal_equal_area",
    first_point                  = [50.88,-1.66],
    dx_in_metres                 = 2500,
    dy_in_metres                 = 2500,
    nx                           = 739,
    ny                           = 949,
    standard_parallel_in_degrees = 0,
    central_longitude_in_degrees = 0,
    data                         = t_2m_rgg
    )

Spectral to grid transform

If the input files are spectral, the following parameters are used to fine-tune the conversion to grid points.

Truncation

Spherical harmonics truncation, as described here: truncation - keyword in MARS/Dissemination request.

When the output is spectral, defines the output intended truncation; When the output is gridded, defines the intermediate truncation before spectral inverse transform to gridded space. Possible values are AutomaticNone or a number describing the spectral truncation to be applied.

Intgrid

Intermediate grid when performing spectral inverse transform to gridded space, as described intgrid - keyword in MARS/Dissemination request.

Possible values are:

  • Automatic: regular Gaussian grid, with N given as linear spectral order relation to output grid latitude increments
  • Source: octahedral reduced Gaussian grid, with N given as cubic spectral order relation to output grid latitude increments (mimics dissemination)
  • None: no intermediate grid, spectral inverse transform target is the user's intended output (costly if many different outputs are intended)
  • name of the desired intermediate grid

Wind processing

Wind Processing

Activates processing that is particular to wind fields. Possible options are:

  • UV To UV: assumes that the input files come in pairs of U/V. This option is required if regridding wind fields on/to a rotated grid.
  • VOD To UV: converts pairs of vorticity and divergence fields into U/V fields. Assumes that the input files come in pairs of vorticity and divergence. The resulting values will be scaled by the cosine of their latitudes.
  • Off: no special processing is performed

By default, this module will assume there are no wind fields in the input, and it will not automatically scan for pairs of U/V fields - it is up to the user to know that their input consists of wind fields and to use this setting in order to perform the correct processing.

Extra processing

t_2m_rgg
    )


Grid Definition Mode: Filter

This mode is similar to Template (see above), except the template is set to the input grid (the resulting output grid is the same as the input grid); In addition, interpolation k-nearest neighbours acts as a filter to the input values.

Wind processing

...

Wind Processing

Activates processing that is particular to wind fields. Winds are represented by its vector Cartesian components u/v (gridded) or U/V (spectral) and, typically, they are archived as (spectral) vorticity/divergence (vo/d.) The relation between the spectral and gridded wind components is u = U / cos(latitude) and v = V / cos(latitude).  

It is up to the user to specify if the input consists of wind fields. Set this appropriatelly in order to perform the correct processing.

Possible options are:

  • U/V to u/v: convert spectral U/V to gridded u/v
  • vo/d to U/V (or u/v): convert spectral vo/d to spectral U/V or (gridded) u/v, if output is defined gridded (such as by specifying Grid).
  • Off: default

Wind Processing: U/V to u/v

Converts pairs of Cartesian components vector fields U/V (spectral) to u/v (gridded.) Assumes that the input come in pairs of alternating U/V. This option is required if regridding wind fields on/to a rotated grid.

Wind Processing: vo/d to u/v

Converts pairs of vorticity and divergence fields into U/V (spectral) or u/v (gridded.) Assumes that the input come in pairs of alternating vo/d. The resulting values will be scaled by the cosine of their latitudes (as mentioned above).

Wind Processing: Off

No special processing is performed (default). It is assumed there are no wind fields in the input, each processed is treated individually.

Spectral to grid inverse transform

...

If the input files are spectral, the following parameters are used to fine-tune the conversion to grid points.

Truncation

Spherical harmonics truncation, as described here: truncation - keyword in MARS/Dissemination request.

When the output is spectral, defines the output intended truncation; When the output is gridded, defines the intermediate truncation before spectral inverse transform to gridded space. Possible values are AutomaticNone or a number describing the spectral truncation to be applied.

Intgrid

Intermediate grid when performing spectral inverse transform to gridded space, as described intgrid - keyword in MARS/Dissemination request.

Possible values are:

  • Automatic: regular Gaussian grid, with N given as linear spectral order relation to output grid latitude increments
  • Source: octahedral reduced Gaussian grid, with N given as cubic spectral order relation to output grid latitude increments (mimics dissemination)
  • None: no intermediate grid, spectral inverse transform target is the user's intended output (costly if many different outputs are intended)
  • name of the desired intermediate grid


Extra processing

...

Area

Supply a grid definition as described here: area - keyword in MARS/Dissemination request (swapping north/south).

Specifies the geographical area that the output fields will cover, the default being for the whole globe. Enter lat/lon in degree bounds of an area separated by a "/" (south/west/north/east), or in Macro or Python provide a list, e.g. [south, west, north, east]; alternatively, use the assist button to define the area graphically.

For example, this set of parameters generates the following output data:


Code Block
languagepy
t01 = mv.regrid(
    grid     = [0.1,0.1],
    area     = [31,-17,64,38],
    data     = t_2m
    )

mv.plot(t01)


Image Added

Frame

Specifies the width of a frame within a given sub-area, as described here frame - keyword in MARS/Dissemination request.

The width of the frame is specified as an (integer) number of grid points inwards from a given area. The following plots show a sub-area with Frame=10.

Image Added

Image Added

Rotation

Position of the South Pole of the intended rotated grid as lat/lon in degree, as described here: rotation - keyword in MARS/Dissemination request.

This is applicable to regular lat/lon or regular/reduced Gaussian grids. Enter lat/lon in degree, or in Macro or Python, enter [lat, lon]; alternatively, use the  assist button to select the point graphically.

Nabla

Activates a nabla (differential) operator processing on the fields. Possible functions are:

...

For GRIB-based LSM (this excludes '1km' and '10min'), the threshold for condition (value ≥ threshold) to distinguish land (true) from sea (false).

GRIB Output

...

...

Accuracy

Specifies the output GRIB bitsPerValue. If left empty, this will take the value from the input fields. This option can also be used to simply change the number of bits per value in a Fieldset if no other processing options are given. Note that if Packing  is set to ieee, then the only valid values for this parameter are 32 and 64.

...