2.5.2.2. data.misc.arakawa
– Arakawa grids¶
Attributes: | ||||
---|---|---|---|---|
Classes: | ||||
Inheritance diagram: | ||||
-
ARAKAWA_LOCATIONS
= ['t', 'u', 'v', 'w', 'f']¶ Strings for naming standard physical ARAKAWA_LOCATIONS on grid
-
ARAKAWA_POSITIONS
= ['t', 'u', 'v', 'w', 'f']¶ Alias for
ARAKAWA_LOCATIONS
-
class
ArakawaGrid
[source]¶ Bases:
vacumm.data.misc.arakawa._ArakawaInterp_
Base class that provides a facotry and declares grid operations
-
are_same_locs
(p0, p1)[source]¶ Check if to ARAKAWA_POSITIONS are the same
Example: >>> mygrid.are_same_locs('t', 'u')
-
static
factory
(arg)[source]¶ Guess the grid type and class, and instantiate it
Params: - arg: An explicit grid type (
ARAKAWA_GRID_TYPES
), or an object with a eithergrid_type
,arakawa_grid_type
orgrid_type
attribute.
Return: A
ArakawaGrid
children object orNone
if grid type has not been guessed.- arg: An explicit grid type (
-
interp
(var, p0, p1, copy=False, mode=None, zfirst=True, **kwargs)[source]¶ Interpolate a variable from one location to another one using
vacumm.misc.grid.regridding.shift2d()
(horizontal) andvacumm.misc.grid.regridding.shift1d()
(vertical)Note
It does not change the attributes.
Params: - var: MV2 array with a grid.
- p0/1: Valid ARAKAWA_LOCATIONS: 0=source, 1=destination.
If p0 is None, it is guessed with
vacumm.data.cf.get_loc()
. - mode, optional: Interpolation mode at boundaries
(see
shift2d()
). - zfirst, optional: Perform the vertical interpolation first, then the horizontal interpolation.
- copy, optional: Copy the variable if same location?
Example: >>> u3d_t = CGrid().interp(u3d_u, 'u', 't', mode='extrap')
-
loc2loc
(var, p0, p1, copy=False, mode=None, zfirst=True, **kwargs)¶ Interpolate a variable from one location to another one using
vacumm.misc.grid.regridding.shift2d()
(horizontal) andvacumm.misc.grid.regridding.shift1d()
(vertical)Note
It does not change the attributes.
Params: - var: MV2 array with a grid.
- p0/1: Valid ARAKAWA_LOCATIONS: 0=source, 1=destination.
If p0 is None, it is guessed with
vacumm.data.cf.get_loc()
. - mode, optional: Interpolation mode at boundaries
(see
shift2d()
). - zfirst, optional: Perform the vertical interpolation first, then the horizontal interpolation.
- copy, optional: Copy the variable if same location?
Example: >>> u3d_t = CGrid().interp(u3d_u, 'u', 't', mode='extrap')
-
-
class
CGrid
[source]¶ Bases:
vacumm.data.misc.arakawa.ArakawaGrid
C Arakawa grid
-
f
= (1, 1, 0)¶
-
grid_type
= 'C'¶
-
gtype
= 'C'¶
-
t
= (0, 0, 0)¶
-
u
= (1, 0, 0)¶
-
v
= (0, 1, 0)¶
-
w
= (0, 0, 1)¶
-
-
class
AGrid
[source]¶ Bases:
vacumm.data.misc.arakawa.ArakawaGrid
A Arakawa grid
-
f
= (0, 0, 0)¶
-
grid_type
= 'A'¶
-
gtype
= 'A'¶
-
t
= (0, 0, 0)¶
-
u
= (0, 0, 0)¶
-
v
= (0, 0, 0)¶
-
w
= (0, 0, 0)¶
-
-
class
ArakawaGridTransfer
(grid0, grid1)[source]¶ Bases:
vacumm.data.misc.arakawa._ArakawaInterp_
To interpolate variables from one grid type to another
Note
This classes does not interpolate between two grids, it just interpolates between relative ARAKAWA_POSITIONS. For general interpolations, please use
regrid2d()
.Example: >>> sst_a_v = ArakawaGridTransfer('C','A').interp(sst_c_t, 't', 'v')
-
interp
(var, p0=None, p1=None, copy=False, mode=None, zfirst=True, **kwargs)[source]¶ Interpolate a variable from one location to another one using
vacumm.misc.grid.regridding.shift2d()
(horizontal) andvacumm.misc.grid.regridding.shift1d()
(vertical)Note
It does not change the attributes.
Params: - var: MV2 array with a grid.
- p0/1: Valid ARAKAWA_LOCATIONS: 0=source, 1=destination.
If p0 is None, it is guessed with
vacumm.data.cf.get_loc()
. If p1 is None, it defaults to p0. - mode, optional: Interpolation mode at boundaries
(see
shift2d()
). - copy, optional: Copy the variable if same location?
Example: >>> sst_a_v = ArakawaGridTransfer('C','A').interp(sst_c_t, 't', 'v')
-