Skip to content

NetCDF4 format specifications

NetCDF4 raster format specification💡

For raster timeseries the NetCDF can either be exported by FEWS or created while conforming to the internal format specification below. All NetCDF4 files should have a variable (dataset) with the name values which contains the timeseries data.

Make sure the spatial extent of the rasters is equal to or larger than the spatial extent of the 3Di model.

Note

the last value in the time variable is used to calculate the duration of the second-last raster value, and thus the last raster value in values is not applied on the simulation. For example, if the time = [10, 20, 30, 40] then 3 rasters are applied for the 3 periods: 10-20, 20-30 and 30-40. The raster values for time = 40 are ignored.

FEWS💡

In case you want to use FEWS to create a NetCDF export of your raster timeseries, the following FEWS NetCDF exports versions are supported:

The FEWS version is determined by the global attribute: fews_implementation_version. Attributes are automatically picked based on the implementation_version. The raster data needs to be placed in a values variable.

Generic💡

In case you want to create your own NetCDF4 raster timeseries file, it should follow this exact format: (example file)

// Output from $ ncdump -h filename.nc (with extra comments added)
dimensions:
    time = UNLIMITED ;
    lon = 615 ; // Raster dimensions
    lat = 427 ;
variables:
    double time(time) ;
        // The values in the time variable are used to calculate
        // the offset in the simulation (of the timeseries)
        // based on the start-datetime of the simulation.
        //
        // The offset can be overridden using a global
        // attribute (see below)
        time:standard_name = "time" ;
        time:long_name = "Time" ;
        time:units = "minutes since 1970-01-01 00:00:00.0 +0000" ;
        // time:units should have the format:
        //    hours/minutes/seconds since ####-##-## ##:##:##.# +####
        time:calendar = "standard" ;
        time:axis = "T" ;
    double lon(lon) ;
        lon:standard_name = "longitude" ;
        lon:long_name = "longitude" ;
        lon:units = "degrees_east" ;
        lon:axis = "X" ;
    double lat(lat) ;
        lat:standard_name = "latitude" ;
        lat:long_name = "latitude" ;
        lat:units = "degrees_north" ;
        lat:axis = "Y" ;
    int crs ;
        crs:grid_mapping_name = "latitude_longitude" ;
        crs:long_name = "CRS definition" ;
        crs:longitude_of_prime_meridian = 0. ;
        crs:semi_major_axis = 6378137. ;
        crs:inverse_flattening = 298.257223563 ;
        crs:spatial_ref = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433],AUTHORITY[\"EPSG\",\"4326\"]]" ;
        string crs:GeoTransform = "4.655663105567453 0.0002487089473148532 0 52.69717725602583 0 -0.0002489924685564857 " ;
        // Note: only the GeoTransform & spatial_ref are used.
    double values(time, lat, lon) ;
        // Used as raster timeseries data
        values:long_name = "can_be_anything" ;
        values:grid_mapping = "crs" ;
        values:_FillValue = 1.79769313486232e+308 ; // Define your own fill_value
        values:missing_value = 1.79769313486232e+308 ; // Only FillValue is taken into account

        string values:units = "m/s" ;
        // One of 'mm', 'm/s', 'mm/h', 'mm/hr'
        // Note: in case of `mm` the rate is determined by looking
        // at the next `time` value.

// global attributes:
:OFFSET = 0LL ; // Optionally override the offset within the simulation (in seconds)

NetCDF4 timeseries format specification💡

For timeseries the NetCDF needs to be created conforming to the internal format specification below. (example file) All NetCDF4 files should have a variable (dataset) with the name values which contains the timeseries data.

Note

The last value in the time variable is used to calculate the duration of the second-last timeseries value, and thus the last timeseries value in values is not applied on the simulation. For example, if the time = [10, 20, 30, 40] then 3 timeseries are applied for the 3 periods: 10-20, 20-30 and 30-40. The timeserie value for time = 40 is ignored.

Format💡

In case you want to create your own NetCDF4 timeseries file, it should follow this internal format:

// Output from $ ncdump -h filename.nc (with extra comments added)
dimensions:
    time = UNLIMITED ;
    one = 1 ;
variables:
    double time(time) ;
        // The values in the time variable are used to calculate
        // the offset in the simulation (of the timeseries)
        // based on the start-datetime of the simulation.
        //
        // The offset can be overridden using a global
        // attribute (see below)
        time:standard_name = "time" ;
        time:long_name = "Time" ;
        time:units = "minutes since 1970-01-01 00:00:00.0 +0000" ;
        // time:units should have the format:
        //    hours/minutes/seconds since ####-##-## ##:##:##.# +####
        time:calendar = "standard" ;
        time:axis = "T" ;
    double values(time, one) ;
        values:_FillValue = -9999LL ; // Define your own fill_value

        string values:units = "mm/h" ;
        // One of 'mm', 'm/s', 'mm/h', 'mm/hr'
        // Note: in case of `mm` the rate is determined by looking
        // at the next `time` value.

// global attributes:
:OFFSET = 0LL ; // Optional override the offset within the simulation (in seconds)