Skip to content

NetCDF writer: Fixed units for pressure fields and missing values

Christoph Fischer requested to merge devel_issue_348 into master

Fixes #348 (closed).

The NetCDF writer sometimes wrote wrong units for the pressure fields. The problem was that the units written were taken from the data source, therefore from the data reader (NetCDF reader or GRIB reader). However, the surface pressure field for hybrid sigma-pressure fields is "hardcoded" converted to Pa , the 3-D auxiliary pressure field "hardcoded" converted to hPa . So depending on the input unit, this wrote the wrong units to the output NetCDF file.

Fixed by overwriting the unit attributes in the output NetCDF file. The variable variableNamesWithProtectedUnits has been introduced, keeping track on which variables have protected units and should not be overwritten.

Also fixes the wrong "Missing value" set. We have our own M_MISSING_VALUE .

Edited by Christoph Fischer

Merge request reports