wiki:ReaderLogic2
Last modified 4 years ago Last modified on 05/31/13 15:03:58

Logic for grid type


If the filename ends in ".nc", assume its a NetCDF file and use the NetCDF reader.

If the global attribute "conventions" exits AND it has the string "CF" then

(Assume its a file from CESM or related model) If the global attribute "source" exists and has the string "CAM" then

if dimension names "lon","lat","slat" and "slon" all exist then

Its the CAM-FV grid

else if global attribute "np" exists then

Its the CAM-SE (HOMME) grid

else if dimension names "lon" and "lat" exist then

Its the CAM-EUL grid

else

Unkown CAM grid, error.

else if the global attribute "source" exists and has the string "POP" then

Its the POP ocean grid; use POP grid reader

else if the global attribute "source" exists and has the string "CICE" then

Its the POP ocean grid; use POP grid reader (CICE always uses the same horizontal grid as ocean)

else if the global attribute "source" exists and has the string "CLM" then

Its the land model; TBD

else

Unknown CESM grid; error

else if the dimension variable "vertexDegree" exists then

Its an MPAS file; call MPAS reader

else if the dimension variable "cells" exists then

Its a GCRM file; call GCRM reader

else

Unknown NetCDF grid; error.

end


Placing Variables

CAM-EUL:

The coordinate variable "lat" has the latitude of cell centers
The coordinate variable "lon" has the longitude of cell centers.

if variable's dimensions contain at least ("lat" AND "lon")
    it should be on a cell center

Need 2 vectors of length "lev" and "ilev" for 2 different vertical lengths.

CAM-FV:

The coordinate variable "lat" has the latitude of cell centers
The coordinate variable "lon" has the longitude of cell centers.
The coordinate variable "slat" has the latitude of north/south cell edges
The coordinate variable "slon" has the longitude of east/west cell edges

  if variable's dimensions contain at least ("lat" AND "lon")
    it should be on a cell center
  if variable's dimensions contain at least ("slat" AND "lon")
    it should be on a north/south edge
  if variable's dimensions contain at least  ("lat" AND "slon")
     it should be on an east/west edge

 Need 2 vectors of length "lev" and "ilev" for 2 different vertical lengths.

CAM-SE:

There are no coordinate variables.
The variable "lat" has the latitude of the vertices
The variable "lon" has the longitude of the vertices

If a variables dimensions contain "ncol"
   It should be on a vertex.

Need 2 vectors of length "lev" and "ilev" for 2 different vertical lengths.