##### Child pages
• Structured grids
Go to start of banner

# Structured grids

Unknown macro: {hide-from}

Unknown macro: {show-to}

The coordinates associated with two-dimensional structured grids may be defined using either coordinate or auxiliary coordinate variables.

## Use of coordinate variables

In a previous version of this page, this was referred to "direct mapping".
Coordinate variables are one-dimensional variables with the variable name equal to the dimension name. Coordinate variables may be used if the coordinate directions are perpendicular to each other and the grid is Cartesian. In the example below the grid coordinates are given by all pairs of x and y coordinate values. The dimensions x and y of the data variable waterlevel map directly to the coordinate variables; no additional attributes are needed.

```dimensions:
x = 5 ;
y = 4 ;

variables:
double x(x) ;
x:standard_name = "longitude" ;
x:units = "degrees_east" ;
double y(y) ;
y:standard_name = "latitude" ;
y:units = "degrees_north" ;
double waterlevel(y,x) ;
waterlevel:standard_name = "sea_surface_height_above_geoid" ;
waterlevel:units = "m" ;
```

## Use of coordinate variables

In a previous version of this page, this was referred to "indirect mapping".
Auxiliary coordinate variables are variables that can be used as coordinates but that don't satisfy the conditions of coordinate variables indicated above. Auxiliary coordinate variables may be used for curvilinear meshes or alternative coordinate systems (e.g. pressure levels next to elevation). In the example below the grid coordinates are given by all pairs of x and y values with identical m and n index. The dimensions m and n of the data variable waterlevel don't map directly to the coordinate variables; the additional attribute "coordinates" is needed to associate the data variable with its coordinates.

```dimensions:
m = 5 ;
n = 4 ;

variables:
double x(n,m) ;
x:standard_name = "longitude" ;
x:units = "degrees_east" ;
double y(n,m) ;
y:standard_name = "latitude" ;
y:units = "degrees_north" ;
double waterlevel(n,m) ;
waterlevel:standard_name = "sea_surface_height_above_geoid" ;
waterlevel:units = "m" ;
waterlevel:coordinates = "lat lon" ;
```

## Global and projection coordinates

The CF conventions distinguish between global (latitude,longitude) coordinates and local planar (projection_x_coordinate, projection_y_coordinate) coordinates. The pair of (latitude,longitude) coordinates is required by the CF convention; projection coordinates are optional. Either pair of coordinates may be defined using coordinate variables, but the following combinations are most common and recommended:

• local rectilinear projected (x,y) grid defined using coordinate dimensions and curvilinear grid in (latitude,longitude) coordinates using auxiliary coordinate variables.
• local curvilinear projected (x,y) grid and curvilinear grid in (latitude,longitude) coordinates both using auxiliary coordinate variables.
• rectilinear grid in (latitude,longitude) coordinates defined using coordinate dimensions.
• curvilinear grid in (latitude,longitude) coordinates using auxiliary coordinate variables.

See the coordinate system meta-information page for information on storing projection information.

## Missing coordinates

Examples of orthogonal and curvi-linear netCDF files of models like Delft3D are available via:
http://coast-enviro.er.usgs.gov/thredds/catalog.html
The main difference between engineering type models like Delft3D and ocean type models available via that server is that Delft3D models are frequently using incomplete grids, i.e. structured grids that don't have (x,y) coordinate pairs defined for all grid index pairs. An example for the branches of the Rhine River in the Netherlands is shown below; the right figure shows the mask of the grid. A pdf of the full mesh including the mask can be downloaded here. Because of the high degree of distortion in the grid (e.g. neighbouring grid lines may follow two separate river branches going off in two completely different directions), it's not possible to automatically generate reasonable coordinates for such masked points.  The current version of the CF conventions does not allow for missing values in (auxiliary) coordinates; a proposal to allow such missing values is under discussion in the CF community.

• No labels