MeteoIODoc  MeteoIODoc-2.9.0
Spatial resampling and regridding handling

Spatial resampling

It is possible to use spatially interpolated meteorological fields or time series of 2D grids to extract meteorological time series for a set of points. This is handled as "spatial resampling" and the data will seem to originate from these virtual stations points where no station is present. This obviously comes at the cost of much higher run times. Several strategies are available (with the RESAMPLING_STRATEGY keyword):

  • VSTATIONS: points measurements are spatially interpolated at the chosen locations;
  • GRID_EXTRACT: gridded values are extracted for the cells containing the given locations;
  • GRID_EXTRACT_PTS: as GRID_EXTRACT, except that the plugin is queried to retrieve only data for the virtual stations grid points, not full grids. The method is faster when grids are large compared to the number of virtual stations;
  • GRID_SMART: the four nodes surrounding each given locations are extracted and potential duplicates are removed, then the meteo fields are spatially interpolated at the chosen locations;
  • GRID_ALL: all grid points are extracted;

For VSTATIONS and GRID_SMART, it is necessary to provide a hint on how often the data should be extracted versus temporally interpolated between extracted points. This is done by providing a refresh rate and an offset (both in seconds, with the VSTATIONS_REFRESH_RATE and VSTATIONS_REFRESH_OFFSET keywords, respectively)

Resampling workflow

Behind the scene, this is a two stages setup: the IOManager uses either a TimeSeriesManager or a GridsManager object to retrieve the real data and then injects this data as raw data into another TimeSeriesManager (so the temporal interpolations can be computed, the data generators can be called, etc). Then the IOManager request the data as usual from the final TimeSeriesManager or from the Meteo2DInterpolator (in the case of grids resampling).

Virtual stations

The data from real input stations (as read by the plugin defined with the METEO key in the [input] section) is filtered/processed, temporally interpolated and spatially interpolated as defined in the configuration file. Then time series are reconstructed from these grids at a set of defined points (which will receive station IDs such as VIR# for each station). This behavior is configured by the following keys (in the [InputEditing] section):

  • RESAMPLING_STRATEGY set to VSTATIONS;
  • VSTATION# : provide the lat, lon and altitude or easting, northing and altitude for a virtual station (see Coords() for the syntax);
  • VID# : provide the station ID for a given VSTATION (optional, default: VIR#);
  • VIRTUAL_PARAMETERS: list of MeteoData::Parameters that have to be interpolated to populate the virtual stations;
  • VSTATIONS_REFRESH_RATE: how often to rebuild the spatial interpolations, in seconds;
  • VSTATIONS_REFRESH_OFFSET: time offset to the stations' refresh rate, in seconds (default: 0);
  • INTERPOL_USE_FULL_DEM: should the spatial interpolations be performed on the whole DEM? (this is necessary for some algorithms, for example WINSTRAL).
Note
Please keep in mind that the WINDOW_SIZE in the [Interpolations1D] section and BUFFER_SIZE in the [General] section have a direct influence on the success (or lack of) the virtual stations: they will contribute to define how much raw data should be read and can lead to an exception being thrown when working with little data and large buffer or resampling windows values.
Currently, a DEM also has to be provided since this will be used to retrieve the elevation, slope and azimuth of the virtual stations.

In the example provided below, 4 stations provide the original data that will be spatially interpolated at 2 points (or virtual stations, VIR1 and VIR2) for 7 meteorological parameters. Every 6 hours, with starting offset of one hour, the original data will be spatially interpolated (so at 01:00, 07:00, 13:00 and 19:00). Any data requested at other time steps will be temporally resampled from the spatially interpolated data.

[Input]
DEM = ARC
DEMFILE = ./input/surface-grids/davos.asc
#here, the real data as measured by some stations
METEO = IMIS
DBNAME = sdbo
DBUSER = xxx
DBPASS = xxx
STATION1 = *WFJ
STATION2 = STB2
STATION3 = WFJ2
STATION4 = *DAV
[InputEditing]
#here the locations where the data will be generated. The caller will only see these stations!
RESAMPLING_STRATEGY = VSTATIONS
VSTATION1 = latlon 46.793029 9.821343 1987
VSTATION2 = latlon 46.793031 9.831572 1577
VID2 = Mattenwald
Virtual_parameters = TA RH PSUM ILWR P VW RSWR
VSTATIONS_REFRESH_RATE = 21600
VSTATIONS_REFRESH_OFFSET = 3600

From gridded data

The meteorological time series are extracted from time series of user-provided grids. Therefore a plugin for 2D grids must have been defined (with the GRID2D key in the [Input] section). The following keys (in the [InputEditing] section) control this downscaling process:

  • RESAMPLING_STRATEGY set to either GRID_EXTRACT, GRID_EXTRACT_PTS or GRID_ALL;
  • VSTATION# : provide the lat, lon and altitude for the virtual station (only required for GRID_EXTRACT and GRID_EXTRACT_PTS);
  • VID# : provide the station ID for a given VSTATION (optional, default: VIR#, unused for GRID_ALL);
  • VIRTUAL_PARAMETERS: list of MeteoData::Parameters that have to be interpolated to populate the virtual stations.

Currently, a DEM has to be provided in order to check the position of the stations and the consistency of the grids.

[Input]
DEM = NETCDF
DEMFILE = ./input/grids/era-interim-dem.nc
GRID2D = NETCDF
GRID2DFILE = ./input/grids/era-interim.nc
NETCDF_SCHEMA = ECMWF
[InputEditing]
RESAMPLING_STRATEGY = GRID_EXTRACT
Virtual_parameters = TA RH PSUM ILWR P VW ISWR
#here the locations where the data will be generated. The caller will only see these stations!
VSTATION1 = latlon 43.359188 6.693612 150 ;great station
VSTATION2 = latlon 43.324887 6.629711 57 ;another great station
Note
If the temporal resolution of the gridded data is greater than the WINDOW_SIZE of the [Interpolations1D], then no data will be interpolated.

From gridded data, with spatial interpolations

This is a combination between gridded data extraction and Vstations: the meteorological time series are extracted from time series of user-provided grids at 4 points around each provided location and then spatially interpolated at the said locations. Therefore, the following additional keys are required, in the [InputEditing] section:

  • RESAMPLING_STRATEGY set to GRID_SMART;
  • VSTATION# : provide the lat, lon and altitude for the virtual station;
  • VID# : provide the station ID for a given VSTATION (optional, default: VIR#);
  • VIRTUAL_PARAMETERS: list of MeteoData::Parameters that have to be interpolated to populate the virtual stations;
  • VSTATIONS_REFRESH_RATE: how often to rebuild the spatial interpolations, in seconds;
  • VSTATIONS_REFRESH_OFFSET: time offset to the stations' refresh rate, in seconds;
  • INTERPOL_USE_FULL_DEM: should the spatial interpolations be performed on the whole DEM? (this is necessary for some algorithms, for example WINSTRAL).
[Input]
DEM = NETCDF
DEMFILE = ./input/grids/era-interim-dem.nc
GRID2D = NETCDF
GRID2DFILE = ./input/grids/era-interim.nc
NETCDF_SCHEMA = ECMWF
[InputEditing]
RESAMPLING_STRATEGY = GRID_SMART
Virtual_parameters = TA RH PSUM ILWR P VW ISWR
#here the locations where the data will be generated. The caller will only see these stations!
VSTATION1 = latlon 43.359188 6.693612 150 ;great station
VSTATION2 = latlon 43.324887 6.629711 57 ;another great station

Resampling of gridded data

A new keyword has been introduce and will be expanded: REGRIDDING_STRATEGY. It describes how to generate gridded data out of other gridded data. It currently only accepts the "GRID_RESAMPLE" argument (all grid points are extracted and used with an additional DEM to resample the grids to a different resolution (by calling spatial interpolations)). Ultimately, it should offer various methods... Please note that it is currently NOT possible to use both RESAMPLING_STRATEGY and REGRIDDING_STRATEGY

The process is very similar to what has been laid out for the spatial resampling. The meteorological time series are extracted as described out in From gridded data for each grid point and forwarded to a Meteo2DInterpolator to be spatially interpolated over the provided DEM. This therefore performs grid resampling and accounts for elevation gradients, etc as configured in the [2DInterpolations] section. The following keys control this downscaling process (in the [InputEditing] section):

  • REGRIDDING_STRATEGY set to GRID_RESAMPLE;
  • SOURCE_DEM : filename of the DEM to be read by the GRID2D plugin. This DEM provides the elevations, slopes, etc for the source grids.
  • VIRTUAL_PARAMETERS: list of MeteoData::Parameters that have to be interpolated to populate the virtual stations.
[Input]
DEM = ARC
DEMFILE = ./input/grids/davos.asc
GRID2D = NETCDF
GRID2DFILE = ./input/grids/era-interim.nc
NETCDF_SCHEMA = ECMWF
[InputEditing]
REGRIDDING_STRATEGY = GRID_RESAMPLE
SOURCE_DEM = ./input/grids/era-interim-dem.nc
Virtual_parameters = TA RH PSUM ILWR P VW ISWR
Note
The resampled grids won't be provided by the read2DGrid() call but by the getMeteoData() call since they are considered as spatial interpolations.
mio::IOUtils::VSTATIONS
@ VSTATIONS
extract virtual stations as specified in the ini file
Definition: IOUtils.h:65
mio::IOUtils::GRID_RESAMPLE
@ GRID_RESAMPLE
generate a grid at a different resolution
Definition: IOUtils.h:70
mio::IOUtils::GRID_SMART
@ GRID_SMART
extract all relevant grid points from a provided grid
Definition: IOUtils.h:68
mio::IOUtils::GRID_EXTRACT
@ GRID_EXTRACT
extract data from grids at locations provided in the ini file
Definition: IOUtils.h:66