GSIP 158

Ben Caradoc-Davies edited this page May 6, 2017 · 37 revisions

GSIP 158 - NetCDF output support for variable attributes and extra variables


Proposed By

Ben Caradoc-Davies

Assigned to Release

This proposal is for GeoServer 2.12-beta.


  • Under Discussion
  • In Progress
  • Completed
  • Rejected
  • Deferred


NetCDF/GRIB sources contain rich metadata in the form of variable attributes and extra variables that give meaning to data. When a coverage is read from a NetCDF/GRIB source, this information is lost, even if the output from GeoServer is NetCDF that is capable of representing this information.



The new NetCDF output functionality is intended to work with both single-file NetCDF/GRIB sources and also ImageMosaics of NetCDF/GRIB files.

For NetCDF output add:

  1. An option to allow all attributes to be copied from the source NetCDF/GRIB variable to the target variable.
  2. Support for manual configuration of variable attributes, much like the current support for setting global attributes.
  3. Support for configuration of extra variables which are copied from the NetCDF/GRIB source to the output; initially only scalar variables will be supported. Extra variables can be expanded over "higher" dimensions, that is, values copied from one scalar per ImageMosaic granule are assembled into a multidimensional variable over, for example, time and elevation.

User interface changes

Current interface

Proposed interface and user manual section

NetCDF output settings can be configured for each raster layer.

  • Variable Name (optional)
    • Sets the NetCDF variable name.
    • Does not change the layer name, which can be configured in the Data tab.
  • Variable Unit of Measure (optional)
    • Sets the NetCDF uom attribute.
  • Data Packing
    • Lossy compression by storing data in reduced precision.
    • One of NONE, BYTE, SHORT, or INT.
  • NetCDF-4 Compression Level
    • Lossless compression.
    • Level is an integer from 0 (no compression, fastest) to 9 (most compression, slowest).
  • NetCDF-4 Chunk Shuffling
    • Lossless byte reordering to improve compression.
  • Copy Attributes from NetCDF/GRIB Source
    • Most attributes are copied from the source NetCDF/GRIB variable.
    • Some attributes such as coordinates and missing_value are skipped as these may no longer be valid.
    • For an ImageMosaic, one granule is chosen as the source.
  • Variable Attributes
    • Values are encoded as integers or doubles if possible, otherwise strings.
    • Values set here overwrite attributes set elsewhere, such as those copied from a source NetCDF/GRIB variable.
  • Extra Variables copied from NetCDF/GRIB sources
    • Source specifies the name of the source variable in a NetCDF file or the toolsUI view of a GRIB file; only scalar source variables are supported.
    • Output specifies the name of the variable in the output NetCDF file.
    • If only one of Source or Output is given, the other is taken as the same.
    • Dimension is either blank to simply copy the source scalar from one granule, or the name of one output NetCDF dimension to cause values to be copied from multiple granules (such as those from an ImageMosaic over a non-spatial dimension) into a one-dimensional variable. The example above copies a single value from multiple reftime scalars into forecast_reference_time dimensioned by time in an ImageMosaic over time.
    • For an ImageMosaic, one granule is chosen as the source for variable attributes.
  • Global Attributes
    • Values are encoded as integers or doubles if possible, otherwise strings.

The similar section in the Global Settings page sets the default settings used for newly created layers.


The proposed approach is to pass a NetCDF/GRIB source URL from GeoTools to GeoServer gs-netcdf-out in a coverage property and have NetCDFOutputManager do all the work.

Proposed changes:

  • Addition of a coverage property SourceUrl for NetCDF and ImageMosaic readers that can be discovered by NetCDFOutputManager in GeoServer gs-netcdf-out. The property is a URL for the source of the coverage.
  • Implementation of the user interface and settings serialisation in GeoServer gs-netcdf-out
  • Implementation of the new variable attribute and extra variable functionality in NetCDFOutputManager in GeoServer gs-netcdf-out

Backwards Compatibility

The proposed implementation is designed to preserve existing functionality and behaviour.

  • Configuration files that lack the new settings will continue to work as before.
  • Variable Attributes and Global Attributes defined in user settings are encoded as integers or doubles if possible, otherwise strings. This is a change from the current behaviour, which is to write all values as strings.


  • Proposer notes: the Extra Variables section of the user interface will be renamed Scalar Variables Copied from NetCDF/GRIB Source and moved after the Global Attributes section.


Project Steering Committee:

  • Alessio Fabiani:
  • Andrea Aime: +1
  • Ben Caradoc-Davies: +1
  • Brad Hards: +0
  • Christian Mueller:
  • Ian Turton:
  • Jody Garnett: +1
  • Jukka Rahkonen: +1
  • Kevin Smith: +0
  • Simone Giannecchini: +1


Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.