NetCDF grid mapping variable: Difference between revisions
From BAWiki
imported>Lang Guenther (first version, no details) |
imported>Lang Guenther (→Maximum Depth (HB): text translated from German to English) |
||
Line 1: | Line 1: | ||
[[de:NetCDF Grid Mapping Variable]] | [[de:NetCDF Grid Mapping Variable]] | ||
=Introduction= | |||
When the coordinate variables for a horizontal grid are not longitude and latitude, it is required that the true latitude and longitude coordinates be supplied via the "coordinates" attribute. If in addition it is desired to describe the mapping between the given coordinate variables and the true latitude and longitude coordinates, the attribute "grid_mapping" may be used to supply this description. This attribute is attached to data variables so that variables with different mappings may be present in a single file. The attribute takes a string value which is the name of another variable in the file that provides the description of the mapping via a collection of attached attributes. This variable is called a grid mapping variable and is of arbitrary type since it contains no data. Its purpose is to act as a container for the attributes that define the mapping. | |||
In case the component of a vector is ''not'' given in ''eastward'' or ''northward'' direction the required coordinate transformation must be also supplied using the ''grid_mapping'' attribute. | |||
=Grid mapping variable= | |||
An extensive description is given in appendix F of the [http://cf-pcmdi.llnl.gov/documents/cf-conventions/1.4/cf-conventions.pdf CF metadata conventions]. Subsequently three different uses cases are going to be presented. | |||
==Transverse Mercator projection== | |||
This type of transformation can be used for [https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system UTM coordinates] and [https://en.wikipedia.org/wiki/Gauss%E2%80%93Kr%C3%BCger_coordinate_system Gauß-Krüger coordinates] as well. | |||
:: integer crs ; \\ no value for this container variable must be specified | |||
::: crs:grid_mapping_name = "'''transverse_mercator'''" ; | |||
::: crs:scale_factor_at_central_merdian = ''value'' ; | |||
::: crs:longitude_of_central_meridian = ''value'' ; | |||
::: crs:latitude_of_projection_origin = ''value'' ; | |||
::: crs:false_easting = ''value'' ; | |||
::: crs:false_northing = ''value'' ; | |||
::: crs:longitude_of_prime_meridian = ''value'' ; // optional but recommended | |||
::: crs:semi_major_axis = ''value'' ; // optional but recommended | |||
::: crs:inverse_flattening = ''value'' ; // optional but recommended | |||
::: crs:comment = "X , Y : ''descriptive text''\\nLON, LAT : Ellipsoid - European Terrestrial Reference System 1989" ; // additional BAW-DH | |||
::: crs:epsg_code = "EPSG:''epsg-code''" ; // see [http://www.epsg-registry.org/ EPSG Geodetic Parameter Registry] | |||
Examples for valid EPSG codes are 31466, 31467, 31468, 31469 (all Gauß-Krüger) or 25831, 25832 (all UTM). | |||
==Geographic coordinates (ETRS 1989)== | |||
:: integer crs ; \\ no value for this container variable must be specified | |||
::: crs:grid_mapping_name = "'''latitude_longitude'''" ; | |||
::: crs:semi_major_axis = 6378137.00 ; // optional but recommended | |||
::: crs:inverse_flattening = 298.257222101 ; // optional but recommended | |||
::: crs:comment = "X , Y : ''descriptive text''; // optional | |||
::: crs:epsg_code = "EPSG:4258" ; // see [http://www.epsg-registry.org/ EPSG Geodetic Parameter Registry] | |||
==Rotated geographic coordinates== | |||
:: integer crs ; \\ no value for this container variable must be specified | |||
::: crs:grid_mapping_name = "'''rotated_latitude_longitude'''" ; | |||
::: crs:grid_north_pole_longitude = ''value'' ; | |||
::: crs:grid_north_pole_latitude = ''value'' ; | |||
=Use cases= | |||
==Referencing a grid mapping variable== | |||
When the coordinate variables for a horizontal grid are not longitude and latitude, it is required that the true latitude and longitude coordinates be supplied via the "coordinates" attribute. Attribute "grid_mapping" is used to describe the mapping between the given coordinate variables and the true latitude and longitude coordinates. Example: | |||
:: double Mesh0_node_water_depth_2d(time,nMesh0_node) ; | |||
::: Mesh0_node_water_depth_2d:standard_name = "sea_floor_depth_below_sea_surface" ; | |||
::: Mesh0_node_water_depth_2d:long_name = "water depth at locations, vertically integrated" ; | |||
::: Mesh0_node_water_depth_2d:units = "m" ; | |||
::: Mesh0_node_water_depth_2d:<font color=blue>coordinates</font> = "Mesh0_node_lon Mesh0_node_lat" ; | |||
::: Mesh0_node_water_depth_2d:_FillValue = ''fillvalue'' ; | |||
::: Mesh0_node_water_depth_2d:valid_range = ''valid minimum'', ''valid maximum'' ; | |||
::: Mesh0_node_water_depth_2d:<font color=blue>grid_mapping</font> = "crs" ; | |||
==Wind defined in rotated pole coordinates== | |||
The components of a wind field are given as local wind ("x_wind", "y_wind") in geographic coordinates. Attribute "grid_mapping" references variable "crs" which contains more information about the coordinate transformation used. | |||
:: float ugrd10m(time, latitude, longitude) ; | |||
::: ugrd10m:name_id = 557s ; | |||
::: ugrd10m:grid_mapping = "<font color=blue>crs</font>" ; | |||
::: ugrd10m:standard_name = "<font color=red>x_wind</font>" ; | |||
::: ugrd10m:units = "m/s" ; | |||
::: ugrd10m:_FillValue = 9.999e+20 ; | |||
::: ugrd10m:long_name = "10 m above ground u-component of wind" ; | |||
:: float vgrd10m(time, latitude, longitude) ; | |||
::: vgrd10m:name_id = 558s ; | |||
::: vgrd10m:grid_mapping = "<font color=blue>crs</font>" ; | |||
::: vgrd10m:standard_name = "<font color=red>y_wind</font>" ; | |||
::: vgrd10m:units = "m/s" ; | |||
::: vgrd10m:_FillValue = 9.999e+20 ; | |||
::: vgrd10m:long_name = "10 m above ground v-component of wind" ; | |||
:: int <font color=blue>crs</font> ; | |||
::: crs:grid_mapping_name = "rotated_latitude_longitude" ; | |||
::: crs:grid_north_pole_longitude = -170. ; | |||
::: crs:grid_north_pole_latitude = 40. ; | |||
A generic application will be able to detect that wind is defined locally ("x_wind", "y_wind"). In case "eastward_wind" and "northward_wind" is requested, the required coordinate transformation could be carried through using the parameters from grid mapping variable "crs". In this situation, to perform a correct transformation, standard names as well as grid mapping variable have to be avaluated. | |||
---- | ---- | ||
back to [[NetCDF]] | back to [[NetCDF]] | ||
---- | ---- | ||
[[Overview]] | [[Overview]] |
Revision as of 10:01, 14 April 2016
Introduction
When the coordinate variables for a horizontal grid are not longitude and latitude, it is required that the true latitude and longitude coordinates be supplied via the "coordinates" attribute. If in addition it is desired to describe the mapping between the given coordinate variables and the true latitude and longitude coordinates, the attribute "grid_mapping" may be used to supply this description. This attribute is attached to data variables so that variables with different mappings may be present in a single file. The attribute takes a string value which is the name of another variable in the file that provides the description of the mapping via a collection of attached attributes. This variable is called a grid mapping variable and is of arbitrary type since it contains no data. Its purpose is to act as a container for the attributes that define the mapping.
In case the component of a vector is not given in eastward or northward direction the required coordinate transformation must be also supplied using the grid_mapping attribute.
Grid mapping variable
An extensive description is given in appendix F of the CF metadata conventions. Subsequently three different uses cases are going to be presented.
Transverse Mercator projection
This type of transformation can be used for UTM coordinates and Gauß-Krüger coordinates as well.
- integer crs ; \\ no value for this container variable must be specified
- crs:grid_mapping_name = "transverse_mercator" ;
- crs:scale_factor_at_central_merdian = value ;
- crs:longitude_of_central_meridian = value ;
- crs:latitude_of_projection_origin = value ;
- crs:false_easting = value ;
- crs:false_northing = value ;
- crs:longitude_of_prime_meridian = value ; // optional but recommended
- crs:semi_major_axis = value ; // optional but recommended
- crs:inverse_flattening = value ; // optional but recommended
- crs:comment = "X , Y : descriptive text\\nLON, LAT : Ellipsoid - European Terrestrial Reference System 1989" ; // additional BAW-DH
- crs:epsg_code = "EPSG:epsg-code" ; // see EPSG Geodetic Parameter Registry
- integer crs ; \\ no value for this container variable must be specified
Examples for valid EPSG codes are 31466, 31467, 31468, 31469 (all Gauß-Krüger) or 25831, 25832 (all UTM).
Geographic coordinates (ETRS 1989)
- integer crs ; \\ no value for this container variable must be specified
- crs:grid_mapping_name = "latitude_longitude" ;
- crs:semi_major_axis = 6378137.00 ; // optional but recommended
- crs:inverse_flattening = 298.257222101 ; // optional but recommended
- crs:comment = "X , Y : descriptive text; // optional
- crs:epsg_code = "EPSG:4258" ; // see EPSG Geodetic Parameter Registry
- integer crs ; \\ no value for this container variable must be specified
Rotated geographic coordinates
- integer crs ; \\ no value for this container variable must be specified
- crs:grid_mapping_name = "rotated_latitude_longitude" ;
- crs:grid_north_pole_longitude = value ;
- crs:grid_north_pole_latitude = value ;
- integer crs ; \\ no value for this container variable must be specified
Use cases
Referencing a grid mapping variable
When the coordinate variables for a horizontal grid are not longitude and latitude, it is required that the true latitude and longitude coordinates be supplied via the "coordinates" attribute. Attribute "grid_mapping" is used to describe the mapping between the given coordinate variables and the true latitude and longitude coordinates. Example:
- double Mesh0_node_water_depth_2d(time,nMesh0_node) ;
- Mesh0_node_water_depth_2d:standard_name = "sea_floor_depth_below_sea_surface" ;
- Mesh0_node_water_depth_2d:long_name = "water depth at locations, vertically integrated" ;
- Mesh0_node_water_depth_2d:units = "m" ;
- Mesh0_node_water_depth_2d:coordinates = "Mesh0_node_lon Mesh0_node_lat" ;
- Mesh0_node_water_depth_2d:_FillValue = fillvalue ;
- Mesh0_node_water_depth_2d:valid_range = valid minimum, valid maximum ;
- Mesh0_node_water_depth_2d:grid_mapping = "crs" ;
- double Mesh0_node_water_depth_2d(time,nMesh0_node) ;
Wind defined in rotated pole coordinates
The components of a wind field are given as local wind ("x_wind", "y_wind") in geographic coordinates. Attribute "grid_mapping" references variable "crs" which contains more information about the coordinate transformation used.
- float ugrd10m(time, latitude, longitude) ;
- ugrd10m:name_id = 557s ;
- ugrd10m:grid_mapping = "crs" ;
- ugrd10m:standard_name = "x_wind" ;
- ugrd10m:units = "m/s" ;
- ugrd10m:_FillValue = 9.999e+20 ;
- ugrd10m:long_name = "10 m above ground u-component of wind" ;
- float ugrd10m(time, latitude, longitude) ;
- float vgrd10m(time, latitude, longitude) ;
- vgrd10m:name_id = 558s ;
- vgrd10m:grid_mapping = "crs" ;
- vgrd10m:standard_name = "y_wind" ;
- vgrd10m:units = "m/s" ;
- vgrd10m:_FillValue = 9.999e+20 ;
- vgrd10m:long_name = "10 m above ground v-component of wind" ;
- float vgrd10m(time, latitude, longitude) ;
- int crs ;
- crs:grid_mapping_name = "rotated_latitude_longitude" ;
- crs:grid_north_pole_longitude = -170. ;
- crs:grid_north_pole_latitude = 40. ;
- int crs ;
A generic application will be able to detect that wind is defined locally ("x_wind", "y_wind"). In case "eastward_wind" and "northward_wind" is requested, the required coordinate transformation could be carried through using the parameters from grid mapping variable "crs". In this situation, to perform a correct transformation, standard names as well as grid mapping variable have to be avaluated.
back to NetCDF