NetCDF CF Conventions Writer

Introduction

NetCDF (Network Common Data Form) is a set of libraries and data formats that support creating, accessing, and sharing array-oriented scientific data. The CF Conventions of NetCDF describe what each variable represents in the file, along with the spatial and temporal properties of the data. Initially, the scientific community developed CF Conventions for gridded data produced by climate and forecast models (hence “CF”) of the atmosphere and ocean sciences. However, it has found use in more geosciences sub-domains and observations, including data from other models such as numerical models. 

VTK is a widely used scientific visualization library that caters to domain scientists’ needs to load, transform, and visualize scientific datasets and ParaView is a parallel analysis and visualization application based on VTK. Amongst many other formats, it also provides readers called vtkNetCDFCFReader in VTK, and NetCDF Reader in ParaView. Both of these readers can load NetCDF datasets that use the CF Conventions. However, it lacked a NetCDF writer, which was critical for scientists to save the transformed data back into NetCDF format with CF convention support.

Writer

We are glad to announce that we have implemented a new writer, vtkNetCDFCFWriter in VTK, that takes image data as input and writes a NetCDF file using the CF conventions. The writer can save cell or point attributes (but not both) because while VTK allows point and cell attributes with the same name NetCDF does not support it. The writer can use the vtkGhostType array as input and mark missing points or cells using a fill value specified by NetCDF, and save the coordinate reference system (CRS) associated with the data. The image below shows the NetCDF CF file generated by TestNetCDFCFWriter shown in QGIS.

Okanagan, Canada, NetCDF CF file generated with VTK, layer 15 shown in QGIS.

Future Work

As we identify funding, we plan to:

  • Extend the writer for other input types such as rectilinear, structured (curvilinear), and unstructured grids.
  • Add the conversion from EPSG codes to CF Grid Mapping attributes.
  • Add an OpenStreetMap reader to VTK and ParaView to show a map context to the 3D grid data.

Acknowledgment

We thank Natural Resources Canada for their support in developing this writer.

Tags:

Leave a Reply