NetCDF (Network Common Data Form) Reader/Writer
Licensing options for this format begin with FME Professional Edition.
The NetCDF Reader/Writer allows FME to access data in the netCDF format.
Overview
NetCDF (Network Common Data Form) is an interface for array-oriented data access.
A netCDF dataset contains dimensions, variables, and attributes:
- A dimension may be used to represent a real physical dimension, for example, time, latitude, longitude, or height.
- Variables are used to store the bulk of the data in a netCDF dataset. A variable represents an array of values of the same type. A variable has a name, a data type, and a shape described by its list of dimensions. A variable may also have associated attributes, which may be added, deleted or changed after the variable is created. A variable with the same name as a dimension is called a coordinate variable. It typically defines a physical coordinate corresponding to that dimension. A variable that depends on two or more dimensions is called a data variable, and is read by FME as a feature.
- Attributes are used to store data about the data (ancillary data or metadata), similar in many ways to the information stored in data dictionaries and schema in conventional database systems. Most attributes provide information about a specific variable. Some attributes provide information about the dataset as a whole and are called global attributes.
netCDF is a very generic format, and some conventions have been established for storing data in a consistent way. The FME netCDF reader will read data in the CF, COARDS, or GMT conventions. The FME netCDF writer will write data using the CF conventions.
netCDF Version
FME supports up to version 4.4.1.1 of netCDF.
Reader Overview
FME considers a single NetCDF file to be a dataset.
One raster feature is read for each data variable in the dataset.
Note that while a netCDF dataset may store coordinate system information, this information is not always complete. For example, the CF conventions do not specify a standard way for recording a datum. As a result, coordinate systems read by the NetCDF reader will typically not match well-known names.
Writer Overview
FME considers a dataset to be a folder name. The feature type of each dataset is the filename.
FME will write a netCDF file with a single data variable for each feature. Coordinate variables and dimensions can be specified through attributes.
By default, FME will write coordinate variables named y and x to capture the georeferencing of the raster. For geographic coordinate systems, these variables will instead be named lat and lon. Multi-band rasters will get an additional band coordinate variable which stores a band index.
Instead of these default coordinate variables, user-defined coordinate variables may be defined using the netcdf_coordinate_variable{} list attribute. For example, the following attributes could be specified to create a data variable that depends on four coordinate variables: {year, month, y, x}
netcdf_coordinate_variable{0}.name = "year"
netcdf_coordinate_variable{0}.type = "int"
netcdf_coordinate_variable{1}.name = "month"
netcdf_coordinate_variable{1}.type = "int"
netcdf_coordinate_variable{2}.name = "y"
netcdf_coordinate_variable{2}.type = "double"
netcdf_coordinate_variable{3}.name = "x"
netcdf_coordinate_variable{3}.type = "double"
When user-defined coordinate variables are specified, values must also be specified for each band for each "extra" (non-x/y) coordinate variable. For example, if the year variable defined above has two possible values {2000, 2001} and the month variable has 12 possible values {1, 2, ..., 12}, then the raster must have 24 bands, and the following attributes should be defined:
netcdf_band{0}.coordinate_variable{0} = 2000
netcdf_band{0}.coordinate_variable{1} = 1
netcdf_band{1}.coordinate_variable{0} = 2000
netcdf_band{1}.coordinate_variable{1} = 2
...
netcdf_band{11}.coordinate_variable{0} = 2000
netcdf_band{11}.coordinate_variable{1} = 12
netcdf_band{12}.coordinate_variable{0} = 2001
netcdf_band{12}.coordinate_variable{1} = 1
...
netcdf_band{23}.coordinate_variable{0} = 2001
netcdf_band{23}.coordinate_variable{1} = 12
Note: The last two coordinate variables are always assumed to be y and x, and their values are based on the georeferencing of the raster. As a result, values do not need to be specified for the last two coordinate variables using the netcdf_band{}.coordinate_variable{} list attribute.
FME Raster Features
FME raster features represent raster data and use several concepts that are unlike those used in the handling of vector data. The topics below describe how FME processes raster data.
NetCDF supports rasters with an arbitrary number of bands, provided all bands are the same data type and no band has a palette.