MeteoIODoc  MeteoIODoc-2.8.0
Spatial resampling handling

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_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;
  • GRID_RESAMPLE: all grid points are extracted and used with an additional DEM to resample the grids to a different resolution (by calling spatial interpolations).

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)

vstations_sampling.png
Resampling workflow

VSTATIONS

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 [Input] 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);
  • 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).
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.

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
#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 2300
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 control this downscaling process:

  • RESAMPLING_STRATEGY set to either GRID_EXTRACT or GRID_ALL;
  • VSTATION# : provide the lat, lon and (optionally) the epsg code for a virtual station;
  • 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.

DEM = NETCDF
DEMFILE = ./input/grids/era-interim-dem.nc
GRID2D = NETCDF
GRID2DFILE = ./input/grids/era-interim.nc
NETCDF_SCHEMA = ECMWF
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:

  • RESAMPLING_STRATEGY set to GRID_SMART;
  • 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).
DEM = NETCDF
DEMFILE = ./input/grids/era-interim-dem.nc
GRID2D = NETCDF
GRID2DFILE = ./input/grids/era-interim.nc
NETCDF_SCHEMA = ECMWF
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

The meteorological time series are extracted as laid 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:

  • RESAMPLING_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.
DEM = ARC
DEMFILE = ./input/grids/davos.asc
GRID2D = NETCDF
GRID2DFILE = ./input/grids/era-interim.nc
SOURCE_DEM = ./input/grids/era-interim-dem.nc
NETCDF_SCHEMA = ECMWF
RESAMPLING_STRATEGY = GRID_RESAMPLE
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.

Behind the scene

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).