pypago.grid

Class that handles grid scale factors for a model configuration

Functions

create_grid(coord[, jmin, jmax, imin, imax]) Returns a Grid instance associated with the input coord argument.

Classes

CommonGrid(coord, jmin, jmax, imin, imax) Grid class associated with all models but GFDL
GfdlGrid(coord, jmin, jmax, imin, imax) GFDL grid class
Grid(coord, jmin, jmax, imin, imax) Class that handles grid extraction on a specific domain
class CommonGrid(coord, jmin, jmax, imin, imax)[source]

Grid class associated with all models but GFDL

class GfdlGrid(coord, jmin, jmax, imin, imax)[source]

GFDL grid class

extract_3d_var_gfdl(coord)[source]

Creates the vertical scale factors for the GFDL model.

class Grid(coord, jmin, jmax, imin, imax)[source]

Class that handles grid extraction on a specific domain

Parameters:
  • jmin (int) – Index of the southernmost point of the subdomain
  • jmax (int) – Index of the northernmost point of the subdomain
  • imin (int) – Index of the westernmost point of the subdomain
  • imax (int) – Index of the easternnmost point of the subdomain
:param pypago.coords.Coords coord: Coordinate object
associated with the grid file (longitude, latitude, mask of the entire domain, used in the file extraction)
compute_areas()[source]

Computes the cell area at the northern and western faces, and the volume and surface of the T grid cells.

create_3d_vert_scalefact()[source]

If the vertical scale factor dzt is 1D, it reconstructs a 3D variable by repeating the 1D variable along the lon and lat dimensions

extract_2d_var(varin)[source]

Extraction of a 2D variable on the subdomain defined by the four domain limits. It provides the possibility to read a variable “discontinuously” (if imin > imax).

Parameters:varin (numpy.array) – Input 2D variable
Returns:The input array extracted on the specified subdomain
Return type:numpy.array
extract_3d_var(varin)[source]

Extraction of a 2D variable on the subdomain defined by the four domain limits. It provides the possibility to read a variable “discontinuously” (if imin > imax).

Parameters:varin (numpy.array) – Input 3D variable
Returns:The input array extracted on the specified subdomain
Return type:numpy.array
extract_all_var(coord)[source]

Extracts all the variables (coordinates, scale factors, etc) on the sub-domain defined by the jmin, jmax, imin and imax variables.

plot_dom(ax=None)[source]

Draws the domain defined by the jmax, jmin, imin, and imax attributes.

Parameters:ax (matplotlib.axes.Axes) – Axis on which to draw the figure. If None, draws on current axis.
plot_mask(ax=None)[source]

Contours the mask attribute

create_grid(coord, jmin=None, jmax=None, imin=None, imax=None)[source]

Returns a Grid instance associated with the input coord argument. If it is a pypago.coord.GfdlCoords object, then it returns a pypago.grid.GfdlGrid object. Else, it returns a pypago.grid.CommonGrid object.

Parameters:
  • jmin (int) – Index of the southernmost point of the subdomain
  • jmax (int) – Index of the northernmost point of the subdomain
  • imin (int) – Index of the westernmost point of the subdomain
  • imax (int) – Index of the easternnmost point of the subdomain
:param pypago.coords.Coords coord: Coordinate object
associated with the grid file (longitude, latitude, mask of the entire domain, used in the file extraction)