Skip to content

Export gridded data from NWP actor variables to NetCDF files

Adds functionality to write NetCDF files from actor variables.

A new button besides add new variable is added to the UI, called save current variables , which opens a file dialog to choose a location to save the NetCDF file to. The data is written based on CF conventions. A new class is added that handles adding grids or variables to a open file.

Furthermore, to also include information from filters creating the grids, the MWeatherPredictionMetaData now also contains the processingInformation field, where producers can add information on the generation process of the grid. For example, the Smooth Filter can add information on the smooth operation. When writing a NetCDF file, this information is added as attributes to the grid.

The writer currently does support:

  • 2D levels
  • 3D pressure levels
  • 3D hybrid levels
  • 3D aux pressure levels

The writer currently does NOT support (yet):

  • PROJ4 projected data (not read at all from input files currently)
  • Rotated grids (x/y are not stored in structured grids currently)
  • multiple time steps & multiple ensemble members (based on the invariant that only data currently available in MStructuredGrids can be written; would require data requests to all possible time values).

While implementing the NetCDF reader, several bugs have been found and fixed, mainly relating to missing or wrong meta data of MStructuredGrid s.

  • The vertical dimension values of auxiliary pressure data (model levels) were not read at all in the netCDF reader.
  • MetaData of grids were often not applied by filters when they created a new grid from an old grid.
  • Horizontal grid type was not set correctly in auxiliary pressure grids when they were loaded as "by-product" of other grids requiring this grid.

The MR can be tested by taking any data set of the supported types, loading some actor variables, saving them to netCDF and then investigating the ncdump or try reloading the saved data into Met.3D. Before saving, try to apply some filters (smooth, derivatives), and check whether these are reflected correctly in the generated files.

Resolves #325 (closed)

Edited by Christoph Fischer

Merge request reports