MeteoIODoc  MeteoIODoc-2.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NetCDF

Format

In order to promote creation, access and sharing of scientific data, the NetCDF format has been created as a machine-independent format. NetCDF (network Common Data Form) is therefore an interface for array-oriented data access and a library that provides an implementation of the interface. The NetCDF software was developed at the Unidata Program Center in Boulder, Colorado. In order to graphicaly explore the content and structure of NetCDF files, you can use the ncBrowse java software or ncview. It is also possible to run ncdump on a given file in order to have a look at its structure (such as ncdump {my_netcdf_file} | more) and specially the parameters names (this is useful if remapping is needed, see below for in the keywords section).

The NetCDF format does not impose a specific set of metadata and therefore in order to easily exchange data within a given field, it is a good idea to standardize the metadata. Several such metadata schema can be used by this plugin:

Compilation

In order to compile this plugin, you need libnetcdf (for C). For Linux, please select both the libraries and their development files in your package manager.

Keywords

This plugin uses the following keywords:

  • COORDSYS: coordinate system (see Coords); [Input] and [Output] section
  • COORDPARAM: extra coordinates parameters (see Coords); [Input] and [Output] section
  • DEMFILE: The filename of the file containing the DEM; [Input] section
  • DEMVAR: The variable name of the DEM within the DEMFILE; [Input] section
  • GRID2DPATH: if this directory contains files, they will be used for reading the input from; [Input] section
  • METEO_EXT: only the files containing this pattern in their filename will be used; [Input] section
  • GRID2DFILE: if GRID2DPATH has not been defined or if it does not contain files matching the METEO_EXT extension, provides the NetCDF file which shall be used for gridded input/output; [Input] and [Output] section
  • NETCDF_SCHEMA: the schema to use (either CF1 or CNRM or ECMWF); [Input] and [Output] section
  • NETCDF::{MeteoGrids::Parameters} = {netcdf_param_name} : this allows to remap the names as found in the NetCDF file to the MeteoIO grid parameters; [Input] section;
  • DEM_FROM_PRESSURE: if no dem is found but local and sea level pressure grids are found, use them to rebuild a DEM; [Input] section

When providing multiple files in one directory, in case of overlapping files, the file containing the newest data has priority. This is convenient when using forecats data to automatically use the most short-term forecast.

Example use

Using this plugin to build downscaled time series at virtual stations, with the ECMWF Era Interim data set (see section below):

[Input]
GRID2D = NETCDF
GRID2DPATH = /data/meteo_reanalysis
METEO_EXT = .nc
NETCDF_SCHEMA = ECMWF
DEM = NETCDF
DEMFILE = /data/meteo_reanalysis/ECMWF_Europe_20150101-20150701.nc
DEM_FROM_PRESSURE = true
#The lines below have nothing to do with this plugin
Downscaling = true
VSTATION1 = 46.793029 9.821343 ;this is Davos
Virtual_parameters = TA RH PSUM ISWR ILWR P VW DW TSS HS RSWR TSG ;this has to fit the parameter set in the data files

Another example, to extract precipitation from the MeteoSwiss daily precipitation reanalysis, RhiresD

[Input]
DEM = NETCDF
DEMFILE = ./input/ch02_lonlat.nc
GRID2D = NETCDF
GRID2DPATH = /data/meteo_reanalysis
METEO_EXT = .nc
NETCDF::PSUM = RhiresD ;overwrite the PSUM parameter with "RhiresD", for example for MeteoCH reanalysis
#The lines below have nothing to do with this plugin
Downscaling = true
VSTATION1 = 46.793029 9.821343 ;this is Davos
Virtual_parameters = PSUM ;this has to fit the parameter set in the data files

MeteoCH RhiresD & similar products

MeteoSwiss provides reanalysis of precipitation and other meteo fields from 1961 to present over Switzerland for different time scales: daily, monthly, yearly, as well as hourly (CPC dataset). The DEM are also provided, either in lat/lon, Swiss coordinates, rotated lat/lon, ... These data sets must be requested from MeteoSwiss and are available with a specific license for research.

Unfortunatelly, the naming of the parameters and dimensions within the files is not standard nor consistent. In order to handle the parameters names, simply run ncdump {my_netcdf_file} | more and use the name mapping facility of this plugin to map the non-standard parameters to our internal names (see the plugin keywords). When the dimensions are not standard (for example the time axis being called "TS_REFERENCE"), use first the ncrename tool that is part of the NCO utilities to rename both the dimension (-d) and the variable (-v):

ncrename -d TS_REFERENCE,time -v TS_REFERENCE,time {my_netcdf_file}

ECMWF Era Interim

The Era Interim data can be downloaded on the ECMWF dataserver after creating an account and login in.

It is recommended to extract data at 00:00, and 12:00 for all steps 3, 6, 9, 12. The select the following fields: 10 metre U wind component, 10 metre V wind component, 2 metre dewpoint temperature, 2 metre temperature, Forecast albedo, Mean sea level pressure, Skin temperature, Snow density, Snow depth, Soil temperature level 1, Surface pressure, Surface solar radiation downwards, Surface thermal radiation downwards, Total precipitation

Here we have included the forecast albedo so the RSWR can be computed from ISWR and the mean sea level pressure and surface pressure as proxies to compute the elevation. If you have the altitude in a separate file, it can be declared as DEM and there would be no need for the sea level pressure (this would also be much more precise).

You should therefore have the following request:

Parameter: 10 metre U wind component, 10 metre V wind component, 2 metre dewpoint temperature, 2 metre temperature, Forecast albedo,
Mean sea level pressure, Skin temperature, Snow density, Snow depth, Soil temperature level 1, Surface pressure,
Surface solar radiation downwards, Surface thermal radiation downwards, Total precipitation
Step: 3 to 12 by 3
Type: Forecast
Time: 00:00:00, 12:00:00

With the ECMWF Python Library, the request would be for example:

#!/usr/bin/env python
from ecmwfapi import ECMWFDataServer
server = ECMWFDataServer()
server.retrieve({
"class": "ei",
"dataset": "interim",
"date": "2015-01-01/to/2015-01-31",
"expver": "1",
"grid": "0.75/0.75",
"levtype": "sfc",
"param": "33.128/134.128/139.128/141.128/151.128/165.128/166.128/167.128/168.128/169.128/175.128/205.128/228.128/235.128/243.128",
"step": "3/6/9/12",
"area":"42.2/-1.5/51.7/15.7",
"stream": "oper",
"format":"netcdf",
"target": "my-era-interim.nc",
"time": "00/12",
"type": "fc",
})