mitgcm
Analysis of MITgcm output using python
Public Member Functions | List of all members
mitgcm.core.Grid Class Reference

This defines the class for the grid object. More...

Inheritance diagram for mitgcm.core.Grid:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, grid_netcdf_filename)
 Define a single object that has all of the grid variables tucked away in it. More...
 
def compute_boundary_masks (self)
 This function does the computationally heavy job of looping through each dimension and creating masks that are one if the boundary is next to the grid point in the specified direction. More...
 
def compute_cell_volume (self)
 
- Public Member Functions inherited from mitgcm.core.MITgcm_Simulation
def __init__
 Instantiate an MITgcm model instance. More...
 
def load_field
 Load a model field from NetCDF output. More...
 
def load_from_file (self, model_instance, file_list, variable, time_level, grid_loc, single_file)
 Internal function to pull the data from the file(s). More...
 
def __add__ (self, other)
 A method that allows model objects to be added together. More...
 
def __div__ (self, other)
 A method that allows model objects to be divided by floating point numbers. More...
 
def __mul__ (self, other)
 A method that allows model objects to be multiplied by floating point numbers. More...
 
def __rmul__ (self, other)
 A method that allows model objects to be multiplied by floating point numbers. More...
 

Additional Inherited Members

- Public Attributes inherited from mitgcm.core.MITgcm_Simulation
 grid
 

Detailed Description

This defines the class for the grid object.

Currently requires a single grid file.

This object holds all the information about the grid on which the simulation was run. It also holds masks for selecting only the boundary values of fields on the tracer points.

Definition at line 848 of file core.py.

Constructor & Destructor Documentation

def mitgcm.core.Grid.__init__ (   self,
  grid_netcdf_filename 
)

Define a single object that has all of the grid variables tucked away in it.

Each of the variables pulled directly from the netcdf file still has the original description attached to it. The 2D and 3D arrays do not.

Variables imported are:

  • rAw: r-face area at U point
  • rAs: r-face area at V point
  • rA: r-face area at cell center
  • HFacW: vertical fraction of open cell at West face
  • HFacS: vertical fraction of open cell at South face
  • HFacC: vertical fraction of open cell at cell center
  • X: longitude of cell center
  • Xp1: longitude of cell corner
  • dxF: x cell face separation
  • dxC: x cell center separation
  • dxV: x v-velocity separation
  • Y: latitude of cell center
  • Yp1: latitude of cell corner
  • dyU: y u-velocity separation
  • dyC: y cell center separation
  • dyF: y cell face separation
  • Z: vertical coordinate of cell center
  • Zl: vertical coordinate of upper cell interface
  • Zu: vertical coordinate of lower cell interface
  • drC: r cell center separation
  • drF: r cell face separation
  • fCoriG: Coriolis f at cell corner
  • fCori: Coriolis f at cell center

Variables computed and stored are:

  • wet_mask_V : a 3d array that is one if the point is in the fluid, zero otherwise.
  • wet_mask_U
  • wet_mask_TH
  • wet_mask_W

Cell volumes can be calculated and stored with the compute_cell_volume function

  • cell_volume

These boundary masks can be computed with the compute_boundary_masks function

  • west_mask : a 3d array that is one if the point has a boundary to the west
  • east_mask
  • south_mask
  • north_mask
  • bottom_mask
    Notes: uses glob to expand wildcards in the file name. BUT, it will only use the first file that matches.

Definition at line 856 of file core.py.

Member Function Documentation

def mitgcm.core.Grid.compute_boundary_masks (   self)

This function does the computationally heavy job of looping through each dimension and creating masks that are one if the boundary is next to the grid point in the specified direction.

This function is accelerated by numba, making it about 100 times faster.

Definition at line 968 of file core.py.

def mitgcm.core.Grid.compute_cell_volume (   self)
Compute a 3D array that contains the volume of each cell.

Definition at line 1014 of file core.py.


The documentation for this class was generated from the following file: