Field¶
- class esmpy.api.field.Field(grid, name=None, typekind=None, staggerloc=None, meshloc=None, ndbounds=None)¶
The
Field
class is a Python wrapper object for the ESMF Field. The individual values of all data arrays are referenced to those of the underlying Fortran ESMF object.A
Field
represents a physical field, such as temperature. TheField
class contains distributed and discretized field data, a reference to its associated grid, and metadata. TheField
class stores the grid staggering for that physical field. This is the relationship of how the data array of a field maps onto a grid (e.g. one item per cell located at the cell center, one item per cell located at the NW corner, one item per cell vertex, etc.). This means that differentFields
which are on the same underlyingGrid
but have different staggerings can share the sameGrid
object without needing to replicate it multiple times.Refer to the Field Class of the ESMF Reference Manual for more information.
The following parameters are used to create a
Field
from aGrid
,Mesh
orLocStream
.REQUIRED:
- :param
Grid
/Mesh/LocStream
grid: AGrid
, Mesh
orLocStream
with coordinates allocated on at least one stagger location.
OPTIONAL:
- Parameters:
typekind (TypeKind) – Type of the
Field
data. IfNone
, defaults toR8
.staggerloc (StaggerLoc) – The stagger location of the
Field
data, only specify this argument when using aGrid
. IfNone
, defaults toCENTER
in 2D andCENTER_VCENTER
in 3D.meshloc (MeshLoc) – The mesh location of the
Field
data, only specify this argument when using aMesh
ifNone
, defaults toNODE
.ndbounds (tuple) – The number of entries in an extra
Field
dimension. This is represented as a single value, a list or a tuple containing the number of entries for each desired extra dimension of theField
. The time dimension must be last, following Fortran indexing conventions.
- property grid¶
- get_area()¶
Initialize an existing
Field
with the areas of the cells of the underlyingGrid
orMesh
.
- read(filename, variable, timeslice=None)¶
Read data into an existing
Field
from a CF-compliant NetCDF file.- Note:
This interface is not supported when ESMF is built with
ESMF_COMM=mpiuni
.- Note:
This interface does not currently support reading ungridded dimensions.
REQUIRED:
- Parameters:
OPTIONAL:
- Parameters:
timeslice (int) – The number of timeslices to read.
- :param