pypago.coords¶
Module related to model coordinates
Functions
create_coord (modelname, filename) |
Returns a Coord object, depending on the modelname |
Classes
CcsmCoords (filename) |
Coords class associated with the CCSM ocean model Inheritates from the pypago.coords.Coords class. |
Coords (filename) |
Initialisation of the Coords class. |
GfdlCoords (filename) |
Coords class associated with the GFDL ocean model Inheritates from the pypago.coords.Coords class. |
HycoCoords (filename) |
Coords class associated with the Hyco ocean model Inheritates from the pypago.coords.Coords class. |
MicoCoords (filename) |
Coords class associated with the Mico ocean model Inheritates from the pypago.coords.Coords class. |
MpioCoords (filename) |
Coords class associated with the MPIO ocean model Inheritates from the pypago.coords.Coords class. |
NemoCoords (filename) |
Coords class associated with the NEMO ocean model Inheritates from the pypago.coords.Coords class. |
OfamCoords (filename) |
Coords class associated with the Ofam ocean model Inheritates from the pypago.coords.Coords class. |
RomsCoords (filename) |
Coords class associated with the Roms ocean model Inheritates from the pypago.coords.Coords class. |
-
class
CcsmCoords
(filename)[source]¶ Coords class associated with the CCSM ocean model Inheritates from the
pypago.coords.Coords
class:from pypago.coords import CcsmCoords filename = 'ccsm_mesh.nc' coords = CcsmCoords(filename)
Parameters: filename (str) – Name of the NetCDF mesh file
-
class
Coords
(filename)[source]¶ Initialisation of the
Coords
class. It is initialised by providing a NetCDF mesh file. The class reads and assigns the following attributes: - longitude - latitude - bathy (if exists, else None) - mask (if exists, else None) - dxt - dyt - dye (if exists, else None) - dxn (if exists, else None) - dzt (if exists, else None)Parameters: filename (str) – Name of the NetCDF mesh file Note
At this stage, all the file is read (no extraction over a subdomain)
-
class
GfdlCoords
(filename)[source]¶ Coords class associated with the GFDL ocean model Inheritates from the
pypago.coords.Coords
class:from pypago.coords import GfdlCoords filename = 'gfdl_mesh.nc' coords = GfdlCoords(filename)
Parameters: filename (str) – Name of the mesh file
-
class
HycoCoords
(filename)[source]¶ Coords class associated with the Hyco ocean model Inheritates from the
pypago.coords.Coords
class:from pypago.coords import HycoCoords filename = 'Hyco_mesh.nc' coords = HycoCoords(filename)
Parameters: filename (str) – Name of the NetCDF mesh file -
read_coord
()[source]¶ Processes HYCO file coordinates (bathy, longitude, latitude, mask). - Reconstructs the mask array from the bathy (where bathy>0, mask=1)
-
read_scalefactors
()[source]¶ Processes HYCO scale factors. - Reconstruction of dxn from dxt by adding a line of NaN at the bottom of dxt - Extraction of the dyw array - Extraction of the layer index in order to recover the number of vertical levels - Creation of dzt, dzn and dze as 3D arrays of ones.
-
-
class
MicoCoords
(filename)[source]¶ Coords class associated with the Mico ocean model Inheritates from the
pypago.coords.Coords
class:from pypago.coords import MicoCoords filename = 'Mico_mesh.nc' coords = MicoCoords(filename)
Parameters: filename (str) – Name of the NetCDF mesh file -
read_scalefactors
()[source]¶ Processes MICO scale factors. - Extract dx at southern faces - Reconstruct dx at northern faces (dxn) - Extraction of dyw - Creation of vertical scale factors: a) In isopicnic coordinates: asking for the number of vertical levels, setting dzt, dzw and dzn as 1D array of ones b) In interpolated z-coordinates: opening of a file with the z-bounds, reconstruction of dzt. And copy of the dzt values to dzw and dzn (no scale factors)
-
-
class
MpioCoords
(filename)[source]¶ Coords class associated with the MPIO ocean model Inheritates from the
pypago.coords.Coords
class:from pypago.coords import MpioCoords filename = 'mpio_mesh.nc' coords = MpioCoords(filename)
Parameters: filename (str) – Name of the NetCDF mesh file -
read_coord
()[source]¶ Processes MPIO file coordinates (bathy, longitude, latitude, mask). - If flips all the arrays along their rightmost dimension (latitude) so that north is on the top of the figures (using flipud) - Extracts the first level of the tmask array - Setting the tmask to 0 where Nan/masked
-
read_scalefactors
()[source]¶ Processes MPIO scale factors. - Flipping the dxt, dyt, dxn and dye arrays along the first dimension (flipud) - Flipping the dzt array along the 2nd dimension - Creation of dzw by multiplication of dzt with the flipped amsuo variable - Creation of dzn by multiplication of dzt with the flipped amsue variable
-
-
class
NemoCoords
(filename)[source]¶ Coords class associated with the NEMO ocean model Inheritates from the
pypago.coords.Coords
class:from pypago.coords import NemoCoords filename = 'nemo_mesh.nc' coords = NemoCoords(filename)
Parameters: filename (str) – Name of the NetCDF mesh file -
read_coord
()[source]¶ Processes NEMO file coordinates (bathy, longitude, latitude, mask). - If the bathy array is None (i.e not read from input file) it is constructed from the mbathy and deptht arrays - Extracts the first level of the mask array
-
read_scalefactors
()[source]¶ Processes NEMO scale factors. - Initialises the dzw and dzn arrays. If dzt is 1D, then no partial step is assumed. If dzt is 2D, then 3D dzt, dzn and dze are reconstructed using the mbathy array. If dzt is 3D then we assume that dze and dzn are in files - Masking the dzt, dzw, dzn arrays where the associated masks are 0 or masked - Reconstruction of dzw from dze
-
reconstruct_3d_e3t
()[source]¶ Creates, from 2D partial step value, a 3D cell width at T points. It is constructed by using the “mbathy” variable (index of the last non-ocean point) and the 1D constant scale factor
Returns: A numpy array containing the cell width at T, U and V points Return type: numpy.array
-
-
class
OfamCoords
(filename)[source]¶ Coords class associated with the Ofam ocean model Inheritates from the
pypago.coords.Coords
class:from pypago.coords import OfamCoords filename = 'Ofam_mesh.nc' coords = OfamCoords(filename)
Parameters: filename (str) – Name of the NetCDF mesh file
-
class
RomsCoords
(filename)[source]¶ Coords class associated with the Roms ocean model Inheritates from the
pypago.coords.Coords
class:from pypago.coords import RomsCoords filename = 'Roms_mesh.nc' coords = RomsCoords(filename)
Parameters: filename (str) – Name of the NetCDF mesh file -
read_scalefactors
()[source]¶ Processes ROMS scale factors. - Taking the inverse of dxt, dyt, dye and dxn - Adding a line of NaNs at the bottom of the dzt array - Extracting the dze and dzn arrays - Creating the dzw array from the dze array by adding a layer of NaNs on the easternmost face of the “cube”
-