PUBLIC INTERFACE ~ PUBLIC DATA ~ PUBLIC ROUTINES ~ NAMELIST ~ DIAGNOSTIC FIELDS ~ ERROR MESSAGES ~ REFERENCES ~ NOTES

## Module grid_mod

Contact:
Reviewers:
Change History:

#### OVERVIEW

Provides a set of subroutines for reading grid spec files

Historically, there are several different formats of the grid specification files. Though all of them are NetCDF files, they differ in the information they contain, and in the way this information is stored. For example, the geographical coordinates of ocean grid cells can be stored in differently named variables in grid_spec.nc, or the can be in a separate component mosaic file, referred to from grid_spec.nc.

This module aims to isolate a casual user from the complexity of grid spec file parsing and to provide a unified interface for access to the grid data. At the same time, it allows the developers of the grid specifications to keep enhancing the internal structure transparently for the users of this module, as long as the interfaces of the module subroutines are preserved.

#### OTHER MODULES USED

      constants_mod
            fms_mod
         mosaic_mod
    mpp_domains_mod

#### PUBLIC INTERFACE

get_grid_ntiles
  returns number of mosaic tiles
get_grid_size
  returns horizontal size of the grid, or sizes of the mosaic tiles
get_grid_cell_centers
  reads arrays of grid cell center point coordinates
get_grid_cell_vertices
  reads arrays of grid cell verices coordinates
get_grid_cell_area
  reads an array of grid cell areas
get_grid_comp_area
  reads an array of the areas for a component model

#### PUBLIC ROUTINES

1. #### get_grid_ntiles

       subroutine get_grid_ntiles(component,ntiles)

   DESCRIPTION
     Given a component name, returns the number of mosaic tiles for the component. For pre-mosaic grid spec files returns 1.
   INPUT

     `component` | A name of the component, 'ATM', 'OCN', or 'LND' [character(len=*)]

   OUTPUT

     `ntiles` | number of mosaic tiles for the component [integer]

2. #### get_grid_size

       subroutine get_grid_size(component,nx,ny)
       subroutine get_grid_size(component,tile,nx,ny)

   DESCRIPTION
     Given a component name, returns the size of the grid for all mosaic tiles, or for the specified tile.
   INPUT

     `component` | A name of the component: 'ATM', 'OCN', or 'LND' [character(len=*)]
     `tile` | Number of mosaic tile [integer]

   OUTPUT

     `nx, ny` | number of grid cell along respective axis, either for all mosaic tiles, or for a specified mosaic tile [integer] [integer, dimension(:)]

3. #### get_grid_cell_centers

       subroutine get_grid_cell_centers(component,tile,glon,glat)

   DESCRIPTION
     Given a component name and a mosaic tile number, returns longitudes and latitudes of grid ceneters for the specified mosaic tile.
   INPUT

     `component` | A name of the component, 'ATM', 'OCN', or 'LND' [character(len=*)]
     `tile` | Number of mosaic tile [integer]

   OUTPUT

     `glon` | longitudes of grid cell centers, degree [real, dimension(:,:)]
     `glat` | latatitdes of grid cell centers, degree [real, dimension(:,:)]

4. #### get_grid_cell_vertices

       subroutine get_grid_cell_vertices(component,tile,glonb,glatb)

   DESCRIPTION
     Given a component name and a mosaic tile number, returns longitudes and latitudes of grid vertices for the specified mosaic tile.
   INPUT

     `component` | A name of the component, 'ATM', 'OCN', or 'LND' [character(len=*)]
     `tile` | Number of mosaic tile [integer]

   OUTPUT

     `glonb` | longitudes of grid cell vertices, degree [real, dimension(:,:)]
     `glatb` | latatitdes of grid cell vertices, degree [real, dimension(:,:)]

5. #### get_grid_cell_area

       subroutine get_grid_cell_area(component,tile,cellarea)

   DESCRIPTION
     Given a component name and a mosaic tile number, returns an array of areas for the specified tile. Note that the returnd values are full grid cell areas, so for example for land it will not depend on the fraction of land actually present in the grid cell.
   INPUT

     `component` | A name of the component, 'ATM', 'OCN', or 'LND' [character(len=*)]
     `tile` | Number of mosaic tile [integer]

   OUTPUT

     `cellarea` | array of grid cell areas, m2 [real, dimension(:,:)]

6. #### get_grid_cell_area

       subroutine get_grid_comp_area(component,tile,area)

   DESCRIPTION
     Given a component name and a mosaic tile number, returns an array of component model areas for the specified tile. Note that the returnd values are the areas for each grid cell that belong to the specified component, so for example for land it will depend on the fraction of land actually present in the grid cell. For atmosphere the area returned by this routine is the same as the cell area area returned by `get_grid_cell_area`
   INPUT

     `component` | A name of the component, 'ATM', 'OCN', or 'LND' [character(len=*)]
     `tile` | Number of mosaic tile [integer]

   OUTPUT

     `area` | array of grid cell areas, m2 [real, dimension(:,:)]