diff --git a/docs/nightly/v8.8.0b03/ESMPy.pdf b/docs/nightly/v8.8.0b03/ESMPy.pdf new file mode 100644 index 00000000..db87da17 Binary files /dev/null and b/docs/nightly/v8.8.0b03/ESMPy.pdf differ diff --git a/docs/nightly/v8.8.0b03/html/.buildinfo b/docs/nightly/v8.8.0b03/html/.buildinfo new file mode 100644 index 00000000..20fb2b34 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: 9a7b71e66bbdff19ccf1e1465780cd5a +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/nightly/v8.8.0b03/html/CoordSys.html b/docs/nightly/v8.8.0b03/html/CoordSys.html new file mode 100644 index 00000000..17a7fb2b --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/CoordSys.html @@ -0,0 +1,165 @@ + + + + + + + + CoordSys — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

CoordSys

+
+
+class esmpy.api.constants.CoordSys(value, names=None, module=None, type=None, start=1)
+

This flag indicates the coordinate system of a Grid. This value is +useful both to indicate to other users the type of the coordinates, +but also to control how the coordinates are interpreted in +regridding methods (e.g. Regrid).

+
+
+CART = <CoordSys.CART: 0>
+

Cartesian coordinate system. In this system, the Cartesian +coordinates are mapped to the Grid coordinate dimensions in the +following order: x, y, z. (e.g. using coord_dim=1 in +get_coords() references the y dimension)

+
+ +
+
+SPH_DEG = <CoordSys.SPH_DEG: 1>
+

Spherical coordinates in degrees. In this system, the spherical +coordinates are mapped to the Grid coordinate dimensions in the +following order: longitude, latitude, radius. (E.g. using +coord_dim=1 in get_coords()` references the latitude dimension).

+
+ +
+
+SPH_RAD = <CoordSys.SPH_RAD: 2>
+

Spherical coordinates in radians. In this system, the spherical +coordinates are mapped to the Grid coordinate dimensions in the +following order: longitude, latitude, radius. (E.g. using +coord_dim=1 in get_coords() references the latitude dimension).

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/ExtrapMethod.html b/docs/nightly/v8.8.0b03/html/ExtrapMethod.html new file mode 100644 index 00000000..9b270599 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/ExtrapMethod.html @@ -0,0 +1,176 @@ + + + + + + + + ExtrapMethod — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

ExtrapMethod

+
+
+class esmpy.api.constants.ExtrapMethod(value, names=None, module=None, type=None, start=1)
+

Specify which extrapolation method to use on unmapped destination points after +regridding.

+
+
+NONE = <ExtrapMethod.NONE: 0>
+

Indicates that no extrapolation should be done.

+
+ +
+
+NEAREST_STOD = <ExtrapMethod.NEAREST_STOD: 1>
+

Nearest source to destination. +Here each destination point is mapped to the closest source point. A given +source point may go to multiple destination points, but no destination +point will receive input from more than one source point.

+
+ +
+
+NEAREST_IDAVG = <ExtrapMethod.NEAREST_IDAVG: 2>
+

Inverse distance weighted average. +Here the value of a destination point is the weighted average of the +closest N source points. The weight is the reciprocal of the distance of +the source point from the destination point raised to a power P. All the +weights contributing to one destination point are normalized so that they +sum to 1.0. The user can choose N and P when using this method, but +defaults are also provided.

+
+ +
+
+CREEP_FILL = <ExtrapMethod.CREEP_FILL: 3>
+

Creep fill extrapolation. +Here unmapped destination points are filled by repeatedly moving data from +mapped locations to neighboring unmapped locations. The data filled into a +new location is the average of its already filled neighbors’ values. This +process is repeated for a user specified number of levels (e.g. in Regrid() +this is specified via the extrap_num_levels parameter). This extrapolation +method is not supported with conservative regrid methods.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/FileFormat.html b/docs/nightly/v8.8.0b03/html/FileFormat.html new file mode 100644 index 00000000..fa8c50d7 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/FileFormat.html @@ -0,0 +1,176 @@ + + + + + + + + FileFormat — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

FileFormat

+
+
+class esmpy.api.constants.FileFormat(value, names=None, module=None, type=None, start=1)
+

The Grid and Mesh objects +may be created from specifications in a NetCDF data file. This flag +indicates the format of the data file.

+
+
+VTK = <FileFormat.VTK: 1>
+

Use the VTK file format.

+
+ +
+
+SCRIP = <FileFormat.SCRIP: 2>
+

Use the SCRIP file format.

+
+ +
+
+ESMFMESH = <FileFormat.ESMFMESH: 3>
+

Use the ESMFMESH unstructured grid file format.

+
+ +
+
+ESMFGRID = <FileFormat.ESMFGRID: 4>
+

Use the ESMF structured grid file format.

+
+ +
+
+UGRID = <FileFormat.UGRID: 5>
+

Use the UGRID unstructured grid file format.

+
+ +
+
+GRIDSPEC = <FileFormat.GRIDSPEC: 6>
+

Use the UGRID single tile grid file format based on CF V1.6 conventions (a.k.a GRIDSPEC).

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/FileMode.html b/docs/nightly/v8.8.0b03/html/FileMode.html new file mode 100644 index 00000000..0085a1b9 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/FileMode.html @@ -0,0 +1,146 @@ + + + + + + + + FileMode — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

FileMode

+
+
+class esmpy.api.constants.FileMode(value, names=None, module=None, type=None, start=1)
+

Specify which mode to use when writing a weight file.

+
+
+BASIC = <FileMode.BASIC: 0>
+

Indicates that only the factorList and factorIndexList should be written.

+
+ +
+
+WITHAUX = <FileMode.WITHAUX: 1>
+

Indicates that grid center coordinates and cell areas should also be written.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/GridItem.html b/docs/nightly/v8.8.0b03/html/GridItem.html new file mode 100644 index 00000000..c85c6ddb --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/GridItem.html @@ -0,0 +1,148 @@ + + + + + + + + GridItem — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

GridItem

+
+
+class esmpy.api.constants.GridItem(value, names=None, module=None, type=None, start=1)
+

The Grid can contain other kinds of data besides coordinates. This +data is referred to as Grid “items”. Some items may be used +for calculations involving the Grid.

+
+
+MASK = <GridItem.MASK: 0>
+

A grid item to represent a mask.

+
+ +
+
+AREA = <GridItem.AREA: 1>
+

A grid item to represent an area field for conservative regridding.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/LineType.html b/docs/nightly/v8.8.0b03/html/LineType.html new file mode 100644 index 00000000..4c837c92 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/LineType.html @@ -0,0 +1,160 @@ + + + + + + + + LineType — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

LineType

+
+
+class esmpy.api.constants.LineType(value, names=None, module=None, type=None, start=1)
+

This argument controls the path of the line which connects two points on +the surface of the sphere. This in turn controls the path along which +distances are calculated and the shape of the edges that make up a cell. +Both of these quantities can influence how interpolation weights are +calculated. As would be expected, this argument is only applicable with +grids which lie on the surface of a sphere.

+
+
+CART = <LineType.CART: 0>
+

Cartesian line. When this option is specified distances are calculated in a +straight line through the 3D Cartesian space in which the sphere is +embedded. Cells are approximated by 3D planes bounded by 3D Cartesian lines +between their corner vertices. When calculating regrid weights, this line +type is currently the default for the following all regrid methods except +for conservative.

+
+ +
+
+GREAT_CIRCLE = <LineType.GREAT_CIRCLE: 1>
+

Great circle line. When this option is specified distances are calculated +along a great circle path (the shortest distance between two points on a +sphere surface). Cells are bounded by great circle paths between their +corner vertices. When calculating regrid weights, this line type is +currently the default for the conservative regrid method.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/LogKind.html b/docs/nightly/v8.8.0b03/html/LogKind.html new file mode 100644 index 00000000..6d69101c --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/LogKind.html @@ -0,0 +1,146 @@ + + + + + + + + LogKind — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

LogKind

+
+
+class esmpy.api.constants.LogKind(value, names=None, module=None, type=None, start=1)
+

This flag is used to specify how much logging should be done.

+
+
+MULTI = <LogKind.MULTI: 2>
+

Use multiple log files – one per PET.

+
+ +
+
+NONE = <LogKind.NONE: 3>
+

Do not issue messages to a log file.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/MeshElemType.html b/docs/nightly/v8.8.0b03/html/MeshElemType.html new file mode 100644 index 00000000..8579845b --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/MeshElemType.html @@ -0,0 +1,164 @@ + + + + + + + + MeshElemType — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

MeshElemType

+
+
+class esmpy.api.constants.MeshElemType(value, names=None, module=None, type=None, start=1)
+

A Mesh can be constructed from a combination of different elements. +The type of elements that can be used in a Mesh depends on the +parametric dimension of the Mesh, which is set during Mesh +creation. The following are the valid Mesh element types for each +valid Mesh parametric dimension (2D or 3D).

+
+
+TRI = <MeshElemType.TRI: 3>
+

2D triangular elements with 3 sides.

+
+ +
+
+QUAD = <MeshElemType.QUAD: 4>
+

2D quadrilateral elements with 4 sides.

+
+ +
+
+TETRA = <MeshElemType.TETRA: 10>
+

3D tetrahedral elements with 4 faces.

+
+ +
+
+HEX = <MeshElemType.HEX: 12>
+

3D hexahedral elements with 6 faces.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/MeshLoc.html b/docs/nightly/v8.8.0b03/html/MeshLoc.html new file mode 100644 index 00000000..77dd7d60 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/MeshLoc.html @@ -0,0 +1,146 @@ + + + + + + + + MeshLoc — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

MeshLoc

+
+
+class esmpy.api.constants.MeshLoc(value, names=None, module=None, type=None, start=1)
+

The Mesh location used to hold Field data.

+
+
+NODE = <MeshLoc.NODE: 0>
+

The nodes of the Mesh.

+
+ +
+
+ELEMENT = <MeshLoc.ELEMENT: 1>
+

The elements of the Mesh.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/NormType.html b/docs/nightly/v8.8.0b03/html/NormType.html new file mode 100644 index 00000000..bd9105a2 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/NormType.html @@ -0,0 +1,154 @@ + + + + + + + + NormType — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

NormType

+
+
+class esmpy.api.constants.NormType(value, names=None, module=None, type=None, start=1)
+

When doing conservative regridding, this option allows the user +to select the type of normalization used when producing the weights.

+
+
+DSTAREA = <NormType.DSTAREA: 0>
+

Destination area normalization. Here the weights are calculated by dividing +the area of overlap of the source and destination cells by the area of the +entire destination cell. In other words, the weight is the fraction of the +entire destination cell which overlaps with the given source cell.

+
+ +
+
+FRACAREA = <NormType.FRACAREA: 1>
+

Fraction area normalization. Here in addition to the weight calculation +done for destination area normalization the weights are also divided by the +fraction that the destination cell overlaps with the entire source grid. In +other words, the weight is the fraction of just the part of the destination +cell that overlaps with the entire source mesh.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/PoleKind.html b/docs/nightly/v8.8.0b03/html/PoleKind.html new file mode 100644 index 00000000..27e32283 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/PoleKind.html @@ -0,0 +1,155 @@ + + + + + + + + PoleKind — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

PoleKind

+
+
+class esmpy.api.constants.PoleKind(value, names=None, module=None, type=None, start=1)
+

This type describes the type of connection that occurs at the pole of a +Grid.

+
+
+NONE = <PoleKind.NONE: 0>
+

No connection at pole.

+
+ +
+
+MONOPOLE = <PoleKind.MONOPOLE: 1>
+

This edge is connected to itself. Given that the edge is n elements long, +then element i is connected to element i+n/2.

+
+ +
+
+BIPOLE = <PoleKind.BIPOLE: 2>
+

This edge is connected to itself. Given that the edge is n elements long, element i is connected to element n-i-1.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/PoleMethod.html b/docs/nightly/v8.8.0b03/html/PoleMethod.html new file mode 100644 index 00000000..aa3865a8 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/PoleMethod.html @@ -0,0 +1,177 @@ + + + + + + + + PoleMethod — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

PoleMethod

+
+
+class esmpy.api.constants.PoleMethod(value, names=None, module=None, type=None, start=1)
+

Indicates which type of artificial pole to construct on the source +Grid for regridding.

+
+
+NONE = <PoleMethod.NONE: 0>
+

No pole. Destination points which lie above the top or below the bottom row +of the source Grid won’t be mapped.

+
+ +
+
+ALLAVG = <PoleMethod.ALLAVG: 1>
+

Construct an artificial pole placed in the center of the top (or bottom) +row of nodes, but projected onto the sphere formed by the rest of the grid. +The value at this pole is the average of all the source values surrounding +the pole.

+
+ +
+
+NPNTAVG = <PoleMethod.NPNTAVG: 2>
+

Construct an artificial pole placed in the center of the top (or bottom) +row of nodes, but projected onto the sphere formed by the rest of the grid. +The value at this pole is the average of the N source nodes next to the pole +and surrounding the destination point (i.e. the value may differ for each +destination point). Here N is set by using the regridPoleNPnts parameter +and ranges from 1 to the number of nodes around the pole. This option is +useful for interpolating values which may be zeroed out by averaging around +the entire pole (e.g. vector components).

+
+ +
+
+TEETH = <PoleMethod.TEETH: 3>
+

No new pole point is constructed, instead the holes at the poles are filled +by constructing triangles across the top and bottom row of the source Grid. +This can be useful because no averaging occurs, however, because the top and +bottom of the sphere are now flat, for a big enough mismatch between the +size of the destination and source pole holes, some destination points may +still not be able to be mapped to the source Grid.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/Region.html b/docs/nightly/v8.8.0b03/html/Region.html new file mode 100644 index 00000000..39a8763c --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/Region.html @@ -0,0 +1,156 @@ + + + + + + + + Region — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

Region

+
+
+class esmpy.api.constants.Region(value, names=None, module=None, type=None, start=1)
+

Specify various regions in the data layout of a Field object.

+
+
+TOTAL = <Region.TOTAL: 0>
+

An operation applies to every element in the selected domain.

+
+ +
+
+SELECT = <Region.SELECT: 1>
+

An operation applies to a select portion of the domain. One use of this is +to specify that the portions of a Field that are not mapped in a regridding +operation should retain their original value (as opposed to being +initialized to 0).

+
+ +
+
+EMPTY = <Region.EMPTY: 2>
+

An operation does not apply any element in the domain.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/RegridMethod.html b/docs/nightly/v8.8.0b03/html/RegridMethod.html new file mode 100644 index 00000000..0647c6ea --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/RegridMethod.html @@ -0,0 +1,215 @@ + + + + + + + + RegridMethod — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

RegridMethod

+
+
+class esmpy.api.constants.RegridMethod(value, names=None, module=None, type=None, start=1)
+

Specify which interpolation method to use during regridding.

+
+
+BILINEAR = <RegridMethod.BILINEAR: 0>
+

Bilinear interpolation. Destination value is a linear combination of the +source values in the cell which contains the destination point. The +weights for the linear combination are based on the distance of destination +point from each source value.

+
+ +
+
+PATCH = <RegridMethod.PATCH: 1>
+

Higher-order patch recovery interpolation. Destination value is a weighted +average of 2D polynomial patches constructed from cells surrounding the +source cell which contains the destination point. This method typically +results in better approximations to values and derivatives than bilinear. +However, because of its larger stencil, it also results in a much larger +interpolation matrix (and thus routeHandle) than the bilinear.

+
+ +
+
+CONSERVE = <RegridMethod.CONSERVE: 2>
+

First-order conservative interpolation. The main purpose of this method is +to preserve the integral of the field across the interpolation from source +to destination. In this method the value across each source cell is treated +as a constant, so it will typically have a larger interpolation error than +the bilinear or patch methods. The value of a destination cell +is calculated as the weighted sum of the values of the source cells that it +overlaps. The weights are determined by the amount the source cell overlaps +the destination cell. This method requires corner coordinate values to be +provided in the Grid. It currently only works for +Fields <esmpy.api.field.Field>`s created on the +:class:`~esmpy.api.grid.Grid center stagger or +the Mesh element location.

+
+ +
+
+NEAREST_STOD = <RegridMethod.NEAREST_STOD: 3>
+

In this version of nearest neighbor interpolation each destination point is +mapped to the closest source point. A given source point may go to multiple +destination points, but no destination point will receive input from more +than one source point.

+
+ +
+
+NEAREST_DTOS = <RegridMethod.NEAREST_DTOS: 4>
+

In this version of nearest neighbor interpolation each source point is +mapped to the closest destination point. A given destination point may +receive input from multiple source points, but no source point will go to +more than one destination point.

+
+ +
+
+CONSERVE_2ND = <RegridMethod.CONSERVE_2ND: 5>
+

Second-order conservative interpolation. This method’s main purpose is to +preserve the integral of the field across the interpolation from source to +destination. The difference between the first and second-order conservative +methods is that the second-order takes the source gradient into account, so +it yields a smoother destination field that typically better matches the +source field. This difference between the first and second-order methods is +particularly apparent when going from a coarse source grid to a finer +destination grid. Another difference is that the second-order method does +not guarantee that after regridding the range of values in the destination +field is within the range of values in the source field. For example, if the +mininum value in the source field is 0.0, then it’s possible that after +regridding with the second-order method, the destination field will contain +values less than 0.0. This method requires corner coordinate values to be +provided in the Grid. It currently only works for +Fields <esmpy.api.field.Field>`s created on the +:class:`~esmpy.api.grid.Grid center stagger or +the Mesh element location.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/StaggerLoc.html b/docs/nightly/v8.8.0b03/html/StaggerLoc.html new file mode 100644 index 00000000..150d959a --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/StaggerLoc.html @@ -0,0 +1,219 @@ + + + + + + + + StaggerLoc — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

StaggerLoc

+
+
+class esmpy.api.constants.StaggerLoc(value, names=None, module=None, type=None, start=1)
+

In the Grid class, data can be located at different positions in a +Grid cell. When setting or retrieving coordinate data the stagger +location is specified to tell the Grid method from where in the +cell to get the data.

+
+
+CENTER = <StaggerLoc.CENTER: 0>
+

2D: Cell centered stagger location.

+
+ +
+
+EDGE1 = <StaggerLoc.EDGE1: 1>
+

2D: First dimension edge stagger location.

+
+ +
+
+EDGE2 = <StaggerLoc.EDGE2: 2>
+

2D: Second dimension edge stagger location.

+
+ +
+
+CORNER = <StaggerLoc.CORNER: 3>
+

2D: Cell corner stagger location.

+
+ +
+
+CENTER_VCENTER = <StaggerLoc.CENTER: 0>
+

3D: Vertically centered stagger location.

+
+ +
+
+EDGE1_VCENTER = <StaggerLoc.EDGE1: 1>
+

3D: Vertically centered first dimension edge stagger location.

+
+ +
+
+EDGE2_VCENTER = <StaggerLoc.EDGE2: 2>
+

3D: Vertically centered second dimension edge stagger location.

+
+ +
+
+CORNER_VCENTER = <StaggerLoc.CORNER: 3>
+

3D: Vertically centered corner stagger location.

+
+ +
+
+CENTER_VFACE = <StaggerLoc.CENTER_VFACE: 4>
+

3D: Centered stagger location of the top and bottom cell faces.

+
+ +
+
+EDGE1_VFACE = <StaggerLoc.EDGE1_VFACE: 5>
+

3D: First dimension edge stagger location of the top and bottom cell faces.

+
+ +
+
+EDGE2_VFACE = <StaggerLoc.EDGE2_VFACE: 6>
+

3D: Second dimension edge stagger location of the top and bottom cell faces.

+
+ +
+
+CORNER_VFACE = <StaggerLoc.CORNER_VFACE: 7>
+

3D: Corner stagger location of the top and bottom cell faces.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/TypeKind.html b/docs/nightly/v8.8.0b03/html/TypeKind.html new file mode 100644 index 00000000..8349324e --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/TypeKind.html @@ -0,0 +1,161 @@ + + + + + + + + TypeKind — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

TypeKind

+
+
+class esmpy.api.constants.TypeKind(value, names=None, module=None, type=None, start=1)
+

This is used to indicate the type and kind of ESMPy types to the +underlying ESMF library routines.

+
+
+I4 = <TypeKind.I4: 3>
+

A four byte integer, equivalent to numpy.int32.

+
+ +
+
+I8 = <TypeKind.I8: 4>
+

An eight byte integer, equivalent to numpy.int64.

+
+ +
+
+R4 = <TypeKind.R4: 5>
+

A four byte real, equivalent to numpy.float32.

+
+ +
+
+R8 = <TypeKind.R8: 6>
+

An eight byte real, equivalent to numpy.float64.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/UnmappedAction.html b/docs/nightly/v8.8.0b03/html/UnmappedAction.html new file mode 100644 index 00000000..7ae3602d --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/UnmappedAction.html @@ -0,0 +1,136 @@ + + + + + + + + UnmappedAction — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + +
+
+
+
+ +
+

UnmappedAction

+
+
+class esmpy.api.constants.UnmappedAction(value, names=None, module=None, type=None, start=1)
+

This is used to indicate what action to take with respect to unmapped destination +points and the entries of the sparse matrix that correspond to +these points.

+
+
+ERROR = <UnmappedAction.ERROR: 0>
+

Unmapped points result in an error code return.

+
+ +
+
+IGNORE = <UnmappedAction.IGNORE: 1>
+

Unmapped points are ignored.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/CoordSys.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/CoordSys.rst.txt new file mode 100644 index 00000000..c60b52ca --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/CoordSys.rst.txt @@ -0,0 +1,7 @@ +~~~~~~~~ +CoordSys +~~~~~~~~ + +.. autoclass:: esmpy.api.constants.CoordSys + :members: + :exclude-members: __new__ diff --git a/docs/nightly/v8.8.0b03/html/_sources/ExtrapMethod.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/ExtrapMethod.rst.txt new file mode 100644 index 00000000..203eb2e6 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/ExtrapMethod.rst.txt @@ -0,0 +1,7 @@ +~~~~~~~~~~~~ +ExtrapMethod +~~~~~~~~~~~~ + +.. autoclass:: esmpy.api.constants.ExtrapMethod + :members: + :exclude-members: __new__ diff --git a/docs/nightly/v8.8.0b03/html/_sources/FileFormat.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/FileFormat.rst.txt new file mode 100644 index 00000000..0d7c5864 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/FileFormat.rst.txt @@ -0,0 +1,7 @@ +~~~~~~~~~~ +FileFormat +~~~~~~~~~~ + +.. autoclass:: esmpy.api.constants.FileFormat + :members: + :exclude-members: __new__ diff --git a/docs/nightly/v8.8.0b03/html/_sources/FileMode.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/FileMode.rst.txt new file mode 100644 index 00000000..1d2ec75a --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/FileMode.rst.txt @@ -0,0 +1,7 @@ +~~~~~~~~ +FileMode +~~~~~~~~ + +.. autoclass:: esmpy.api.constants.FileMode + :members: + :exclude-members: __new__ diff --git a/docs/nightly/v8.8.0b03/html/_sources/GridItem.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/GridItem.rst.txt new file mode 100644 index 00000000..dcb838c5 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/GridItem.rst.txt @@ -0,0 +1,7 @@ +~~~~~~~~ +GridItem +~~~~~~~~ + +.. autoclass:: esmpy.api.constants.GridItem + :members: + :exclude-members: __new__ \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/LineType.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/LineType.rst.txt new file mode 100644 index 00000000..11cd6845 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/LineType.rst.txt @@ -0,0 +1,7 @@ +~~~~~~~~ +LineType +~~~~~~~~ + +.. autoclass:: esmpy.api.constants.LineType + :members: + :exclude-members: __new__ \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/LogKind.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/LogKind.rst.txt new file mode 100644 index 00000000..721ef175 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/LogKind.rst.txt @@ -0,0 +1,7 @@ +~~~~~~~ +LogKind +~~~~~~~ + +.. autoclass:: esmpy.api.constants.LogKind + :members: + :exclude-members: __new__ \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/MeshElemType.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/MeshElemType.rst.txt new file mode 100644 index 00000000..34357fe1 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/MeshElemType.rst.txt @@ -0,0 +1,7 @@ +~~~~~~~~~~~~ +MeshElemType +~~~~~~~~~~~~ + +.. autoclass:: esmpy.api.constants.MeshElemType + :members: + :exclude-members: __new__ \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/MeshLoc.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/MeshLoc.rst.txt new file mode 100644 index 00000000..888c3672 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/MeshLoc.rst.txt @@ -0,0 +1,7 @@ +~~~~~~~ +MeshLoc +~~~~~~~ + +.. autoclass:: esmpy.api.constants.MeshLoc + :members: + :exclude-members: __new__ \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/NormType.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/NormType.rst.txt new file mode 100644 index 00000000..d4b6cbaa --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/NormType.rst.txt @@ -0,0 +1,7 @@ +~~~~~~~~ +NormType +~~~~~~~~ + +.. autoclass:: esmpy.api.constants.NormType + :members: + :exclude-members: __new__ \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/PoleKind.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/PoleKind.rst.txt new file mode 100644 index 00000000..590cc25d --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/PoleKind.rst.txt @@ -0,0 +1,7 @@ +~~~~~~~~ +PoleKind +~~~~~~~~ + +.. autoclass:: esmpy.api.constants.PoleKind + :members: + :exclude-members: __new__ \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/PoleMethod.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/PoleMethod.rst.txt new file mode 100644 index 00000000..6d59b56e --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/PoleMethod.rst.txt @@ -0,0 +1,7 @@ +~~~~~~~~~~ +PoleMethod +~~~~~~~~~~ + +.. autoclass:: esmpy.api.constants.PoleMethod + :members: + :exclude-members: __new__ \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/Region.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/Region.rst.txt new file mode 100644 index 00000000..b905f434 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/Region.rst.txt @@ -0,0 +1,7 @@ +~~~~~~ +Region +~~~~~~ + +.. autoclass:: esmpy.api.constants.Region + :members: + :exclude-members: __new__ \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/RegridMethod.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/RegridMethod.rst.txt new file mode 100644 index 00000000..fc2e5027 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/RegridMethod.rst.txt @@ -0,0 +1,7 @@ +~~~~~~~~~~~~ +RegridMethod +~~~~~~~~~~~~ + +.. autoclass:: esmpy.api.constants.RegridMethod + :members: + :exclude-members: __new__ \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/StaggerLoc.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/StaggerLoc.rst.txt new file mode 100644 index 00000000..7eac7ae4 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/StaggerLoc.rst.txt @@ -0,0 +1,7 @@ +~~~~~~~~~~ +StaggerLoc +~~~~~~~~~~ + +.. autoclass:: esmpy.api.constants.StaggerLoc + :members: + :exclude-members: __new__ \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/TypeKind.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/TypeKind.rst.txt new file mode 100644 index 00000000..378973d3 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/TypeKind.rst.txt @@ -0,0 +1,7 @@ +~~~~~~~~ +TypeKind +~~~~~~~~ + +.. autoclass:: esmpy.api.constants.TypeKind + :members: + :exclude-members: __new__ \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/UnmappedAction.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/UnmappedAction.rst.txt new file mode 100644 index 00000000..c09ffaf6 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/UnmappedAction.rst.txt @@ -0,0 +1,7 @@ +~~~~~~~~~~~~~~ +UnmappedAction +~~~~~~~~~~~~~~ + +.. autoclass:: esmpy.api.constants.UnmappedAction + :members: + :exclude-members: __new__ \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/api.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/api.rst.txt new file mode 100644 index 00000000..d10194e6 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/api.rst.txt @@ -0,0 +1,954 @@ +========== +API +========== + +------- +Classes +------- + +ESMPy uses a :class:`~esmpy.api.field.Field` object to represent data variables +built on an underlying spatial discretization, which is represented by a +:class:`~esmpy.api.grid.Grid`, :class:`~esmpy.api.mesh.Mesh` or +:class:`~esmpy.api.locstream.LocStream`. +Regridding between :class:`Fields ` is accomplished with the +:class:`~esmpy.api.regrid.Regrid` class. All of these classes are explained in +more detail in the sections provided by the links in the following table. + +========================================= ============================================================================== +Class Description +========================================= ============================================================================== +:class:`~esmpy.api.esmpymanager.Manager` A manager class to initialize and finalize ESMF +:class:`~esmpy.api.field.Field` A data field built on a :class:`~esmpy.api.grid.Grid`, :class:`~esmpy.api.mesh.Mesh`, or :class:`~esmpy.api.locstream.LocStream` +:class:`~esmpy.api.grid.Grid` A class to represent a logically rectangular grid +:class:`~esmpy.api.mesh.Mesh` A class to represent an unstructured grid +:class:`~esmpy.api.locstream.LocStream` A class to represent observational data as a collection of disconnected points +:class:`~esmpy.api.regrid.Regrid` The regridding utility +:class:`~esmpy.api.regrid.RegridFromFile` The from file regridding utility +========================================= ============================================================================== + + +--------------- +Named Constants +--------------- + +ESMPy follows the ESMF convention of using "named constants" to represent the +available options for parameters that expect a variety of specific inputs. The +following table lists the available named constants and provides links to pages +that further explain the available values. + +============================================================ ============================== +Named constants Description +============================================================ ============================== +:class:`CoordSys` Specify the coordinate system of a :class:`~esmpy.api.grid.Grid` +:class:`ExtrapMethod` Specify the extrapolation method +:class:`FileFormat` Specify the format of a data file +:class:`FileMode` Specify the mode of a data file +:class:`GridItem` Specify a mask or area item on a :class:`~esmpy.api.grid.Grid` +:class:`LineType` Specify the type of line that connects two points on a sphere +:class:`LogKind` Specify how much logging should be done +:class:`MeshElemType` Specify the type of the :class:`~esmpy.api.mesh.Mesh` elements +:class:`MeshLoc` Specify a nodal or elemental :class:`~esmpy.api.mesh.Mesh` +:class:`NormType` Specify the type of normalization to use for conservative regridding weights +:class:`PoleKind` Specify the type of connection that appears at the poles of the :class:`~esmpy.api.grid.Grid` +:class:`PoleMethod` Specify which type of artificial pole to construct on the source :class:`~esmpy.api.grid.Grid` for regridding +:class:`Region` Specify various regions in the data layout of +:class:`RegridMethod` Specify which interpolation method to use regridding +:class:`StaggerLoc` Specify the position for data in a :class:`~esmpy.api.grid.Grid` cell +:class:`TypeKind` Specify the type and kind of data +:class:`UnmappedAction` Specify which action to take with respect to unmapped destination points +============================================================ ============================== + +------- +Manager +------- + +The :class:`~esmpy.api.esmpymanager.Manager` is used by ESMPy to simplify a +number of low-level calls used by the underlying ESMF framework to allocate +resources, enable logging, and control garbage collection. + +~~~~~~~~~~~~~~~~~~~ +Resource Allocation +~~~~~~~~~~~~~~~~~~~ + +The ESMF Virtual Machine (VM) +is created at the beginning of each ESMPy execution, and contains information +about the topology and characteristics of the underlying computer. The VM +allocates computational resources in the form of +**Persistent Execution Threads**, or **PETs**. These are equivalent to operating +system threads with a lifetime of at least that of the ESMPy execution. In the +simplest, and most common case, a PET is equivalent to an MPI process. The +number of PETs and the current PET can be queried from the +:class:`~esmpy.api.esmpymanager.Manager`: + +.. code:: + + mg = esmpy.Manager() + pet_count = mg.pet_count() + local_pet = mg.local_pet() + +Refer to the VM Class of the +`ESMF Reference Manual `_ +for more information. + +~~~~~~~ +Logging +~~~~~~~ + +The :class:`~esmpy.api.esmpymanager.Manager` is also used to enable logging: + +.. code:: + + mg = esmpy.Manager(debug=True) + local_pet = mg.local_pet + +The output will be logged in files named PET.ESMF_LogFile. + +~~~~~~~~~~~~~~~~~ +Memory management +~~~~~~~~~~~~~~~~~ + +The underlying ESMF framework needs to be initialized and finalized once and +only once per execution. This is handled internally by the +:class:`~esmpy.api.esmpymanager.Manager` and **does not** require any explicit +user intervention. However, the ESMF garbage collection feature is not triggered +until the finalization routine is invoked, which may not happen until the +:class:`~esmpy.api.esmpymanager.Manager` goes out of scope at the end of the +program execution. + +If memory deallocation of ESMPy +objects is required *prior* to the end of the program, the class level +``destroy`` routines should be invoked: + +.. code:: + + mg = esmpy.Manager() + + mg.destroy() + +This is commonly required when reusing a :class:`~esmpy.api.regrid.Regrid` object +to interpolate data between many :class:`~esmpy.api.field.Field` pairs. + +~~~~~~~~~~~~~~~~~ +MOAB Mesh backend +~~~~~~~~~~~~~~~~~ + +The Manager can be used to enable the `MOAB `_ +mesh backend to the Mesh. + +.. code:: + + mg.set_moab(moab_on=True) + +The MOAB mesh is an alternative to the native ESMF mesh, and does not yet have +full support. + +------------------------------ +Spatial Discretization Objects +------------------------------ + +There are three different objects used for spatial coordinate representation: +:class:`~esmpy.api.grid.Grid`, :class:`~esmpy.api.mesh.Mesh`, and :class:`~esmpy.api.locstream.LocStream`. :class:`Grids ` are used to represent logically rectangular +grids, :class:`Meshes ` are used for unstructured collections of polygons, and +:class:`LocStreams ` are used for unstructured collections of individual points. These +objects are nearly identical counterparts to the objects of the same name in +ESMF, with some simplifications for ease of use in the Python environment. + +~~~~ +Grid +~~~~ + +The :class:`~esmpy.api.grid.Grid` is used to represent the geometry and discretization of logically +rectangular physical grids. The :class:`~esmpy.api.grid.Grid` can also hold information that can used in +calculations involving the :class:`~esmpy.api.grid.Grid`, like a mask or the cell areas. Refer to the Grid Class of the +`ESMF Reference Manual `_ for more information. + +++++++++++ +Staggering +++++++++++ + +Staggering is a finite difference technique in which the values of different +physical quantities are placed at different locations within a grid cell. + +The ESMF :class:`~esmpy.api.grid.Grid` class supports a variety of stagger locations, including cell +centers, corners, and edge centers. The default stagger location in ESMF is the +cell center, and cell counts in :class:`~esmpy.api.grid.Grid` are based on this assumption. Combinations +of the 2D ESMF stagger locations are sufficient to specify any of the Arakawa +staggers. ESMF also supports staggering in 3D and higher dimensions. There are +shortcuts for standard staggers, and interfaces through which users can create +custom staggers. + +As a default the ESMF :class:`~esmpy.api.grid.Grid` class provides symmetric staggering, so that cell +centers are enclosed by cell perimeter (e.g. corner) stagger locations. This +means the coordinate arrays for stagger locations other than the center will +have an additional element of padding in order to enclose the cell center +locations. However, to achieve other types of staggering, the user may alter or +eliminate this padding by using the appropriate options when adding coordinates +to a :class:`~esmpy.api.grid.Grid`. + +:class:`~esmpy.api.grid.Grid` staggers are indicated using +:class:`StaggerLoc`. + +.. code:: + + grid = esmpy.Grid(np.array([3,4]), staggerloc=esmpy.StaggerLoc.CENTER) + ++++++++++++++++++++++ +Spherical Coordinates ++++++++++++++++++++++ + +In the case that the :class:`~esmpy.api.grid.Grid` is on a sphere (coord_sys = :class:`esmpy.api.constants.CoordSys.SPH_DEG` or +:class:`esmpy.api.constants.CoordSys.SPH_RAD`) then the coordinates given in the :class:`~esmpy.api.grid.Grid` are interpreted +as latitude and longitude values. The coordinates can either be in degrees or +radians as indicated by the ``coord_sys`` flag set during :class:`~esmpy.api.grid.Grid` creation. As is +true with many global models, this application currently assumes the latitude +and longitude refer to positions on a perfect sphere. + +The :class:`~esmpy.api.grid.Grid` coordinate system is represented using +:class:`CoordSys`. + +.. code:: + + grid = esmpy.Grid(np.array([3,4]), staggerloc=esmpy.StaggerLoc.CENTER, + coord_sys=esmpy.CoordSys.SPH_DEG) + ++++++++++++ +Periodicity ++++++++++++ + +A periodic connection can be specified when building :class:`Grids ` in spherical +coordinates. The ``num_peri_dims`` parameter indicates the total number of +periodic dimensions and ``periodic_dim`` is used to identify which dimensions +should be considered periodic. There must always be at least one non-periodic +dimension. For example, to create a global latitude-longitude :class:`~esmpy.api.grid.Grid` there would +be one periodic dimension, dimension 0 (longitude). + +.. code:: + + grid = esmpy.Grid(np.array([3,4]), staggerloc=esmpy.StaggerLoc.CENTER, + coord_sys=esmpy.CoordSys.SPH_DEG, + num_peri_dims=1, periodic_dim=0) + ++++++++++++++++ +Pole Generation ++++++++++++++++ + +The :class:`~esmpy.api.grid.Grid` can generate an artificial pole by using the ``pole_dim`` parameter. This +can be helpful for regridding operations to smooth out the interpolated values +in the polar region. For the example of creating a global latitude-longitude +:class:`~esmpy.api.grid.Grid`, the pole dimension would be 1 (latitude). + +.. code:: + + grid = esmpy.Grid(np.array([3,4]), staggerloc=esmpy.StaggerLoc.CENTER, + coord_sys=esmpy.CoordSys.SPH_DEG, + num_peri_dims=1, periodic_dim=0, pole_dim=1) + ++++++++ +Masking ++++++++ + +Masking is the process used to mark parts of a :class:`~esmpy.api.grid.Grid` to be ignored during an +operation. Marking :class:`~esmpy.api.grid.Grid` cells as masked can affect the :class:`~esmpy.api.field.Field` values that are +represented by those cells. Masking is specified by assigning an integer value +to a :class:`~esmpy.api.grid.Grid` cell. This allows many different masks to be defined on the same :class:`~esmpy.api.grid.Grid`, +any combination of which may be also activated on the :class:`~esmpy.api.field.Field` by specifying the +corresponding integer values. The activation of :class:`~esmpy.api.field.Field` masks with respect to the +underlying :class:`~esmpy.api.grid.Grid` mask is handled by :class:`~esmpy.api.regrid.Regrid`, and a more +general discussion of masking is covered in the :ref:`masking ` +section. + +.. code:: + + In [1]: import numpy as np + ...: import esmpy + ...: grid = esmpy.Grid(np.array([3,4]), staggerloc=esmpy.StaggerLoc.CENTER, + ...: coord_sys=esmpy.CoordSys.SPH_DEG, + ...: num_peri_dims=1, periodic_dim=0, pole_dim=1) + ...: + ...: mask = grid.add_item(esmpy.GridItem.MASK, staggerloc=esmpy.StaggerLoc.CENTER) + ...: mask + ...: + Out[1]: + array([[1, 1, 1, 1], + [1, 1, 1, 1], + [1, 1, 1, 1]], dtype=int32) + +++++++++++ +Cell Areas +++++++++++ + +:class:`~esmpy.api.grid.Grid` cell areas can be calculated by ESMPy. Space must first be allocated for +this calculation by adding an +:class:`~esmpy.api.constants.GridItem.AREA` item to the :class:`~esmpy.api.grid.Grid`. +Then a :class:`~esmpy.api.field.Field` must be created, and the +:class:`~esmpy.api.field.Field.get_area()` function called. + +.. Note:: The :class:`~esmpy.api.grid.Grid` area calculation assumes the :class:`~esmpy.api.grid.Grid` is a unit sphere. + +:class:`~esmpy.api.grid.Grid` cell areas may also be set to user-defined values +after the :class:`~esmpy.api.constants.GridItem.AREA` item has +been allocated and retrieved using :class:`~esmpy.api.grid.Grid.get_item()`. + +.. code:: + + In [1]: grid = esmpy.Grid(np.array([3,4]), staggerloc=[esmpy.StaggerLoc.CENTER, esmpy.StaggerLoc.CORNER], + ...: coord_sys=esmpy.CoordSys.SPH_DEG, + ...: num_peri_dims=1, periodic_dim=0, pole_dim=1) + ...: + ...: + ...: gridLon = grid.get_coords(0) + ...: gridLat = grid.get_coords(1) + ...: gridLonCorner = grid.get_coords(0, staggerloc=esmpy.StaggerLoc.CORNER) + ...: gridLatCorner = grid.get_coords(1, staggerloc=esmpy.StaggerLoc.CORNER) + ...: + ...: lon = np.linspace(-120,120,3) + ...: lat = np.linspace(-67.5, 67.5,4) + ...: lon_corner = np.arange(-180,180,120) + ...: lat_corner = np.linspace(-90, 90, 5) + ...: + ...: lonm, latm = np.meshgrid(lon, lat, indexing='ij') + ...: lonm_corner, latm_corner = np.meshgrid(lon_corner, lat_corner, indexing='ij') + ...: + ...: gridLon[:] = lonm + ...: gridLat[:] = latm + ...: gridLonCorner[:] = lonm_corner + ...: gridLatCorner[:] = latm_corner + ...: + ...: field = esmpy.Field(grid) + ...: field.get_area() + ...: field.data + ...: + Out[1]: + array([[ 0.32224085, 1.02707409, 1.02707409, 0.32224085], + [ 0.32224085, 1.02707409, 1.02707409, 0.32224085], + [ 0.32224085, 1.02707409, 1.02707409, 0.32224085]]) + +~~~~ +Mesh +~~~~ + +A :class:`~esmpy.api.mesh.Mesh` is an object for representing unstructured grids. +Refer to the Mesh Class of the +`ESMF Reference Manual `_ +for more information. + +A :class:`~esmpy.api.mesh.Mesh` is constructed of *nodes* and *elements*. A node, also known as a vertex +or corner, is a part of a :class:`~esmpy.api.mesh.Mesh` which represents a single point. An element, +also known as a cell, is a part of a :class:`~esmpy.api.mesh.Mesh` which represents a small +region of space. Elements are described in terms of a connected set of nodes +which represent locations along their boundaries. + +:class:`~esmpy.api.field.Field` data may be located on either the nodes or elements of a :class:`~esmpy.api.mesh.Mesh`. :class:`Fields ` +created on a :class:`~esmpy.api.mesh.Mesh` can also be used as either the source or destination or both +of a regridding operation. + +The dimension of a :class:`~esmpy.api.mesh.Mesh` in ESMF is specified with two parameters: the +*parametric* dimension and the *spatial* dimension. + +The parametric dimension of a :class:`~esmpy.api.mesh.Mesh` is the dimension of the topology of the :class:`~esmpy.api.mesh.Mesh`. +This can be thought of as the dimension of the elements which make up the :class:`~esmpy.api.mesh.Mesh`. +For example, a :class:`~esmpy.api.mesh.Mesh` composed of triangles would have a parametric dimension of +2, and a :class:`~esmpy.api.mesh.Mesh` composed of tetrahedra would have a parametric dimension of 3. + +The spatial dimension of a :class:`~esmpy.api.mesh.Mesh` is the dimension of the space in which the :class:`~esmpy.api.mesh.Mesh` +is embedded. In other words, it is the number of coordinate dimensions needed to +describe the location of the nodes making up the :class:`~esmpy.api.mesh.Mesh`. + +For example, a :class:`~esmpy.api.mesh.Mesh` constructed of squares on a plane would have a parametric +dimension of 2 and a spatial dimension of 2. If that same :class:`~esmpy.api.mesh.Mesh` were used to +represent the 2D surface of a sphere, then the :class:`~esmpy.api.mesh.Mesh` would still have a +parametric dimension of 2, but now its spatial dimension would be 3. + +Only :class:`Meshes ` whose number of coordinate dimensions (spatial dimension) is 2 or 3 +are supported. The dimension of the elements in a :class:`~esmpy.api.mesh.Mesh` (parametric dimension) must +be less than or equal to the spatial dimension, but also must be either 2 or 3. +This means that a :class:`~esmpy.api.mesh.Mesh` may be either 2D elements in 2D space, 3D elements in 3D +space, or a manifold constructed of 2D elements embedded in 3D space. + +For a parametric dimension of 2, the native supported element types are +triangles and quadrilaterals. In addition to these, ESMF supports 2D polygons +with any number of sides. Internally these are represented as sets of triangles, +but to the user should behave like any other element. For a parametric dimension +of 3, the supported element types are tetrahedrons and hexahedrons. The :class:`~esmpy.api.mesh.Mesh` +supports any combination of element types within a particular dimension, but +types from different dimensions may not be mixed. For example, a :class:`~esmpy.api.mesh.Mesh` cannot be +constructed of both quadrilaterals and tetrahedra. + ++++++++++++++ +Mesh Creation ++++++++++++++ + +To create a :class:`~esmpy.api.mesh.Mesh` we need to set some properties of the :class:`~esmpy.api.mesh.Mesh` as a whole, some +properties of each node in the :class:`~esmpy.api.mesh.Mesh` and then some properties of each element +which connects the nodes. + +For the :class:`~esmpy.api.mesh.Mesh` as a whole we set its parametric dimension and spatial dimension. +A :class:`Mesh's ` parametric dimension can be thought of as the dimension of the elements +which make up the :class:`~esmpy.api.mesh.Mesh`. A :class:`Mesh's ` spatial dimension, on the other hand, is the +number of coordinate dimensions needed to describe the location of the nodes +making up the :class:`~esmpy.api.mesh.Mesh`. + +The structure of the per node and element information used to create a :class:`~esmpy.api.mesh.Mesh` is +influenced by the :class:`~esmpy.api.mesh.Mesh` distribution strategy. The :class:`~esmpy.api.mesh.Mesh` class is distributed by +elements. This means that a node must be present on any PET that contains +an element associated with that node, but not on any other PET (a node +can't be on a PET without an element "home"). Since a node may be used by +two or more elements located on different PETs, a node may be duplicated +on multiple PETs. When a node is duplicated in this manner, one and only +one of the PETs that contain the node must "own" the node. The user sets +this ownership when they define the nodes during :class:`~esmpy.api.mesh.Mesh` +creation. When a :class:`~esmpy.api.field.Field` is created on a +:class:`~esmpy.api.mesh.Mesh` (i.e. on the :class:`~esmpy.api.mesh.Mesh` nodes), +on each PET the :class:`~esmpy.api.field.Field` is only +created on the nodes which are owned by that PET. This means that the size +of the :class:`~esmpy.api.field.Field` memory on the PET can be smaller than the +number of nodes used to create the :class:`~esmpy.api.mesh.Mesh` on that PET. + +Three properties need to be defined for each :class:`~esmpy.api.mesh.Mesh` node: the global id of the node +(``node_ids``), node coordinates (``node_coords``), and which PET owns the node +(``node_owners``). The node id is a unique (across all PETs) integer attached +to the particular node. It is used to indicate which nodes are the same when +connecting together pieces of the :class:`~esmpy.api.mesh.Mesh` on different PETs. The node +coordinates indicate the location of a node in space and are used in the :class:`~esmpy.api.regrid.Regrid` +functionality when interpolating. The node owner indicates which PET is in +charge of the node. This is used when creating a :class:`~esmpy.api.field.Field` on the :class:`~esmpy.api.mesh.Mesh` to indicate +which PET should contain a :class:`~esmpy.api.field.Field` location for the data. + +Three properties need to be defined for each :class:`~esmpy.api.mesh.Mesh` element: the global id of the +element (``element_ids``), the topology type of the element (``element_types``), and +which nodes are connected together to form the element (``element_conn``). The +element id is a unique (across all PETs) integer attached to the +particular element. The element type describes the topology of the element +(e.g. a triangle vs. a quadrilateral). The range of choices for the topology of +the elements in a :class:`~esmpy.api.mesh.Mesh` are restricted by the :class:`Mesh's ` parametric dimension (e.g. a +:class:`~esmpy.api.mesh.Mesh` can't contain a 2D element like a triangle, when its parametric dimension +is 3D), but it can contain any combination of elements appropriate to its +dimension. In particular, in 2D ESMF supports two native element types triangle +and quadrilateral, but also provides support for polygons with any number of +sides. These polygons are represented internally as sets of triangles, but to +the user should behave like other elements. To specify a polygon with more than +four sides, the element type should be set to the number of corners of the +polygon (e.g. element type=6 for a hexagon). The element connectivity indicates +which nodes are to be connected together to form the element. The number of +nodes connected together for each element is implied by the elements topology +type (``element_types``). It is IMPORTANT to note, that the entries in this list are +NOT the global ids of the nodes, but are indices into the PET local lists +of node info used in the :class:`~esmpy.api.mesh.Mesh` creation. In other words, the element connectivity +isn't specified in terms of the global list of nodes, but instead is specified +in terms of the locally described node info. One other important point about +connectivities is that the order of the nodes in the connectivity list of an +element is important. In general, when specifying an element with parametric +dimension 2, the nodes should be given in counterclockwise order around the +element. + +The three step :class:`~esmpy.api.mesh.Mesh` creation process starts with a call to the :class:`~esmpy.api.mesh.Mesh` constructor. +It is then followed by the :class:`~esmpy.api.mesh.Mesh.add_nodes()` call to +specify nodes, and then the :class:`~esmpy.api.mesh.Mesh.add_elements()` call to +specify elements. + +.. code:: + + # 2.5 8 10 --------11 + # / \ / | + # 2.1 7 9 12 + # | | 5 / + # | 4 | / + # | | / + # 1.0 4 ------- 5 ------- 6 + # | | \ 3 | + # | 1 | \ | + # | | 2 \ | + # -0.1 1 ------- 2 ------- 3 + # + # -0.1 1.0 2.1 2.5 + # + # Node Ids at corners + # Element Ids in centers + + # Two parametric dimensions, and two spatial dimensions + mesh = esmpy.Mesh(parametric_dim=2, spatial_dim=2, coord_sys=coord_sys) + + num_node = 12 + num_elem = 5 + nodeId = np.array([1,2,3,4,5,6,7,8,9,10,11,12]) + nodeCoord = np.array([-0.1,-0.1, #node id 1 + 1.0,-0.1, #node id 2 + 2.1,-0.1, #node id 3 + 0.1, 1.0, #node id 4 + 1.0, 1.0, #node id 5 + 2.1, 1.0, #node id 6 + 0.1, 2.1, #node id 7 + 0.5, 2.5, #node id 8 + 1.0, 2.1, #node id 9 + 1.5, 2.5, #node id 10 + 2.5, 2.5, #node id 11 + 2.5, 2.1]) #node id 12 + + + nodeOwner = np.zeros(num_node) + + elemId = np.array([1,2,3,4,5]) + elemType=np.array([esmpy.MeshElemType.QUAD, + esmpy.MeshElemType.TRI, + esmpy.MeshElemType.TRI, 5, 6]) + + elemConn=np.array([0,1,4,3, # elem id 1 + 1,2,4, # elem id 2 + 2,5,4, # elem id 3 + 3,4,8,7,6, # elem id 4 + 4,5,11,10,9,8]) # elem id 5 + + mesh.add_nodes(num_node,nodeId,nodeCoord,nodeOwner) + + mesh.add_elements(num_elem,elemId,elemType,elemConn) + ++++++++ +Masking ++++++++ + +There are two types of masking available in :class:`~esmpy.api.mesh.Mesh`: node masking and element +masking. These both work in a similar manner, but vary slightly in the details +of setting the mask information during :class:`~esmpy.api.mesh.Mesh` creation. + +For node masking, the mask information is set using the ``node_mask`` parameter. +When a :class:`~esmpy.api.regrid.Regrid` object is created the mask values arguments ``src_mask_values`` and +``dst_mask_values`` can then be used to indicate which particular values set in +the ``node_mask`` array indicate that the node should be masked. For example, if +``dst_mask_values`` has been set to 1, then any node in the destination :class:`~esmpy.api.mesh.Mesh` whose +corresponding ``node_mask`` value is 1 will be masked out (a node with any other +value than 1 will not be masked). + +For element masking, the mask information is set using the ``element_mask`` +parameter when adding elements to the :class:`~esmpy.api.mesh.Mesh`. In a similar manner to node masking, +the mask values parameters to :class:`~esmpy.api.regrid.Regrid`, ``src_mask_values`` and ``dst_mask_values`` +can then be used to indicate which particular values set in the ``element_mask`` +array indicate that the element should be masked. For example, if +``dst_mask_values`` has been set to 1, then any element in the destination :class:`~esmpy.api.mesh.Mesh` +whose corresponding ``element_mask`` value is 1 will be masked out (an element +with any other value than 1 will not be masked). + ++++++ +Areas ++++++ + +:class:`~esmpy.api.mesh.Mesh` cell areas can be specified using the ``element_areas`` parameter to +:class:`~esmpy.api.mesh.Mesh.add_elements()`. + +If cell areas are not specified by the user they can be calculated by ESMPy +using :class:`~esmpy.api.field.Field.get_area()`. + + +~~~~~~~~~ +LocStream +~~~~~~~~~ + +A :class:`~esmpy.api.locstream.LocStream` can be used to represent the locations of a set of +data points. For example, in the data assimilation world, :class:`LocStreams ` can be used +to represent a set of observations. The values of the data points are stored +within a :class:`~esmpy.api.field.Field` created using the :class:`~esmpy.api.locstream.LocStream`. +Refer to the LocStream Class of the +`ESMF Reference Manual `_ +for more information. + +The locations are generally described using Cartesian (x, y, z), or +(lat, lon, radius) coordinates. The coordinates are stored using constructs +called *keys*. A key is essentially a list of point descriptors, one for each data +point. They may hold other information besides the coordinates - a mask, for +example. They may also hold a second set of coordinates. Keys are referenced by +name. Each key must contain the same number of elements as there are data points +in the :class:`~esmpy.api.locstream.LocStream`. While there is no assumption in the ordering of the points, +the order chosen must be maintained in each of the keys. + +A :class:`~esmpy.api.locstream.LocStream` can be very large. Data assimilation systems might use :class:`LocStreams ` +with up to :math:`10^8` observations, so efficiency is critical. :class:`LocStreams ` can be +created from file. + +A :class:`~esmpy.api.locstream.LocStream` is similar to a :class:`~esmpy.api.mesh.Mesh` in that both are collections of irregularly +positioned points. However, the two structures differ because a :class:`~esmpy.api.mesh.Mesh` also has +connectivity: each data point represents either a center or corner of a cell. +There is no requirement that the points in a :class:`~esmpy.api.locstream.LocStream` have connectivity, in +fact there is no requirement that any two points have any particular spatial +relationship at all. + +.. code:: + + locstream = esmpy.LocStream(16, coord_sys=coord_sys) + + deg_rad = pi + if coord_sys == esmpy.CoordSys.SPH_DEG: + deg_rad = 180 + + locstream["ESMF:Lon"] = [0.0, 0.5*deg_rad, 1.5*deg_rad, 2*deg_rad, 0.0, 0.5*deg_rad, 1.5*deg_rad, 2*deg_rad, 0.0, 0.5*deg_rad, 1.5*deg_rad, 2*deg_rad, 0.0, 0.5*deg_rad, 1.5*deg_rad, 2*deg_rad] + locstream["ESMF:Lat"] = [deg_rad/-2.0, deg_rad/-2.0, deg_rad/-2.0, deg_rad/-2.0, -0.25*deg_rad, -0.25*deg_rad, -0.25*deg_rad, -0.25*deg_rad, 0.25*deg_rad, 0.25*deg_rad, 0.25*deg_rad, 0.25*deg_rad, deg_rad/2.0, deg_rad/2.0, deg_rad/2.0, deg_rad/2.0] + if domask: + locstream["ESMF:Mask"] = np.array([1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], dtype=np.int32) + + +------------------------------- +Create a Grid or Mesh from File +------------------------------- + +~~~~~~~~~~~~ +File Formats +~~~~~~~~~~~~ + +ESMPy can create :class:`~esmpy.api.grid.Grid` or :class:`~esmpy.api.mesh.Mesh` objects from NetCDF files in a variety +of formats. A :class:`~esmpy.api.mesh.Mesh` can be created from files in :class:`~esmpy.api.constants.FileFormat.SCRIP`, :class:`~esmpy.api.constants.FileFormat.ESMFMESH`, and :class:`~esmpy.api.constants.FileFormat.UGRID` +formats. :class:`~esmpy.api.grid.Grid` files can be in :class:`~esmpy.api.constants.FileFormat.SCRIP` and :class:`~esmpy.api.constants.FileFormat.GRIDSPEC` format. + ++++++ +SCRIP ++++++ +.. _scrip: + +This file format is used by the :class:`~esmpy.api.constants.FileFormat.SCRIP` :cite:`ref:SCRIP`, package, grid files that +work with that package should also work here. :class:`~esmpy.api.constants.FileFormat.SCRIP` format files are +capable of storing either 2D logically rectangular grids or 2D +unstructured grids. More information can be found in the +`ESMF Reference Manual `_. + +++++++++ +ESMFMESH +++++++++ +.. _esmfmesh: + +ESMF has a custom unstructured grid file format for describing :class:`Meshes `. +This format is more compatible than the :class:`~esmpy.api.constants.FileFormat.SCRIP` format with the methods +used to create a :class:`~esmpy.api.mesh.Mesh` object, so less conversion needs to be done to +create a :class:`~esmpy.api.mesh.Mesh`. The :class:`~esmpy.api.constants.FileFormat.ESMFMESH` format is thus more efficient than :class:`~esmpy.api.constants.FileFormat.SCRIP` when +used with ESMPy. More information can be found in the +`ESMF Reference Manual `_. + +++++++++ +GRIDSPEC +++++++++ +.. _gridspec: + +:class:`~esmpy.api.constants.FileFormat.GRIDSPEC` is an extension to the Climate and Forecast (CF) metadata +conventions for the representation of gridded data for Earth System +Models. ESMPy supports NetCDF files that follow the CF :class:`~esmpy.api.constants.FileFormat.GRIDSPEC` +convention to support logically rectangular lat/lon grids. More +information can be found in the +`ESMF Reference Manual `_. + ++++++ +UGRID ++++++ +.. _ugrid: + +:class:`~esmpy.api.constants.FileFormat.UGRID` is an extension to the CF metadata +conventions for the unstructured grid data model. ESMPy support +NetCDF files that follow the CF :class:`~esmpy.api.constants.FileFormat.UGRID` convention for unstructured grids. +More information can be found in the +`ESMF Reference Manual `_. + +~~~~~~~~~~~~~~~~ +Meshes from File +~~~~~~~~~~~~~~~~ + +When creating a :class:`~esmpy.api.mesh.Mesh` from a :class:`~esmpy.api.constants.FileFormat.SCRIP` format file, there are a number of +options to control the output :class:`~esmpy.api.mesh.Mesh`. The data is located at the center +of the grid cell in a :class:`~esmpy.api.constants.FileFormat.SCRIP` grid. Therefore, when the :class:`~esmpy.api.mesh.Mesh` will be +part of a conservative regridding operation, the ``convert_to_dual`` +flag must be set to True to properly generate coordinates at the the +cell corners. + +A :class:`~esmpy.api.mesh.Mesh` may also be created with boolean flags to specify whether or not to +add an area property to the :class:`~esmpy.api.mesh.Mesh` ``add_user_area``, or to add a mask +``add_mask`` held by the NetCDF variable indicated in the optional argument, +``varname``. These argument are only valid for :class:`~esmpy.api.constants.FileFormat.UGRID` formatted files. +The mask generated for a :class:`~esmpy.api.mesh.Mesh` created from file will +have 0 for the masked values and 1 for the unmasked values. + +~~~~~~~~~~~~~~~ +Grids from File +~~~~~~~~~~~~~~~ + +A number of optional boolean arguments are also supported to create a +structured :class:`~esmpy.api.grid.Grid` from a file. These include ``is_sphere`` to indicate whether +the grid is spherical or regional, ``add_corner_stagger`` to add the corner +stagger information to the :class:`~esmpy.api.grid.Grid` for conservative regridding, and +``add_user_area`` to specify whether to read in the cell area from the +NetCDF file or to calculate them. + +For :class:`~esmpy.api.constants.FileFormat.GRIDSPEC` formated files +there is the ``add_mask`` optional argument +to add a mask held by the NetCDF variable indicated in optional +argument, ``varname``, and the ``coord_names`` argument to specify the longitude +and latitude variable names in a :class:`~esmpy.api.constants.FileFormat.GRIDSPEC` file containing multiple sets of +coordinates. + +For :class:`~esmpy.api.constants.FileFormat.SCRIP` formated files the integer array ``grid_imask`` is used to mask out grid cells which should not participate in the regridding. + +The mask generated for a :class:`~esmpy.api.grid.Grid` created from +file (any format) will have 0 for the masked values and 1 for the unmasked values. + + +---------- +Regridding +---------- + +The following table describe the regridding methods and options that are +available in ESMPy, the flag that is required to use it and a short description. +More information can be found on these options in the +`ESMF Reference Manual `_. + + +======================================================= =============================================== +Class Description +======================================================= =============================================== +:class:`~esmpy.api.constants.RegridMethod.BILINEAR` Linear regridding in two dimensions +:class:`~esmpy.api.constants.RegridMethod.PATCH` Higher-order least squares method +:class:`~esmpy.api.constants.RegridMethod.NEAREST_STOD` Nearest source point used for each destination +:class:`~esmpy.api.constants.RegridMethod.NEAREST_DTOS` Nearest destination point used for each source +:class:`~esmpy.api.constants.RegridMethod.CONSERVE` First-order conservative +:class:`~esmpy.api.constants.RegridMethod.CONSERVE_2ND` Second-order conservative +:class:`~esmpy.api.constants.NormType` Normalization options for integral conservation +:class:`~esmpy.api.constants.LineType` Line types for spherical and Cartesian space +:class:`~esmpy.api.constants.UnmappedAction` Unmapped destination point handling options +:class:`~esmpy.api.constants.CoordSys` Spherical grids and pole handling +======================================================= =============================================== + +~~~~~~~~~~~~~~~~~~ +Great Circle Cells +~~~~~~~~~~~~~~~~~~ + +For Grids and Meshes on a sphere some combinations of interpolation options +(e.g. first and second-order conservative methods) use cells whose edges are +great circles. This section describes some behavior that the user may not expect +from these cells and some potential solutions. A great circle edge isn't +necessarily the same as a straight line in latitude longitude space. For small +edges, this difference will be small, but for long edges it could be +significant. This means if the user expects cell edges as straight lines in +latitude longitude space, they should avoid using one large cell with long edges +to compute an average over a region (e.g. over an ocean basin). + +Also, the user should also avoid using cells that contain one edge that runs +half way or more around the earth, because the regrid weight calculation assumes +the edge follows the shorter great circle path. There isn't a unique great +circle edge defined between points on the exact opposite side of the earth from +one another (antipodal points). However, the user can work around both of these +problem by breaking the long edge into two smaller edges by inserting an extra +node, or by breaking the large target grid cells into two or more smaller grid +cells. This allows the application to resolve the ambiguity in edge direction. + +------- +Masking +------- +.. _masking: + +Masking is the process whereby parts of a :class:`~esmpy.api.grid.Grid`, :class:`~esmpy.api.mesh.Mesh` or :class:`~esmpy.api.locstream.LocStream` can be marked to be ignored +during an operation, such as when they are used in regridding. Masking can be used on a :class:`~esmpy.api.field.Field` +created from a regridding source to indicate that certain portions should not be used to generate +regridded data. This is useful, for example, if a portion of the source contains unusable values. +Masking can also be used on a :class:`~esmpy.api.field.Field` created from a regridding destination to indicate that a certain +portion should not receive regridded data. This is useful, for example, when part of the destination +isn't being used (e.g. the land portion of an ocean grid). + +The user may mask out points in the source :class:`~esmpy.api.field.Field` or destination :class:`~esmpy.api.field.Field` or both. To do masking the user +sets mask information in the :class:`~esmpy.api.grid.Grid`, :class:`~esmpy.api.mesh.Mesh`, or :class:`~esmpy.api.locstream.LocStream` upon +which the :class:`Fields ` passed into the :class:`~esmpy.api.regrid.Regrid` call are built. The ``src_mask_values`` and +``dst_mask_values`` arguments to that call can then be used to specify which values in that mask information +indicate that a location should be masked out. For example, if ``dst_mask_values`` is set to [1,2], then any +location that has a value of 1 or 2 in the mask information of the :class:`~esmpy.api.grid.Grid`, :class:`~esmpy.api.mesh.Mesh` or :class:`~esmpy.api.locstream.LocStream` upon which +the destination :class:`~esmpy.api.field.Field` is built will be masked out. + +Masking behavior differs slightly between regridding methods. For non-conservative regridding methods +(e.g. bilinear or high-order patch), masking is done on points. For these methods, masking a destination +point means that the point will not participate in regridding. For these +methods, masking a source point means that the entire source cell using that point is masked out. +In other words, if any corner point making up a source cell is masked then the cell is masked. +For conservative regridding methods masking is done on cells. +Masking a destination cell means that the cell won't participate in regridding. +Similarly, masking a source cell means that the cell won't participate in regridding. +For any type of interpolation method (conservative or non-conservative) +the masking is set on the location upon which the +:class:`Fields ` passed into the regridding call are built. +For example, if :class:`Fields ` built on +:class:`StaggerLoc.CENTER ` are passed into +:class:`~esmpy.api.regrid.Regrid` +then the masking should also be set on :class:`StaggerLoc.CENTER `. + +The mask generated for a :class:`~esmpy.api.grid.Grid`, +:class:`~esmpy.api.mesh.Mesh` or :class:`~esmpy.api.locstream.LocStream` created +from file will have 0 for the masked values and 1 for the unmasked values. + +.. Note:: The :class:`Region.SELECT ` flag to the +``zero_region`` parameter of :class:`~esmpy.api.regrid.Regrid` can be used to +maintain :class:`Fields ` values on locations that do not +participate in the regridding operation. This is useful when setting an +uninitialized value to help identify masked locations within the +:class:`Fields ` data. + + +-------------------------- +Numpy Slicing and Indexing +-------------------------- + +Numpy arrays are used to represent :class:`~esmpy.api.grid.Grid`, :class:`~esmpy.api.mesh.Mesh` and :class:`~esmpy.api.locstream.LocStream` coordinates and :class:`~esmpy.api.field.Field` data, +among other things. Standard numpy conventions for array indexing +and slicing can be expected. There are some exceptions when it comes to fancy +indexing, index arrays, and multi-dimensional slicing. Significant effort has +been put into raising exceptions where inappropriate indexing or slicing +operations are attempted. + +It is very important to remember that all indexing +and slicing operations apply **ONLY** to the ESMPy level objects, and these operations +do not propagate down to the lower-level Fortran- and C-based representations +of the ESMF objects. One example of where this could come up is when passing +a :class:`~esmpy.api.field.Field` slice into regridding. The entire original :class:`~esmpy.api.field.Field` will still be run +through the ESMF regridding engine, and only the appropriate portion of +the :class:`~esmpy.api.field.Field` slice will be updated with the regridded values. + +~~~~~~~~~~~~~~~~~~ +Dimension Ordering +~~~~~~~~~~~~~~~~~~ + +.. Warning:: The underlying ESMF library is built with a mix of Fortran and C/C++ + and follows Fortran conventions with respect to array indexing and + dimension ordering. Some effort has been made to make ESMPy feel more + natural to the Python user where possible. This means that ESMPy uses + 0-based indexing, which is translated to the 1-based indexing used by + the ESMPy backend. The only exception to this is NetCDF files that are + generated by ESMPy will continue to use the 1-based indexing from the + underlying ESMF code. Likewise, the dimension ordering still follows + Fortran conventions. This means that longitude comes before latitude, which + also comes before temporal dimensions, when in use. + + .. code:: + + In [1]: import numpy as np + ...: import esmpy + ...: + ...: grid = esmpy.Grid(np.array([3,4]), staggerloc=esmpy.StaggerLoc.CENTER) + ...: + ...: gridLon = grid.get_coords(0) + ...: gridLat = grid.get_coords(1) + ...: + ...: lon = np.linspace(-120,120,3) + ...: lat = np.linspace(-67.5, 67.5,4) + ...: + ...: lonm, latm = np.meshgrid(lon, lat, indexing='ij') + ...: + ...: gridLon[:] = lonm + ...: gridLat[:] = latm + ...: + + In [2]: grid.coords[esmpy.StaggerLoc.CENTER][0].shape + Out[2]: (3, 4) + + In [3]: lon.shape + Out[3]: (3,) + + In [4]: lat.shape + Out[4]: (4,) + + In [5]: grid.coords[esmpy.StaggerLoc.CENTER][0] + Out[5]: + array([[-120., -120., -120., -120.], + [ 0., 0., 0., 0.], + [ 120., 120., 120., 120.]]) + + In [6]: grid.coords[esmpy.StaggerLoc.CENTER][1] + Out[6]: + array([[-67.5, -22.5, 22.5, 67.5], + [-67.5, -22.5, 22.5, 67.5], + [-67.5, -22.5, 22.5, 67.5]]) + + In [7]: field = esmpy.Field(grid, ndbounds=[10]) # create a Field with a time dimension + + In [8]: field.data.shape + Out[8]: (3, 4, 10) + + +------------------ +Parallel Execution +------------------ + +ESMPy is a thin wrapper on top of ESMF, which was designed for high performance +and scalable computing. The ESMF virtual machine is used to manage the available +resources of the execution environment in a layer that is transparent to the +ESMPy user. This allows the full power of the high performance computing +environment to be utilized by the ESMPy user with little use of specialized +parallel programming techniques. + +ESMPy objects will be distributed across the available computing resources with +no additional parameters required. The :class:`~esmpy.api.grid.Grid`, :class:`~esmpy.api.mesh.Mesh`, :class:`~esmpy.api.locstream.LocStream`, and :class:`~esmpy.api.field.Field` classes +will all be transparently "parallelized" with no need for user calls to a +message passing interface. Likewise, the :class:`~esmpy.api.regrid.Regrid` class will compute and apply +the interpolation weights using all available computing resources with no need +for user intervention. + +However, it is useful to remember that resulting :class:`~esmpy.api.field.Field` values will only be +accessible on certain PETs. The mpi4py package may be necessary for post +processing tasks that require access to global :class:`~esmpy.api.field.Field` values. + +~~~~~~~~~~~~~~~~~~~~ +mpirun vs. MPI.Spawn +~~~~~~~~~~~~~~~~~~~~ + +There are a few different options for using ESMPy in a parallel +environment. Using mpirun to specify the desired number of computing cores +is probably the easiest way to start a parallel ESMPy job. Another option is to +call the MPI.Spawn() function from the mpi4py Python package from within a +serial Python script or interpreter. It has been observed that MPI.Spawn() may +not work properly when mpi4py is built with an underlying mpich +library, openmpi has seen better success. A third option is to call mpirun +using a system call from within a serial Python script or interpreter, however +this method is not highly recommended. + +The following two examples demonstrate how to execute an ESMPy script in +parallel. Any of the scripts found in the examples directory of the ESMPy source +code can be run in parallel using mpirun as well as in serial mode. + +++++++ +mpirun +++++++ + +:: + + mpirun -n 4 python hello_world.py + ++++++++++ +MPI.Spawn ++++++++++ + +:: + + import sys + from mpi4py import MPI + + # Parent + if len(sys.argv) == 1: + + # Spawn workers + comm = MPI.COMM_WORLD.Spawn( + sys.executable, + args=[sys.argv[0], 'worker'], + maxprocs=4) + + # Shutdown + comm.Disconnect() + + # Worker + elif sys.argv[1] == 'worker': + + # Connect to parent + try: + comm = MPI.Comm.Get_parent() + rank = comm.Get_rank() + except: + raise ValueError('Could not connect to parent - ' + usage) + + # worker code goes here, regridding etc.. + print "Hello World from PET #"+str(rank) + + # Shutdown + comm.Disconnect() + + # Catch + else: + raise ValueError('Program should be started without arguments') + +A more detailed example of using MPI.Spawn() can be found in the Tutorials section +of the documentation. diff --git a/docs/nightly/v8.8.0b03/html/_sources/appendix.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/appendix.rst.txt new file mode 100644 index 00000000..604b74e1 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/appendix.rst.txt @@ -0,0 +1,49 @@ + +========== +Appendices +========== + +---------- +Class APIs +---------- + +.. toctree:: + + manager + field + grid + mesh + locstream + regrid + regridfromfile + +--------------- +Named Constants +--------------- + +.. toctree:: + + CoordSys + ExtrapMethod + FileFormat + FileMode + GridItem + LineType + LogKind + MeshElemType + MeshLoc + NormType + PoleKind + PoleMethod + Region + RegridMethod + StaggerLoc + TypeKind + UnmappedAction + +---------- +References +---------- + +.. bibliography:: ../../../Infrastructure/Mesh/doc/Mesh.bib ../../../doc/ESMF_packages.bib ../../../Infrastructure/Regrid/doc/Regrid.bib + :style: unsrt diff --git a/docs/nightly/v8.8.0b03/html/_sources/examples.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/examples.rst.txt new file mode 100644 index 00000000..06e8c522 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/examples.rst.txt @@ -0,0 +1,139 @@ +========= +Tutorials +========= + +----------- +Hello World +----------- + + .. literalinclude:: ../examples/hello_world.py + +--------------------------- +Regridding Helper Functions +--------------------------- + +The following code snippets demonstrate how to build all of the pieces +necessary to regrid data between :class:`Fields ` built on +:class:`Grids `, :class:`Meshes ` +and :class:`LocStreams `. + +~~~~~~~~~~~~~~~~ +LocStream Create +~~~~~~~~~~~~~~~~ + +.. literalinclude:: ../src/esmpy/util/locstream_utilities.py + :pyobject: create_locstream_spherical_16 + +~~~~~~~~~~~~~~~~~~~~~~~~~ +LocStream Create Parallel +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. literalinclude:: ../src/esmpy/util/locstream_utilities.py + :pyobject: create_locstream_spherical_16_parallel + +~~~~~~~~~~~~~~~~ +Create a 2D Grid +~~~~~~~~~~~~~~~~ + + .. literalinclude:: ../src/esmpy/util/grid_utilities.py + :pyobject: grid_create_from_coordinates + +~~~~~~~~~~~~~~~~ +Create a 3D Grid +~~~~~~~~~~~~~~~~ + + .. literalinclude:: ../src/esmpy/util/grid_utilities.py + :pyobject: grid_create_from_coordinates_3d + +~~~~~~~~~~~~~~~~~~~~~~ +Create a Periodic Grid +~~~~~~~~~~~~~~~~~~~~~~ + + .. literalinclude:: ../src/esmpy/util/grid_utilities.py + :pyobject: grid_create_from_coordinates_periodic + +~~~~~~~~~~~~~~~~~~~~~~~ +Create a 5 Element Mesh +~~~~~~~~~~~~~~~~~~~~~~~ + + .. literalinclude:: ../src/esmpy/util/mesh_utilities.py + :pyobject: mesh_create_5 + +~~~~~~~~~~~~~~ +Create a Field +~~~~~~~~~~~~~~ + + .. literalinclude:: ../src/esmpy/test/test_api/test_field.py + :pyobject: TestField.create_field + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Initialize an Analytic Field +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + .. literalinclude:: ../src/esmpy/util/grid_utilities.py + :pyobject: initialize_field_grid_periodic + + +~~~~~~~~~~~~~~~~~~~~ +Run ESMPy Regridding +~~~~~~~~~~~~~~~~~~~~ + + .. literalinclude:: ../src/esmpy/test/test_api/test_regrid.py + :pyobject: TestRegrid.run_regridding + + +~~~~~~~~~~~~~~~~~~ +Compute Field Mass +~~~~~~~~~~~~~~~~~~ + + .. literalinclude:: ../src/esmpy/util/grid_utilities.py + :pyobject: compute_mass_grid + + +---------- +Regridding +---------- + +The following stand alone scripts demonstrate how to use regridding between +:class:`Fields ` built on +:class:`Grids `, :class:`Meshes ` +and :class:`LocStreams `. These scripts +can be run in serial or parallel with no modification. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Grid, Mesh and Field Created from File +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + .. literalinclude:: ../examples/regrid_from_file.py + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Read and Write a Weight File +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + .. literalinclude:: ../examples/read_write_weight_file.py + +~~~~~~~~~~~~~~~~~ +Grid to LocStream +~~~~~~~~~~~~~~~~~ + + .. literalinclude:: ../examples/grid_locstream_regrid.py + +~~~~~~~~~~~~~~~~~ +Mesh to LocStream +~~~~~~~~~~~~~~~~~ + + .. literalinclude:: ../examples/mesh_locstream_regrid.py + +~~~~~~~~~~~~~~~~~ +LocStream to Grid +~~~~~~~~~~~~~~~~~ + + .. literalinclude:: ../examples/locstream_grid_regrid.py + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Using MPI.Spawn() from a Serial Python Driver +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + .. literalinclude:: ../examples/mpi_spawn_regrid.py + diff --git a/docs/nightly/v8.8.0b03/html/_sources/field.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/field.rst.txt new file mode 100644 index 00000000..f1644ce1 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/field.rst.txt @@ -0,0 +1,9 @@ +~~~~~ +Field +~~~~~ + +.. autoclass:: esmpy.api.field.Field + :members: copy, destroy, get_area, read, + data, grid, lower_bounds, name, ndbounds, rank, staggerloc, type, + upper_bounds, xd + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/grid.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/grid.rst.txt new file mode 100644 index 00000000..e3995924 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/grid.rst.txt @@ -0,0 +1,9 @@ +~~~~ +Grid +~~~~ + +.. autoclass:: esmpy.api.grid.Grid + :members: add_coords, add_item, copy, destroy, get_coords, get_item, + area, areatype, coords, coord_sys, has_corners, + lower_bounds, mask, max_index, num_peri_dims, periodic_dim, pole_dim, + rank, size, staggerloc, type, upper_bounds \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/index.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/index.rst.txt new file mode 100644 index 00000000..b7b2805e --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/index.rst.txt @@ -0,0 +1,24 @@ +.. ESMPy documentation master file, created by + sphinx-quickstart on Tue Dec 6 12:05:22 2011. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +================= +Table of Contents +================= + +Welcome to ESMPy - The ESMF Python Interface! + +.. toctree:: + :maxdepth: 3 + + intro + install + examples + api + appendix + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/docs/nightly/v8.8.0b03/html/_sources/install.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/install.rst.txt new file mode 100644 index 00000000..96df08d5 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/install.rst.txt @@ -0,0 +1,162 @@ +============ +Installation +============ + +------------ +Requirements +------------ + +The following packages are *required* to work with ESMPy: + +* `ESMF installation `_ +* `python `_, minimum version 3.7 +* `numpy `_ + +The following packages are *optional*: + +* ESMF installation with NetCDF - required to create :class:`Grids `, :class:`Meshes ` and :class:`Fields ` from file, and to write regridding weights to file + - NetCDF must be built as a shared library for ESMPy installation to succeed +* ESMF installation with PIO (the Parallel IO library) - required to create :class:`Meshes ` and :class:`Fields ` from file, and to write regridding weights to file +* `mpi4py `_- python bindings to MPI, needed to run some of the parallel regridding examples +* `pytest `_ - for testing + +---------------- +Getting the code +---------------- + +The ESMPy source code can be downloaded from the +`ESMF git repository `_. + +The `ESMF User's Guide `_ +contains information on building and installing esmpy. + +The `ESMF Reference Manual `_ +contains information on the architecture of ESMF, example code, and details of the API (Application Programming +Interface). + +~~~~~~~~~~~~~~~~~ +Anaconda Packages +~~~~~~~~~~~~~~~~~ + +ESMPy conda packages are available through the conda-forge channel: + +.. code:: + + conda create -n esmpy -c conda-forge esmpy + +Specific versions of the conda package can be installed like this: + +.. code:: + + conda create -n esmpy -c conda-forge esmpy=8.1.0 + +Development versions can be found in the ``esmpy_dev`` channel: + +.. code:: + + conda create -n esmpy -c conda-forge -c esmpy_dev esmpy + +---------------------------- +Installing ESMPy from Source +---------------------------- + +When installing from source, ESMPy uses `pip `_ +to build and install the package. An installation of ESMPy in the default location for Python packages can be done +with the following command issued from the top level ESMPy directory (``src/addon/esmpy``): + +.. code:: + + python3 -m pip install . + +Please contact esmf_support@ucar.edu with any questions. + +.. Note:: + + With some python versions, there is a problem with the automatic installation of the required package ``setuptools-git-versioning``. If the output from the ``pip install`` command ends with ``Successfully installed esmpy-0.0.0``, this indicates that the ``setuptools-git-versioning`` package was not invoked and the build thinks you are using ESMF version 0.0.0. This will cause problems when you try to use ESMPy. To solve this problem, simply rerun the above installation command (``python3 -m pip install .``). You should then see a reasonable version number at the end, such as, ``Successfully installed esmpy-8.4.0``. + +--------------- +Importing ESMPy +--------------- + +To use ESMPy in an external program, import it with: + +.. code:: + + import esmpy + +The environment variable ``ESMFMKFILE`` should be set when using ESMPy. If it is not found, the package will +try to guess a few very common locations, but we recommend correctly setting the variable nonetheless. + +.. Note:: + + The Python module name for ESMPy was changed in v8.4.0 from "ESMF" to "esmpy". If you are using a version older than v8.4.0, the import command is ``import ESMF``. See the `ESMF Release Notes `_ for more details and links to previous versions of the ESMPy documentation. + +---------- +Validation +---------- + +The ESMPy testing is done with the pytest package, both in serial and +parallel. Basic unit tests can be run with the following command, from +the top level ESMPy directory (``src/addon/esmpy``): + +.. code:: + + python3 -m pytest + +There are a few other pytest targets available for a wider range of testing if +greater test coverage is desired: + +.. code:: + + make test_unit + + make test_examples + + make test_unit_parallel + + make test_examples_parallel + + make test_regrid_from_file + +.. Note:: + + The ``regrid_from_file`` and ``example`` tests can take up a lot of memory + and bandwidth. The ``download_regrid_from_file`` and ``download_examples`` + commands will simply download the test files without actually running them + (allowing the stress on the machine to be applied to bandwidth first, and + then memory). + +.. Note:: + + By default, test data will be downloaded to a ``data`` subdirectory of the ESMPy installation directory. This location can be changed by setting one of the following environment variables: + + - If ``ESMPY_DATA_DIR`` is set, this should point to a directory that has already been populated with the necessary data; the pre-existing data will be read from this directory and no automatic downloads will be attempted. + + - Otherwise, if ``ESMPY_DATA_NEW_DIR`` is set, data will be downloaded to the path set by this variable instead of using the ``data`` subdirectory of the ESMPy installation directory. + +----------- +Limitations +----------- + +ESMPy doesn't include many aspects of ESMF, including components, field bundles, +time management, etc. The limitations listed here are relative +to ESMF offline and integrated regridding capabilities. + +- ESMPy cannot use an ESMF installation that is built with external LAPACK + support. +- Coordinates cannot be retrieved from the elements of a + :class:`~esmpy.api.mesh.Mesh`. This can affect the ability to set + :class:`~esmpy.api.field.Field` values on a source :class:`~esmpy.api.mesh.Mesh` + created from file when using conservative regridding. +- Multi-tile :class:`~esmpy.api.grid.Grid` support is limited to cubed-sphere + grids created on 6 processors. A cubed-sphere grid can be created on any + number of processors, but only when it is created on 6 processors will the + coordinates be retrievable for the entire object. A + :class:`~esmpy.api.field.Field` created from a cubed-sphere + :class:`~esmpy.api.grid.Grid` cannot be written to file in parallel. +- There is no ``FieldBundle`` class, only single :class:`Fields `. + +Testing related: + +- Nightly regression testing is limited to a small subset of the ESMF test platforms, + including Darwin and Linux running gfortran with openMPI. diff --git a/docs/nightly/v8.8.0b03/html/_sources/intro.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/intro.rst.txt new file mode 100644 index 00000000..ce4ee2b2 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/intro.rst.txt @@ -0,0 +1,30 @@ +-------- +Overview +-------- + +.. automodule:: esmpy + +--------------- +Important Links +--------------- + +The `ESMPy home page `_ has the +latest information on the ESMPy project including release notes, known +bugs, supported platforms, and download information. + +Please see the `ESMF home page `_ +for more information on ESMF in general. + +The `ESMF Regridding webpage +`_ +gives a nice overview of the ESMF regridding functionality, including an +overview of the functionality that is available through +various interfaces to ESMF regridding. + +The ESMF_RegridWeightGen application is a command-line version of the functionality that is available through ESMPy. +The Regid class gives a thorough overview of the regridding engine that is used by ESMPy. +Information on these can be found in the +`ESMF Reference Manual +`_. + +Please contact esmf_support@ucar.edu with any questions or problems. diff --git a/docs/nightly/v8.8.0b03/html/_sources/locstream.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/locstream.rst.txt new file mode 100644 index 00000000..79a784a2 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/locstream.rst.txt @@ -0,0 +1,6 @@ +~~~~~~~~~ +LocStream +~~~~~~~~~ + +.. autoclass:: esmpy.api.locstream.LocStream + :members: copy, destroy, lower_bounds, name, rank, size, upper_bounds diff --git a/docs/nightly/v8.8.0b03/html/_sources/manager.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/manager.rst.txt new file mode 100644 index 00000000..5b3fa316 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/manager.rst.txt @@ -0,0 +1,6 @@ +~~~~~~~ +Manager +~~~~~~~ + +.. autoclass:: esmpy.api.esmpymanager.Manager + :members: local_pet, moab, pet_count, barrier, set_moab \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/mesh.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/mesh.rst.txt new file mode 100644 index 00000000..7c2b3839 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/mesh.rst.txt @@ -0,0 +1,7 @@ +~~~~ +Mesh +~~~~ + +.. autoclass:: esmpy.api.mesh.Mesh + :members: copy, destroy, add_elements, add_nodes, free_memory, get_coords, + area, coords, coord_sys, mask, rank, size, size_owned \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_sources/regrid.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/regrid.rst.txt new file mode 100644 index 00000000..f647deb5 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/regrid.rst.txt @@ -0,0 +1,6 @@ +~~~~~~ +Regrid +~~~~~~ + +.. autoclass:: esmpy.api.regrid.Regrid + :members: copy, destroy, __call__, get_factors, get_weights_dict diff --git a/docs/nightly/v8.8.0b03/html/_sources/regridfromfile.rst.txt b/docs/nightly/v8.8.0b03/html/_sources/regridfromfile.rst.txt new file mode 100644 index 00000000..ed5af263 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_sources/regridfromfile.rst.txt @@ -0,0 +1,6 @@ +~~~~~~~~~~~~~~ +RegridFromFile +~~~~~~~~~~~~~~ + +.. autoclass:: esmpy.api.regrid.RegridFromFile + :members: copy, destroy, __call__ diff --git a/docs/nightly/v8.8.0b03/html/_static/basic.css b/docs/nightly/v8.8.0b03/html/_static/basic.css new file mode 100644 index 00000000..cfc60b86 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_static/basic.css @@ -0,0 +1,921 @@ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +div.section::after { + display: block; + content: ''; + clear: left; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox form.search { + overflow: hidden; +} + +div.sphinxsidebar #searchbox input[type="text"] { + float: left; + width: 80%; + padding: 0.25em; + box-sizing: border-box; +} + +div.sphinxsidebar #searchbox input[type="submit"] { + float: left; + width: 20%; + border-left: none; + padding: 0.25em; + box-sizing: border-box; +} + + +img { + border: 0; + max-width: 100%; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li p.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; + margin-left: auto; + margin-right: auto; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable ul { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + +/* -- general body styles --------------------------------------------------- */ + +div.body { + min-width: 360px; + max-width: 800px; +} + +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + +a.headerlink { + visibility: hidden; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, figure.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, figure.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, figure.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +img.align-default, figure.align-default, .figure.align-default { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-default { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar, +aside.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px; + background-color: #ffe; + width: 40%; + float: right; + clear: right; + overflow-x: auto; +} + +p.sidebar-title { + font-weight: bold; +} + +nav.contents, +aside.topic, +div.admonition, div.topic, blockquote { + clear: left; +} + +/* -- topics ---------------------------------------------------------------- */ + +nav.contents, +aside.topic, +div.topic { + border: 1px solid #ccc; + padding: 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- content of sidebars/topics/admonitions -------------------------------- */ + +div.sidebar > :last-child, +aside.sidebar > :last-child, +nav.contents > :last-child, +aside.topic > :last-child, +div.topic > :last-child, +div.admonition > :last-child { + margin-bottom: 0; +} + +div.sidebar::after, +aside.sidebar::after, +nav.contents::after, +aside.topic::after, +div.topic::after, +div.admonition::after, +blockquote::after { + display: block; + content: ''; + clear: both; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + margin-top: 10px; + margin-bottom: 10px; + border: 0; + border-collapse: collapse; +} + +table.align-center { + margin-left: auto; + margin-right: auto; +} + +table.align-default { + margin-left: auto; + margin-right: auto; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +th > :first-child, +td > :first-child { + margin-top: 0px; +} + +th > :last-child, +td > :last-child { + margin-bottom: 0px; +} + +/* -- figures --------------------------------------------------------------- */ + +div.figure, figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption, figcaption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number, +figcaption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text, +figcaption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +/* -- hlist styles ---------------------------------------------------------- */ + +table.hlist { + margin: 1em 0; +} + +table.hlist td { + vertical-align: top; +} + +/* -- object description styles --------------------------------------------- */ + +.sig { + font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; +} + +.sig-name, code.descname { + background-color: transparent; + font-weight: bold; +} + +.sig-name { + font-size: 1.1em; +} + +code.descname { + font-size: 1.2em; +} + +.sig-prename, code.descclassname { + background-color: transparent; +} + +.optional { + font-size: 1.3em; +} + +.sig-paren { + font-size: larger; +} + +.sig-param.n { + font-style: italic; +} + +/* C++ specific styling */ + +.sig-inline.c-texpr, +.sig-inline.cpp-texpr { + font-family: unset; +} + +.sig.c .k, .sig.c .kt, +.sig.cpp .k, .sig.cpp .kt { + color: #0033B3; +} + +.sig.c .m, +.sig.cpp .m { + color: #1750EB; +} + +.sig.c .s, .sig.c .sc, +.sig.cpp .s, .sig.cpp .sc { + color: #067D17; +} + + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +:not(li) > ol > li:first-child > :first-child, +:not(li) > ul > li:first-child > :first-child { + margin-top: 0px; +} + +:not(li) > ol > li:last-child > :last-child, +:not(li) > ul > li:last-child > :last-child { + margin-bottom: 0px; +} + +ol.simple ol p, +ol.simple ul p, +ul.simple ol p, +ul.simple ul p { + margin-top: 0; +} + +ol.simple > li:not(:first-child) > p, +ul.simple > li:not(:first-child) > p { + margin-top: 0; +} + +ol.simple p, +ul.simple p { + margin-bottom: 0; +} + +aside.footnote > span, +div.citation > span { + float: left; +} +aside.footnote > span:last-of-type, +div.citation > span:last-of-type { + padding-right: 0.5em; +} +aside.footnote > p { + margin-left: 2em; +} +div.citation > p { + margin-left: 4em; +} +aside.footnote > p:last-of-type, +div.citation > p:last-of-type { + margin-bottom: 0em; +} +aside.footnote > p:last-of-type:after, +div.citation > p:last-of-type:after { + content: ""; + clear: both; +} + +dl.field-list { + display: grid; + grid-template-columns: fit-content(30%) auto; +} + +dl.field-list > dt { + font-weight: bold; + word-break: break-word; + padding-left: 0.5em; + padding-right: 5px; +} + +dl.field-list > dd { + padding-left: 0.5em; + margin-top: 0em; + margin-left: 0em; + margin-bottom: 0em; +} + +dl { + margin-bottom: 15px; +} + +dd > :first-child { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +.sig dd { + margin-top: 0px; + margin-bottom: 0px; +} + +.sig dl { + margin-top: 0px; + margin-bottom: 0px; +} + +dl > dd:last-child, +dl > dd:last-child > :last-child { + margin-bottom: 0; +} + +dt:target, span.highlighted { + background-color: #fbe54e; +} + +rect.highlighted { + fill: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +.classifier:before { + font-style: normal; + margin: 0 0.5em; + content: ":"; + display: inline-block; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +.translated { + background-color: rgba(207, 255, 207, 0.2) +} + +.untranslated { + background-color: rgba(255, 207, 207, 0.2) +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +pre, div[class*="highlight-"] { + clear: both; +} + +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; + white-space: nowrap; +} + +div[class*="highlight-"] { + margin: 1em 0; +} + +td.linenos pre { + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + display: block; +} + +table.highlighttable tbody { + display: block; +} + +table.highlighttable tr { + display: flex; +} + +table.highlighttable td { + margin: 0; + padding: 0; +} + +table.highlighttable td.linenos { + padding-right: 0.5em; +} + +table.highlighttable td.code { + flex: 1; + overflow: hidden; +} + +.highlight .hll { + display: block; +} + +div.highlight pre, +table.highlighttable pre { + margin: 0; +} + +div.code-block-caption + div { + margin-top: 0; +} + +div.code-block-caption { + margin-top: 1em; + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +table.highlighttable td.linenos, +span.linenos, +div.highlight span.gp { /* gp: Generic.Prompt */ + user-select: none; + -webkit-user-select: text; /* Safari fallback only */ + -webkit-user-select: none; /* Chrome/Safari */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* IE10+ */ +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + margin: 1em 0; +} + +code.xref, a code { + background-color: transparent; + font-weight: bold; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +span.eqno a.headerlink { + position: absolute; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_static/classic.css b/docs/nightly/v8.8.0b03/html/_static/classic.css new file mode 100644 index 00000000..d0ed3264 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_static/classic.css @@ -0,0 +1,269 @@ +/* + * classic.css_t + * ~~~~~~~~~~~~~ + * + * Sphinx stylesheet -- classic theme. + * + * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +@import url("basic.css"); + +/* -- page layout ----------------------------------------------------------- */ + +html { + /* CSS hack for macOS's scrollbar (see #1125) */ + background-color: #FFFFFF; +} + +body { + font-family: sans-serif; + font-size: 100%; + background-color: #11303d; + color: #000; + margin: 0; + padding: 0; +} + +div.document { + display: flex; + background-color: #1c4e63; +} + +div.documentwrapper { + float: left; + width: 100%; +} + +div.bodywrapper { + margin: 0 0 0 230px; +} + +div.body { + background-color: #ffffff; + color: #000000; + padding: 0 20px 30px 20px; +} + +div.footer { + color: #ffffff; + width: 100%; + padding: 9px 0 9px 0; + text-align: center; + font-size: 75%; +} + +div.footer a { + color: #ffffff; + text-decoration: underline; +} + +div.related { + background-color: #133f52; + line-height: 30px; + color: #ffffff; +} + +div.related a { + color: #ffffff; +} + +div.sphinxsidebar { +} + +div.sphinxsidebar h3 { + font-family: 'Trebuchet MS', sans-serif; + color: #ffffff; + font-size: 1.4em; + font-weight: normal; + margin: 0; + padding: 0; +} + +div.sphinxsidebar h3 a { + color: #ffffff; +} + +div.sphinxsidebar h4 { + font-family: 'Trebuchet MS', sans-serif; + color: #ffffff; + font-size: 1.3em; + font-weight: normal; + margin: 5px 0 0 0; + padding: 0; +} + +div.sphinxsidebar p { + color: #ffffff; +} + +div.sphinxsidebar p.topless { + margin: 5px 10px 10px 10px; +} + +div.sphinxsidebar ul { + margin: 10px; + padding: 0; + color: #ffffff; +} + +div.sphinxsidebar a { + color: #98dbcc; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + + + +/* -- hyperlink styles ------------------------------------------------------ */ + +a { + color: #355f7c; + text-decoration: none; +} + +a:visited { + color: #355f7c; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + + + +/* -- body styles ----------------------------------------------------------- */ + +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + font-family: 'Trebuchet MS', sans-serif; + background-color: #f2f2f2; + font-weight: normal; + color: #20435c; + border-bottom: 1px solid #ccc; + margin: 20px -20px 10px -20px; + padding: 3px 0 3px 10px; +} + +div.body h1 { margin-top: 0; font-size: 200%; } +div.body h2 { font-size: 160%; } +div.body h3 { font-size: 140%; } +div.body h4 { font-size: 120%; } +div.body h5 { font-size: 110%; } +div.body h6 { font-size: 100%; } + +a.headerlink { + color: #c60f0f; + font-size: 0.8em; + padding: 0 4px 0 4px; + text-decoration: none; +} + +a.headerlink:hover { + background-color: #c60f0f; + color: white; +} + +div.body p, div.body dd, div.body li, div.body blockquote { + text-align: justify; + line-height: 130%; +} + +div.admonition p.admonition-title + p { + display: inline; +} + +div.admonition p { + margin-bottom: 5px; +} + +div.admonition pre { + margin-bottom: 5px; +} + +div.admonition ul, div.admonition ol { + margin-bottom: 5px; +} + +div.note { + background-color: #eee; + border: 1px solid #ccc; +} + +div.seealso { + background-color: #ffc; + border: 1px solid #ff6; +} + +nav.contents, +aside.topic, +div.topic { + background-color: #eee; +} + +div.warning { + background-color: #ffe4e4; + border: 1px solid #f66; +} + +p.admonition-title { + display: inline; +} + +p.admonition-title:after { + content: ":"; +} + +pre { + padding: 5px; + background-color: unset; + color: unset; + line-height: 120%; + border: 1px solid #ac9; + border-left: none; + border-right: none; +} + +code { + background-color: #ecf0f3; + padding: 0 1px 0 1px; + font-size: 0.95em; +} + +th, dl.field-list > dt { + background-color: #ede; +} + +.warning code { + background: #efc2c2; +} + +.note code { + background: #d6d6d6; +} + +.viewcode-back { + font-family: sans-serif; +} + +div.viewcode-block:target { + background-color: #f4debf; + border-top: 1px solid #ac9; + border-bottom: 1px solid #ac9; +} + +div.code-block-caption { + color: #efefef; + background-color: #1c4e63; +} \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_static/doctools.js b/docs/nightly/v8.8.0b03/html/_static/doctools.js new file mode 100644 index 00000000..d06a71d7 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_static/doctools.js @@ -0,0 +1,156 @@ +/* + * doctools.js + * ~~~~~~~~~~~ + * + * Base JavaScript utilities for all Sphinx HTML documentation. + * + * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ +"use strict"; + +const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([ + "TEXTAREA", + "INPUT", + "SELECT", + "BUTTON", +]); + +const _ready = (callback) => { + if (document.readyState !== "loading") { + callback(); + } else { + document.addEventListener("DOMContentLoaded", callback); + } +}; + +/** + * Small JavaScript module for the documentation. + */ +const Documentation = { + init: () => { + Documentation.initDomainIndexTable(); + Documentation.initOnKeyListeners(); + }, + + /** + * i18n support + */ + TRANSLATIONS: {}, + PLURAL_EXPR: (n) => (n === 1 ? 0 : 1), + LOCALE: "unknown", + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext: (string) => { + const translated = Documentation.TRANSLATIONS[string]; + switch (typeof translated) { + case "undefined": + return string; // no translation + case "string": + return translated; // translation exists + default: + return translated[0]; // (singular, plural) translation tuple exists + } + }, + + ngettext: (singular, plural, n) => { + const translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated !== "undefined") + return translated[Documentation.PLURAL_EXPR(n)]; + return n === 1 ? singular : plural; + }, + + addTranslations: (catalog) => { + Object.assign(Documentation.TRANSLATIONS, catalog.messages); + Documentation.PLURAL_EXPR = new Function( + "n", + `return (${catalog.plural_expr})` + ); + Documentation.LOCALE = catalog.locale; + }, + + /** + * helper function to focus on search bar + */ + focusSearchBar: () => { + document.querySelectorAll("input[name=q]")[0]?.focus(); + }, + + /** + * Initialise the domain index toggle buttons + */ + initDomainIndexTable: () => { + const toggler = (el) => { + const idNumber = el.id.substr(7); + const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`); + if (el.src.substr(-9) === "minus.png") { + el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`; + toggledRows.forEach((el) => (el.style.display = "none")); + } else { + el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`; + toggledRows.forEach((el) => (el.style.display = "")); + } + }; + + const togglerElements = document.querySelectorAll("img.toggler"); + togglerElements.forEach((el) => + el.addEventListener("click", (event) => toggler(event.currentTarget)) + ); + togglerElements.forEach((el) => (el.style.display = "")); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler); + }, + + initOnKeyListeners: () => { + // only install a listener if it is really needed + if ( + !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS && + !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS + ) + return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.altKey || event.ctrlKey || event.metaKey) return; + + if (!event.shiftKey) { + switch (event.key) { + case "ArrowLeft": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const prevLink = document.querySelector('link[rel="prev"]'); + if (prevLink && prevLink.href) { + window.location.href = prevLink.href; + event.preventDefault(); + } + break; + case "ArrowRight": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const nextLink = document.querySelector('link[rel="next"]'); + if (nextLink && nextLink.href) { + window.location.href = nextLink.href; + event.preventDefault(); + } + break; + } + } + + // some keyboard layouts may need Shift to get / + switch (event.key) { + case "/": + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break; + Documentation.focusSearchBar(); + event.preventDefault(); + } + }); + }, +}; + +// quick alias for translations +const _ = Documentation.gettext; + +_ready(Documentation.init); diff --git a/docs/nightly/v8.8.0b03/html/_static/documentation_options.js b/docs/nightly/v8.8.0b03/html/_static/documentation_options.js new file mode 100644 index 00000000..532c33a2 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_static/documentation_options.js @@ -0,0 +1,14 @@ +var DOCUMENTATION_OPTIONS = { + URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), + VERSION: '8.8.0b0', + LANGUAGE: 'en', + COLLAPSE_INDEX: false, + BUILDER: 'html', + FILE_SUFFIX: '.html', + LINK_SUFFIX: '.html', + HAS_SOURCE: true, + SOURCELINK_SUFFIX: '.txt', + NAVIGATION_WITH_KEYS: false, + SHOW_SEARCH_SUMMARY: true, + ENABLE_SEARCH_SHORTCUTS: true, +}; \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_static/file.png b/docs/nightly/v8.8.0b03/html/_static/file.png new file mode 100644 index 00000000..a858a410 Binary files /dev/null and b/docs/nightly/v8.8.0b03/html/_static/file.png differ diff --git a/docs/nightly/v8.8.0b03/html/_static/language_data.js b/docs/nightly/v8.8.0b03/html/_static/language_data.js new file mode 100644 index 00000000..250f5665 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_static/language_data.js @@ -0,0 +1,199 @@ +/* + * language_data.js + * ~~~~~~~~~~~~~~~~ + * + * This script contains the language-specific data used by searchtools.js, + * namely the list of stopwords, stemmer, scorer and splitter. + * + * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"]; + + +/* Non-minified version is copied as a separate JS file, is available */ + +/** + * Porter Stemmer + */ +var Stemmer = function() { + + var step2list = { + ational: 'ate', + tional: 'tion', + enci: 'ence', + anci: 'ance', + izer: 'ize', + bli: 'ble', + alli: 'al', + entli: 'ent', + eli: 'e', + ousli: 'ous', + ization: 'ize', + ation: 'ate', + ator: 'ate', + alism: 'al', + iveness: 'ive', + fulness: 'ful', + ousness: 'ous', + aliti: 'al', + iviti: 'ive', + biliti: 'ble', + logi: 'log' + }; + + var step3list = { + icate: 'ic', + ative: '', + alize: 'al', + iciti: 'ic', + ical: 'ic', + ful: '', + ness: '' + }; + + var c = "[^aeiou]"; // consonant + var v = "[aeiouy]"; // vowel + var C = c + "[^aeiouy]*"; // consonant sequence + var V = v + "[aeiou]*"; // vowel sequence + + var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 + var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 + var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 + var s_v = "^(" + C + ")?" + v; // vowel in stem + + this.stemWord = function (w) { + var stem; + var suffix; + var firstch; + var origword = w; + + if (w.length < 3) + return w; + + var re; + var re2; + var re3; + var re4; + + firstch = w.substr(0,1); + if (firstch == "y") + w = firstch.toUpperCase() + w.substr(1); + + // Step 1a + re = /^(.+?)(ss|i)es$/; + re2 = /^(.+?)([^s])s$/; + + if (re.test(w)) + w = w.replace(re,"$1$2"); + else if (re2.test(w)) + w = w.replace(re2,"$1$2"); + + // Step 1b + re = /^(.+?)eed$/; + re2 = /^(.+?)(ed|ing)$/; + if (re.test(w)) { + var fp = re.exec(w); + re = new RegExp(mgr0); + if (re.test(fp[1])) { + re = /.$/; + w = w.replace(re,""); + } + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1]; + re2 = new RegExp(s_v); + if (re2.test(stem)) { + w = stem; + re2 = /(at|bl|iz)$/; + re3 = new RegExp("([^aeiouylsz])\\1$"); + re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re2.test(w)) + w = w + "e"; + else if (re3.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + else if (re4.test(w)) + w = w + "e"; + } + } + + // Step 1c + re = /^(.+?)y$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(s_v); + if (re.test(stem)) + w = stem + "i"; + } + + // Step 2 + re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step2list[suffix]; + } + + // Step 3 + re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step3list[suffix]; + } + + // Step 4 + re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; + re2 = /^(.+?)(s|t)(ion)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + if (re.test(stem)) + w = stem; + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1] + fp[2]; + re2 = new RegExp(mgr1); + if (re2.test(stem)) + w = stem; + } + + // Step 5 + re = /^(.+?)e$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + re2 = new RegExp(meq1); + re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) + w = stem; + } + re = /ll$/; + re2 = new RegExp(mgr1); + if (re.test(w) && re2.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + + // and turn initial Y back to y + if (firstch == "y") + w = firstch.toLowerCase() + w.substr(1); + return w; + } +} + diff --git a/docs/nightly/v8.8.0b03/html/_static/minus.png b/docs/nightly/v8.8.0b03/html/_static/minus.png new file mode 100644 index 00000000..d96755fd Binary files /dev/null and b/docs/nightly/v8.8.0b03/html/_static/minus.png differ diff --git a/docs/nightly/v8.8.0b03/html/_static/plus.png b/docs/nightly/v8.8.0b03/html/_static/plus.png new file mode 100644 index 00000000..7107cec9 Binary files /dev/null and b/docs/nightly/v8.8.0b03/html/_static/plus.png differ diff --git a/docs/nightly/v8.8.0b03/html/_static/pygments.css b/docs/nightly/v8.8.0b03/html/_static/pygments.css new file mode 100644 index 00000000..0d49244e --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_static/pygments.css @@ -0,0 +1,75 @@ +pre { line-height: 125%; } +td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.highlight .hll { background-color: #ffffcc } +.highlight { background: #eeffcc; } +.highlight .c { color: #408090; font-style: italic } /* Comment */ +.highlight .err { border: 1px solid #FF0000 } /* Error */ +.highlight .k { color: #007020; font-weight: bold } /* Keyword */ +.highlight .o { color: #666666 } /* Operator */ +.highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */ +.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #007020 } /* Comment.Preproc */ +.highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */ +.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ +.highlight .gd { color: #A00000 } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ +.highlight .gr { color: #FF0000 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #333333 } /* Generic.Output */ +.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #0044DD } /* Generic.Traceback */ +.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #007020 } /* Keyword.Pseudo */ +.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #902000 } /* Keyword.Type */ +.highlight .m { color: #208050 } /* Literal.Number */ +.highlight .s { color: #4070a0 } /* Literal.String */ +.highlight .na { color: #4070a0 } /* Name.Attribute */ +.highlight .nb { color: #007020 } /* Name.Builtin */ +.highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ +.highlight .no { color: #60add5 } /* Name.Constant */ +.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ +.highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #007020 } /* Name.Exception */ +.highlight .nf { color: #06287e } /* Name.Function */ +.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ +.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ +.highlight .nv { color: #bb60d5 } /* Name.Variable */ +.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mb { color: #208050 } /* Literal.Number.Bin */ +.highlight .mf { color: #208050 } /* Literal.Number.Float */ +.highlight .mh { color: #208050 } /* Literal.Number.Hex */ +.highlight .mi { color: #208050 } /* Literal.Number.Integer */ +.highlight .mo { color: #208050 } /* Literal.Number.Oct */ +.highlight .sa { color: #4070a0 } /* Literal.String.Affix */ +.highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ +.highlight .sc { color: #4070a0 } /* Literal.String.Char */ +.highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */ +.highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ +.highlight .s2 { color: #4070a0 } /* Literal.String.Double */ +.highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ +.highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ +.highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ +.highlight .sx { color: #c65d09 } /* Literal.String.Other */ +.highlight .sr { color: #235388 } /* Literal.String.Regex */ +.highlight .s1 { color: #4070a0 } /* Literal.String.Single */ +.highlight .ss { color: #517918 } /* Literal.String.Symbol */ +.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ +.highlight .fm { color: #06287e } /* Name.Function.Magic */ +.highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ +.highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ +.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ +.highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */ +.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_static/searchtools.js b/docs/nightly/v8.8.0b03/html/_static/searchtools.js new file mode 100644 index 00000000..97d56a74 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_static/searchtools.js @@ -0,0 +1,566 @@ +/* + * searchtools.js + * ~~~~~~~~~~~~~~~~ + * + * Sphinx JavaScript utilities for the full-text search. + * + * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ +"use strict"; + +/** + * Simple result scoring code. + */ +if (typeof Scorer === "undefined") { + var Scorer = { + // Implement the following function to further tweak the score for each result + // The function takes a result array [docname, title, anchor, descr, score, filename] + // and returns the new score. + /* + score: result => { + const [docname, title, anchor, descr, score, filename] = result + return score + }, + */ + + // query matches the full name of an object + objNameMatch: 11, + // or matches in the last dotted part of the object name + objPartialMatch: 6, + // Additive scores depending on the priority of the object + objPrio: { + 0: 15, // used to be importantResults + 1: 5, // used to be objectResults + 2: -5, // used to be unimportantResults + }, + // Used when the priority is not in the mapping. + objPrioDefault: 0, + + // query found in title + title: 15, + partialTitle: 7, + // query found in terms + term: 5, + partialTerm: 2, + }; +} + +const _removeChildren = (element) => { + while (element && element.lastChild) element.removeChild(element.lastChild); +}; + +/** + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping + */ +const _escapeRegExp = (string) => + string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string + +const _displayItem = (item, searchTerms) => { + const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; + const docUrlRoot = DOCUMENTATION_OPTIONS.URL_ROOT; + const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; + const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX; + const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY; + + const [docName, title, anchor, descr, score, _filename] = item; + + let listItem = document.createElement("li"); + let requestUrl; + let linkUrl; + if (docBuilder === "dirhtml") { + // dirhtml builder + let dirname = docName + "/"; + if (dirname.match(/\/index\/$/)) + dirname = dirname.substring(0, dirname.length - 6); + else if (dirname === "index/") dirname = ""; + requestUrl = docUrlRoot + dirname; + linkUrl = requestUrl; + } else { + // normal html builders + requestUrl = docUrlRoot + docName + docFileSuffix; + linkUrl = docName + docLinkSuffix; + } + let linkEl = listItem.appendChild(document.createElement("a")); + linkEl.href = linkUrl + anchor; + linkEl.dataset.score = score; + linkEl.innerHTML = title; + if (descr) + listItem.appendChild(document.createElement("span")).innerHTML = + " (" + descr + ")"; + else if (showSearchSummary) + fetch(requestUrl) + .then((responseData) => responseData.text()) + .then((data) => { + if (data) + listItem.appendChild( + Search.makeSearchSummary(data, searchTerms) + ); + }); + Search.output.appendChild(listItem); +}; +const _finishSearch = (resultCount) => { + Search.stopPulse(); + Search.title.innerText = _("Search Results"); + if (!resultCount) + Search.status.innerText = Documentation.gettext( + "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories." + ); + else + Search.status.innerText = _( + `Search finished, found ${resultCount} page(s) matching the search query.` + ); +}; +const _displayNextItem = ( + results, + resultCount, + searchTerms +) => { + // results left, load the summary and display it + // this is intended to be dynamic (don't sub resultsCount) + if (results.length) { + _displayItem(results.pop(), searchTerms); + setTimeout( + () => _displayNextItem(results, resultCount, searchTerms), + 5 + ); + } + // search finished, update title and status message + else _finishSearch(resultCount); +}; + +/** + * Default splitQuery function. Can be overridden in ``sphinx.search`` with a + * custom function per language. + * + * The regular expression works by splitting the string on consecutive characters + * that are not Unicode letters, numbers, underscores, or emoji characters. + * This is the same as ``\W+`` in Python, preserving the surrogate pair area. + */ +if (typeof splitQuery === "undefined") { + var splitQuery = (query) => query + .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu) + .filter(term => term) // remove remaining empty strings +} + +/** + * Search Module + */ +const Search = { + _index: null, + _queued_query: null, + _pulse_status: -1, + + htmlToText: (htmlString) => { + const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); + htmlElement.querySelectorAll(".headerlink").forEach((el) => { el.remove() }); + const docContent = htmlElement.querySelector('[role="main"]'); + if (docContent !== undefined) return docContent.textContent; + console.warn( + "Content block not found. Sphinx search tries to obtain it via '[role=main]'. Could you check your theme or template." + ); + return ""; + }, + + init: () => { + const query = new URLSearchParams(window.location.search).get("q"); + document + .querySelectorAll('input[name="q"]') + .forEach((el) => (el.value = query)); + if (query) Search.performSearch(query); + }, + + loadIndex: (url) => + (document.body.appendChild(document.createElement("script")).src = url), + + setIndex: (index) => { + Search._index = index; + if (Search._queued_query !== null) { + const query = Search._queued_query; + Search._queued_query = null; + Search.query(query); + } + }, + + hasIndex: () => Search._index !== null, + + deferQuery: (query) => (Search._queued_query = query), + + stopPulse: () => (Search._pulse_status = -1), + + startPulse: () => { + if (Search._pulse_status >= 0) return; + + const pulse = () => { + Search._pulse_status = (Search._pulse_status + 1) % 4; + Search.dots.innerText = ".".repeat(Search._pulse_status); + if (Search._pulse_status >= 0) window.setTimeout(pulse, 500); + }; + pulse(); + }, + + /** + * perform a search for something (or wait until index is loaded) + */ + performSearch: (query) => { + // create the required interface elements + const searchText = document.createElement("h2"); + searchText.textContent = _("Searching"); + const searchSummary = document.createElement("p"); + searchSummary.classList.add("search-summary"); + searchSummary.innerText = ""; + const searchList = document.createElement("ul"); + searchList.classList.add("search"); + + const out = document.getElementById("search-results"); + Search.title = out.appendChild(searchText); + Search.dots = Search.title.appendChild(document.createElement("span")); + Search.status = out.appendChild(searchSummary); + Search.output = out.appendChild(searchList); + + const searchProgress = document.getElementById("search-progress"); + // Some themes don't use the search progress node + if (searchProgress) { + searchProgress.innerText = _("Preparing search..."); + } + Search.startPulse(); + + // index already loaded, the browser was quick! + if (Search.hasIndex()) Search.query(query); + else Search.deferQuery(query); + }, + + /** + * execute search (requires search index to be loaded) + */ + query: (query) => { + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const titles = Search._index.titles; + const allTitles = Search._index.alltitles; + const indexEntries = Search._index.indexentries; + + // stem the search terms and add them to the correct list + const stemmer = new Stemmer(); + const searchTerms = new Set(); + const excludedTerms = new Set(); + const highlightTerms = new Set(); + const objectTerms = new Set(splitQuery(query.toLowerCase().trim())); + splitQuery(query.trim()).forEach((queryTerm) => { + const queryTermLower = queryTerm.toLowerCase(); + + // maybe skip this "word" + // stopwords array is from language_data.js + if ( + stopwords.indexOf(queryTermLower) !== -1 || + queryTerm.match(/^\d+$/) + ) + return; + + // stem the word + let word = stemmer.stemWord(queryTermLower); + // select the correct list + if (word[0] === "-") excludedTerms.add(word.substr(1)); + else { + searchTerms.add(word); + highlightTerms.add(queryTermLower); + } + }); + + if (SPHINX_HIGHLIGHT_ENABLED) { // set in sphinx_highlight.js + localStorage.setItem("sphinx_highlight_terms", [...highlightTerms].join(" ")) + } + + // console.debug("SEARCH: searching for:"); + // console.info("required: ", [...searchTerms]); + // console.info("excluded: ", [...excludedTerms]); + + // array of [docname, title, anchor, descr, score, filename] + let results = []; + _removeChildren(document.getElementById("search-progress")); + + const queryLower = query.toLowerCase(); + for (const [title, foundTitles] of Object.entries(allTitles)) { + if (title.toLowerCase().includes(queryLower) && (queryLower.length >= title.length/2)) { + for (const [file, id] of foundTitles) { + let score = Math.round(100 * queryLower.length / title.length) + results.push([ + docNames[file], + titles[file] !== title ? `${titles[file]} > ${title}` : title, + id !== null ? "#" + id : "", + null, + score, + filenames[file], + ]); + } + } + } + + // search for explicit entries in index directives + for (const [entry, foundEntries] of Object.entries(indexEntries)) { + if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) { + for (const [file, id] of foundEntries) { + let score = Math.round(100 * queryLower.length / entry.length) + results.push([ + docNames[file], + titles[file], + id ? "#" + id : "", + null, + score, + filenames[file], + ]); + } + } + } + + // lookup as object + objectTerms.forEach((term) => + results.push(...Search.performObjectSearch(term, objectTerms)) + ); + + // lookup as search terms in fulltext + results.push(...Search.performTermsSearch(searchTerms, excludedTerms)); + + // let the scorer override scores with a custom scoring function + if (Scorer.score) results.forEach((item) => (item[4] = Scorer.score(item))); + + // now sort the results by score (in opposite order of appearance, since the + // display function below uses pop() to retrieve items) and then + // alphabetically + results.sort((a, b) => { + const leftScore = a[4]; + const rightScore = b[4]; + if (leftScore === rightScore) { + // same score: sort alphabetically + const leftTitle = a[1].toLowerCase(); + const rightTitle = b[1].toLowerCase(); + if (leftTitle === rightTitle) return 0; + return leftTitle > rightTitle ? -1 : 1; // inverted is intentional + } + return leftScore > rightScore ? 1 : -1; + }); + + // remove duplicate search results + // note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept + let seen = new Set(); + results = results.reverse().reduce((acc, result) => { + let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(','); + if (!seen.has(resultStr)) { + acc.push(result); + seen.add(resultStr); + } + return acc; + }, []); + + results = results.reverse(); + + // for debugging + //Search.lastresults = results.slice(); // a copy + // console.info("search results:", Search.lastresults); + + // print the results + _displayNextItem(results, results.length, searchTerms); + }, + + /** + * search for object names + */ + performObjectSearch: (object, objectTerms) => { + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const objects = Search._index.objects; + const objNames = Search._index.objnames; + const titles = Search._index.titles; + + const results = []; + + const objectSearchCallback = (prefix, match) => { + const name = match[4] + const fullname = (prefix ? prefix + "." : "") + name; + const fullnameLower = fullname.toLowerCase(); + if (fullnameLower.indexOf(object) < 0) return; + + let score = 0; + const parts = fullnameLower.split("."); + + // check for different match types: exact matches of full name or + // "last name" (i.e. last dotted part) + if (fullnameLower === object || parts.slice(-1)[0] === object) + score += Scorer.objNameMatch; + else if (parts.slice(-1)[0].indexOf(object) > -1) + score += Scorer.objPartialMatch; // matches in last name + + const objName = objNames[match[1]][2]; + const title = titles[match[0]]; + + // If more than one term searched for, we require other words to be + // found in the name/title/description + const otherTerms = new Set(objectTerms); + otherTerms.delete(object); + if (otherTerms.size > 0) { + const haystack = `${prefix} ${name} ${objName} ${title}`.toLowerCase(); + if ( + [...otherTerms].some((otherTerm) => haystack.indexOf(otherTerm) < 0) + ) + return; + } + + let anchor = match[3]; + if (anchor === "") anchor = fullname; + else if (anchor === "-") anchor = objNames[match[1]][1] + "-" + fullname; + + const descr = objName + _(", in ") + title; + + // add custom score for some objects according to scorer + if (Scorer.objPrio.hasOwnProperty(match[2])) + score += Scorer.objPrio[match[2]]; + else score += Scorer.objPrioDefault; + + results.push([ + docNames[match[0]], + fullname, + "#" + anchor, + descr, + score, + filenames[match[0]], + ]); + }; + Object.keys(objects).forEach((prefix) => + objects[prefix].forEach((array) => + objectSearchCallback(prefix, array) + ) + ); + return results; + }, + + /** + * search for full-text terms in the index + */ + performTermsSearch: (searchTerms, excludedTerms) => { + // prepare search + const terms = Search._index.terms; + const titleTerms = Search._index.titleterms; + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const titles = Search._index.titles; + + const scoreMap = new Map(); + const fileMap = new Map(); + + // perform the search on the required terms + searchTerms.forEach((word) => { + const files = []; + const arr = [ + { files: terms[word], score: Scorer.term }, + { files: titleTerms[word], score: Scorer.title }, + ]; + // add support for partial matches + if (word.length > 2) { + const escapedWord = _escapeRegExp(word); + Object.keys(terms).forEach((term) => { + if (term.match(escapedWord) && !terms[word]) + arr.push({ files: terms[term], score: Scorer.partialTerm }); + }); + Object.keys(titleTerms).forEach((term) => { + if (term.match(escapedWord) && !titleTerms[word]) + arr.push({ files: titleTerms[word], score: Scorer.partialTitle }); + }); + } + + // no match but word was a required one + if (arr.every((record) => record.files === undefined)) return; + + // found search word in contents + arr.forEach((record) => { + if (record.files === undefined) return; + + let recordFiles = record.files; + if (recordFiles.length === undefined) recordFiles = [recordFiles]; + files.push(...recordFiles); + + // set score for the word in each file + recordFiles.forEach((file) => { + if (!scoreMap.has(file)) scoreMap.set(file, {}); + scoreMap.get(file)[word] = record.score; + }); + }); + + // create the mapping + files.forEach((file) => { + if (fileMap.has(file) && fileMap.get(file).indexOf(word) === -1) + fileMap.get(file).push(word); + else fileMap.set(file, [word]); + }); + }); + + // now check if the files don't contain excluded terms + const results = []; + for (const [file, wordList] of fileMap) { + // check if all requirements are matched + + // as search terms with length < 3 are discarded + const filteredTermCount = [...searchTerms].filter( + (term) => term.length > 2 + ).length; + if ( + wordList.length !== searchTerms.size && + wordList.length !== filteredTermCount + ) + continue; + + // ensure that none of the excluded terms is in the search result + if ( + [...excludedTerms].some( + (term) => + terms[term] === file || + titleTerms[term] === file || + (terms[term] || []).includes(file) || + (titleTerms[term] || []).includes(file) + ) + ) + break; + + // select one (max) score for the file. + const score = Math.max(...wordList.map((w) => scoreMap.get(file)[w])); + // add result to the result list + results.push([ + docNames[file], + titles[file], + "", + null, + score, + filenames[file], + ]); + } + return results; + }, + + /** + * helper function to return a node containing the + * search summary for a given text. keywords is a list + * of stemmed words. + */ + makeSearchSummary: (htmlText, keywords) => { + const text = Search.htmlToText(htmlText); + if (text === "") return null; + + const textLower = text.toLowerCase(); + const actualStartPosition = [...keywords] + .map((k) => textLower.indexOf(k.toLowerCase())) + .filter((i) => i > -1) + .slice(-1)[0]; + const startWithContext = Math.max(actualStartPosition - 120, 0); + + const top = startWithContext === 0 ? "" : "..."; + const tail = startWithContext + 240 < text.length ? "..." : ""; + + let summary = document.createElement("p"); + summary.classList.add("context"); + summary.textContent = top + text.substr(startWithContext, 240).trim() + tail; + + return summary; + }, +}; + +_ready(Search.init); diff --git a/docs/nightly/v8.8.0b03/html/_static/sidebar.js b/docs/nightly/v8.8.0b03/html/_static/sidebar.js new file mode 100644 index 00000000..c5e2692c --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_static/sidebar.js @@ -0,0 +1,70 @@ +/* + * sidebar.js + * ~~~~~~~~~~ + * + * This script makes the Sphinx sidebar collapsible. + * + * .sphinxsidebar contains .sphinxsidebarwrapper. This script adds + * in .sphixsidebar, after .sphinxsidebarwrapper, the #sidebarbutton + * used to collapse and expand the sidebar. + * + * When the sidebar is collapsed the .sphinxsidebarwrapper is hidden + * and the width of the sidebar and the margin-left of the document + * are decreased. When the sidebar is expanded the opposite happens. + * This script saves a per-browser/per-session cookie used to + * remember the position of the sidebar among the pages. + * Once the browser is closed the cookie is deleted and the position + * reset to the default (expanded). + * + * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +const initialiseSidebar = () => { + + + + + // global elements used by the functions. + const bodyWrapper = document.getElementsByClassName("bodywrapper")[0] + const sidebar = document.getElementsByClassName("sphinxsidebar")[0] + const sidebarWrapper = document.getElementsByClassName('sphinxsidebarwrapper')[0] + const sidebarButton = document.getElementById("sidebarbutton") + const sidebarArrow = sidebarButton.querySelector('span') + + // for some reason, the document has no sidebar; do not run into errors + if (typeof sidebar === "undefined") return; + + const flipArrow = element => element.innerText = (element.innerText === "»") ? "«" : "»" + + const collapse_sidebar = () => { + bodyWrapper.style.marginLeft = ".8em"; + sidebar.style.width = ".8em" + sidebarWrapper.style.display = "none" + flipArrow(sidebarArrow) + sidebarButton.title = _('Expand sidebar') + window.localStorage.setItem("sidebar", "collapsed") + } + + const expand_sidebar = () => { + bodyWrapper.style.marginLeft = "" + sidebar.style.removeProperty("width") + sidebarWrapper.style.display = "" + flipArrow(sidebarArrow) + sidebarButton.title = _('Collapse sidebar') + window.localStorage.setItem("sidebar", "expanded") + } + + sidebarButton.addEventListener("click", () => { + (sidebarWrapper.style.display === "none") ? expand_sidebar() : collapse_sidebar() + }) + + if (!window.localStorage.getItem("sidebar")) return + const value = window.localStorage.getItem("sidebar") + if (value === "collapsed") collapse_sidebar(); + else if (value === "expanded") expand_sidebar(); +} + +if (document.readyState !== "loading") initialiseSidebar() +else document.addEventListener("DOMContentLoaded", initialiseSidebar) \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/_static/sphinx_highlight.js b/docs/nightly/v8.8.0b03/html/_static/sphinx_highlight.js new file mode 100644 index 00000000..aae669d7 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/_static/sphinx_highlight.js @@ -0,0 +1,144 @@ +/* Highlighting utilities for Sphinx HTML documentation. */ +"use strict"; + +const SPHINX_HIGHLIGHT_ENABLED = true + +/** + * highlight a given string on a node by wrapping it in + * span elements with the given class name. + */ +const _highlight = (node, addItems, text, className) => { + if (node.nodeType === Node.TEXT_NODE) { + const val = node.nodeValue; + const parent = node.parentNode; + const pos = val.toLowerCase().indexOf(text); + if ( + pos >= 0 && + !parent.classList.contains(className) && + !parent.classList.contains("nohighlight") + ) { + let span; + + const closestNode = parent.closest("body, svg, foreignObject"); + const isInSVG = closestNode && closestNode.matches("svg"); + if (isInSVG) { + span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + } else { + span = document.createElement("span"); + span.classList.add(className); + } + + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + parent.insertBefore( + span, + parent.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling + ) + ); + node.nodeValue = val.substr(0, pos); + + if (isInSVG) { + const rect = document.createElementNS( + "http://www.w3.org/2000/svg", + "rect" + ); + const bbox = parent.getBBox(); + rect.x.baseVal.value = bbox.x; + rect.y.baseVal.value = bbox.y; + rect.width.baseVal.value = bbox.width; + rect.height.baseVal.value = bbox.height; + rect.setAttribute("class", className); + addItems.push({ parent: parent, target: rect }); + } + } + } else if (node.matches && !node.matches("button, select, textarea")) { + node.childNodes.forEach((el) => _highlight(el, addItems, text, className)); + } +}; +const _highlightText = (thisNode, text, className) => { + let addItems = []; + _highlight(thisNode, addItems, text, className); + addItems.forEach((obj) => + obj.parent.insertAdjacentElement("beforebegin", obj.target) + ); +}; + +/** + * Small JavaScript module for the documentation. + */ +const SphinxHighlight = { + + /** + * highlight the search words provided in localstorage in the text + */ + highlightSearchWords: () => { + if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight + + // get and clear terms from localstorage + const url = new URL(window.location); + const highlight = + localStorage.getItem("sphinx_highlight_terms") + || url.searchParams.get("highlight") + || ""; + localStorage.removeItem("sphinx_highlight_terms") + url.searchParams.delete("highlight"); + window.history.replaceState({}, "", url); + + // get individual terms from highlight string + const terms = highlight.toLowerCase().split(/\s+/).filter(x => x); + if (terms.length === 0) return; // nothing to do + + // There should never be more than one element matching "div.body" + const divBody = document.querySelectorAll("div.body"); + const body = divBody.length ? divBody[0] : document.querySelector("body"); + window.setTimeout(() => { + terms.forEach((term) => _highlightText(body, term, "highlighted")); + }, 10); + + const searchBox = document.getElementById("searchbox"); + if (searchBox === null) return; + searchBox.appendChild( + document + .createRange() + .createContextualFragment( + '" + ) + ); + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords: () => { + document + .querySelectorAll("#searchbox .highlight-link") + .forEach((el) => el.remove()); + document + .querySelectorAll("span.highlighted") + .forEach((el) => el.classList.remove("highlighted")); + localStorage.removeItem("sphinx_highlight_terms") + }, + + initEscapeListener: () => { + // only install a listener if it is really needed + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return; + if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) { + SphinxHighlight.hideSearchWords(); + event.preventDefault(); + } + }); + }, +}; + +_ready(SphinxHighlight.highlightSearchWords); +_ready(SphinxHighlight.initEscapeListener); diff --git a/docs/nightly/v8.8.0b03/html/api.html b/docs/nightly/v8.8.0b03/html/api.html new file mode 100644 index 00000000..5e724b66 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/api.html @@ -0,0 +1,1076 @@ + + + + + + + + API — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

API

+
+

Classes

+

ESMPy uses a Field object to represent data variables +built on an underlying spatial discretization, which is represented by a +Grid, Mesh or +LocStream. +Regridding between Fields is accomplished with the +Regrid class. All of these classes are explained in +more detail in the sections provided by the links in the following table.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Class

Description

Manager

A manager class to initialize and finalize ESMF

Field

A data field built on a Grid, Mesh, or LocStream

Grid

A class to represent a logically rectangular grid

Mesh

A class to represent an unstructured grid

LocStream

A class to represent observational data as a collection of disconnected points

Regrid

The regridding utility

RegridFromFile

The from file regridding utility

+
+
+

Named Constants

+

ESMPy follows the ESMF convention of using “named constants” to represent the +available options for parameters that expect a variety of specific inputs. The +following table lists the available named constants and provides links to pages +that further explain the available values.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Named constants

Description

CoordSys

Specify the coordinate system of a Grid

ExtrapMethod

Specify the extrapolation method

FileFormat

Specify the format of a data file

FileMode

Specify the mode of a data file

GridItem

Specify a mask or area item on a Grid

LineType

Specify the type of line that connects two points on a sphere

LogKind

Specify how much logging should be done

MeshElemType

Specify the type of the Mesh elements

MeshLoc

Specify a nodal or elemental Mesh

NormType

Specify the type of normalization to use for conservative regridding weights

PoleKind

Specify the type of connection that appears at the poles of the Grid

PoleMethod

Specify which type of artificial pole to construct on the source Grid for regridding

Region

Specify various regions in the data layout of

RegridMethod

Specify which interpolation method to use regridding

StaggerLoc

Specify the position for data in a Grid cell

TypeKind

Specify the type and kind of data

UnmappedAction

Specify which action to take with respect to unmapped destination points

+
+
+

Manager

+

The Manager is used by ESMPy to simplify a +number of low-level calls used by the underlying ESMF framework to allocate +resources, enable logging, and control garbage collection.

+
+

Resource Allocation

+

The ESMF Virtual Machine (VM) +is created at the beginning of each ESMPy execution, and contains information +about the topology and characteristics of the underlying computer. The VM +allocates computational resources in the form of +Persistent Execution Threads, or PETs. These are equivalent to operating +system threads with a lifetime of at least that of the ESMPy execution. In the +simplest, and most common case, a PET is equivalent to an MPI process. The +number of PETs and the current PET can be queried from the +Manager:

+
mg = esmpy.Manager()
+pet_count = mg.pet_count()
+local_pet = mg.local_pet()
+
+
+

Refer to the VM Class of the +ESMF Reference Manual +for more information.

+
+
+

Logging

+

The Manager is also used to enable logging:

+
mg = esmpy.Manager(debug=True)
+local_pet = mg.local_pet
+
+
+

The output will be logged in files named PET<local_pet>.ESMF_LogFile.

+
+
+

Memory management

+

The underlying ESMF framework needs to be initialized and finalized once and +only once per execution. This is handled internally by the +Manager and does not require any explicit +user intervention. However, the ESMF garbage collection feature is not triggered +until the finalization routine is invoked, which may not happen until the +Manager goes out of scope at the end of the +program execution.

+

If memory deallocation of ESMPy +objects is required prior to the end of the program, the class level +destroy routines should be invoked:

+
mg = esmpy.Manager()
+
+mg.destroy()
+
+
+

This is commonly required when reusing a Regrid object +to interpolate data between many Field pairs.

+
+
+

MOAB Mesh backend

+

The Manager can be used to enable the MOAB +mesh backend to the Mesh.

+
mg.set_moab(moab_on=True)
+
+
+

The MOAB mesh is an alternative to the native ESMF mesh, and does not yet have +full support.

+
+
+
+

Spatial Discretization Objects

+

There are three different objects used for spatial coordinate representation: +Grid, Mesh, and LocStream. Grids are used to represent logically rectangular +grids, Meshes are used for unstructured collections of polygons, and +LocStreams are used for unstructured collections of individual points. These +objects are nearly identical counterparts to the objects of the same name in +ESMF, with some simplifications for ease of use in the Python environment.

+
+

Grid

+

The Grid is used to represent the geometry and discretization of logically +rectangular physical grids. The Grid can also hold information that can used in +calculations involving the Grid, like a mask or the cell areas. Refer to the Grid Class of the +ESMF Reference Manual for more information.

+
+

Staggering

+

Staggering is a finite difference technique in which the values of different +physical quantities are placed at different locations within a grid cell.

+

The ESMF Grid class supports a variety of stagger locations, including cell +centers, corners, and edge centers. The default stagger location in ESMF is the +cell center, and cell counts in Grid are based on this assumption. Combinations +of the 2D ESMF stagger locations are sufficient to specify any of the Arakawa +staggers. ESMF also supports staggering in 3D and higher dimensions. There are +shortcuts for standard staggers, and interfaces through which users can create +custom staggers.

+

As a default the ESMF Grid class provides symmetric staggering, so that cell +centers are enclosed by cell perimeter (e.g. corner) stagger locations. This +means the coordinate arrays for stagger locations other than the center will +have an additional element of padding in order to enclose the cell center +locations. However, to achieve other types of staggering, the user may alter or +eliminate this padding by using the appropriate options when adding coordinates +to a Grid.

+

Grid staggers are indicated using +StaggerLoc.

+
grid = esmpy.Grid(np.array([3,4]), staggerloc=esmpy.StaggerLoc.CENTER)
+
+
+
+
+

Spherical Coordinates

+

In the case that the Grid is on a sphere (coord_sys = esmpy.api.constants.CoordSys.SPH_DEG or +esmpy.api.constants.CoordSys.SPH_RAD) then the coordinates given in the Grid are interpreted +as latitude and longitude values. The coordinates can either be in degrees or +radians as indicated by the coord_sys flag set during Grid creation. As is +true with many global models, this application currently assumes the latitude +and longitude refer to positions on a perfect sphere.

+

The Grid coordinate system is represented using +CoordSys.

+
grid = esmpy.Grid(np.array([3,4]), staggerloc=esmpy.StaggerLoc.CENTER,
+                    coord_sys=esmpy.CoordSys.SPH_DEG)
+
+
+
+
+

Periodicity

+

A periodic connection can be specified when building Grids in spherical +coordinates. The num_peri_dims parameter indicates the total number of +periodic dimensions and periodic_dim is used to identify which dimensions +should be considered periodic. There must always be at least one non-periodic +dimension. For example, to create a global latitude-longitude Grid there would +be one periodic dimension, dimension 0 (longitude).

+
grid = esmpy.Grid(np.array([3,4]), staggerloc=esmpy.StaggerLoc.CENTER,
+                    coord_sys=esmpy.CoordSys.SPH_DEG,
+                    num_peri_dims=1, periodic_dim=0)
+
+
+
+
+

Pole Generation

+

The Grid can generate an artificial pole by using the pole_dim parameter. This +can be helpful for regridding operations to smooth out the interpolated values +in the polar region. For the example of creating a global latitude-longitude +Grid, the pole dimension would be 1 (latitude).

+
grid = esmpy.Grid(np.array([3,4]), staggerloc=esmpy.StaggerLoc.CENTER,
+                    coord_sys=esmpy.CoordSys.SPH_DEG,
+                    num_peri_dims=1, periodic_dim=0, pole_dim=1)
+
+
+
+
+

Masking

+

Masking is the process used to mark parts of a Grid to be ignored during an +operation. Marking Grid cells as masked can affect the Field values that are +represented by those cells. Masking is specified by assigning an integer value +to a Grid cell. This allows many different masks to be defined on the same Grid, +any combination of which may be also activated on the Field by specifying the +corresponding integer values. The activation of Field masks with respect to the +underlying Grid mask is handled by Regrid, and a more +general discussion of masking is covered in the masking +section.

+
In [1]: import numpy as np
+   ...: import esmpy
+   ...: grid = esmpy.Grid(np.array([3,4]), staggerloc=esmpy.StaggerLoc.CENTER,
+   ...:                                coord_sys=esmpy.CoordSys.SPH_DEG,
+   ...:                                num_peri_dims=1, periodic_dim=0, pole_dim=1)
+   ...:
+   ...: mask = grid.add_item(esmpy.GridItem.MASK, staggerloc=esmpy.StaggerLoc.CENTER)
+   ...: mask
+   ...:
+Out[1]:
+array([[1, 1, 1, 1],
+       [1, 1, 1, 1],
+       [1, 1, 1, 1]], dtype=int32)
+
+
+
+
+

Cell Areas

+

Grid cell areas can be calculated by ESMPy. Space must first be allocated for +this calculation by adding an +AREA item to the Grid. +Then a Field must be created, and the +get_area() function called.

+
+

Note

+

The Grid area calculation assumes the Grid is a unit sphere.

+
+

Grid cell areas may also be set to user-defined values +after the AREA item has +been allocated and retrieved using get_item().

+
In [1]: grid = esmpy.Grid(np.array([3,4]), staggerloc=[esmpy.StaggerLoc.CENTER, esmpy.StaggerLoc.CORNER],
+   ...:                  coord_sys=esmpy.CoordSys.SPH_DEG,
+   ...:                  num_peri_dims=1, periodic_dim=0, pole_dim=1)
+   ...:
+   ...:
+   ...: gridLon = grid.get_coords(0)
+   ...: gridLat = grid.get_coords(1)
+   ...: gridLonCorner = grid.get_coords(0, staggerloc=esmpy.StaggerLoc.CORNER)
+   ...: gridLatCorner = grid.get_coords(1, staggerloc=esmpy.StaggerLoc.CORNER)
+   ...:
+   ...: lon = np.linspace(-120,120,3)
+   ...: lat = np.linspace(-67.5, 67.5,4)
+   ...: lon_corner = np.arange(-180,180,120)
+   ...: lat_corner = np.linspace(-90, 90, 5)
+   ...:
+   ...: lonm, latm = np.meshgrid(lon, lat, indexing='ij')
+   ...: lonm_corner, latm_corner = np.meshgrid(lon_corner, lat_corner, indexing='ij')
+   ...:
+   ...: gridLon[:] = lonm
+   ...: gridLat[:] = latm
+   ...: gridLonCorner[:] = lonm_corner
+   ...: gridLatCorner[:] = latm_corner
+   ...:
+   ...: field = esmpy.Field(grid)
+   ...: field.get_area()
+   ...: field.data
+   ...:
+Out[1]:
+array([[ 0.32224085,  1.02707409,  1.02707409,  0.32224085],
+       [ 0.32224085,  1.02707409,  1.02707409,  0.32224085],
+       [ 0.32224085,  1.02707409,  1.02707409,  0.32224085]])
+
+
+
+
+
+

Mesh

+

A Mesh is an object for representing unstructured grids. +Refer to the Mesh Class of the +ESMF Reference Manual +for more information.

+

A Mesh is constructed of nodes and elements. A node, also known as a vertex +or corner, is a part of a Mesh which represents a single point. An element, +also known as a cell, is a part of a Mesh which represents a small +region of space. Elements are described in terms of a connected set of nodes +which represent locations along their boundaries.

+

Field data may be located on either the nodes or elements of a Mesh. Fields +created on a Mesh can also be used as either the source or destination or both +of a regridding operation.

+

The dimension of a Mesh in ESMF is specified with two parameters: the +parametric dimension and the spatial dimension.

+

The parametric dimension of a Mesh is the dimension of the topology of the Mesh. +This can be thought of as the dimension of the elements which make up the Mesh. +For example, a Mesh composed of triangles would have a parametric dimension of +2, and a Mesh composed of tetrahedra would have a parametric dimension of 3.

+

The spatial dimension of a Mesh is the dimension of the space in which the Mesh +is embedded. In other words, it is the number of coordinate dimensions needed to +describe the location of the nodes making up the Mesh.

+

For example, a Mesh constructed of squares on a plane would have a parametric +dimension of 2 and a spatial dimension of 2. If that same Mesh were used to +represent the 2D surface of a sphere, then the Mesh would still have a +parametric dimension of 2, but now its spatial dimension would be 3.

+

Only Meshes whose number of coordinate dimensions (spatial dimension) is 2 or 3 +are supported. The dimension of the elements in a Mesh (parametric dimension) must +be less than or equal to the spatial dimension, but also must be either 2 or 3. +This means that a Mesh may be either 2D elements in 2D space, 3D elements in 3D +space, or a manifold constructed of 2D elements embedded in 3D space.

+

For a parametric dimension of 2, the native supported element types are +triangles and quadrilaterals. In addition to these, ESMF supports 2D polygons +with any number of sides. Internally these are represented as sets of triangles, +but to the user should behave like any other element. For a parametric dimension +of 3, the supported element types are tetrahedrons and hexahedrons. The Mesh +supports any combination of element types within a particular dimension, but +types from different dimensions may not be mixed. For example, a Mesh cannot be +constructed of both quadrilaterals and tetrahedra.

+
+

Mesh Creation

+

To create a Mesh we need to set some properties of the Mesh as a whole, some +properties of each node in the Mesh and then some properties of each element +which connects the nodes.

+

For the Mesh as a whole we set its parametric dimension and spatial dimension. +A Mesh's parametric dimension can be thought of as the dimension of the elements +which make up the Mesh. A Mesh's spatial dimension, on the other hand, is the +number of coordinate dimensions needed to describe the location of the nodes +making up the Mesh.

+

The structure of the per node and element information used to create a Mesh is +influenced by the Mesh distribution strategy. The Mesh class is distributed by +elements. This means that a node must be present on any PET that contains +an element associated with that node, but not on any other PET (a node +can’t be on a PET without an element “home”). Since a node may be used by +two or more elements located on different PETs, a node may be duplicated +on multiple PETs. When a node is duplicated in this manner, one and only +one of the PETs that contain the node must “own” the node. The user sets +this ownership when they define the nodes during Mesh +creation. When a Field is created on a +Mesh (i.e. on the Mesh nodes), +on each PET the Field is only +created on the nodes which are owned by that PET. This means that the size +of the Field memory on the PET can be smaller than the +number of nodes used to create the Mesh on that PET.

+

Three properties need to be defined for each Mesh node: the global id of the node +(node_ids), node coordinates (node_coords), and which PET owns the node +(node_owners). The node id is a unique (across all PETs) integer attached +to the particular node. It is used to indicate which nodes are the same when +connecting together pieces of the Mesh on different PETs. The node +coordinates indicate the location of a node in space and are used in the Regrid +functionality when interpolating. The node owner indicates which PET is in +charge of the node. This is used when creating a Field on the Mesh to indicate +which PET should contain a Field location for the data.

+

Three properties need to be defined for each Mesh element: the global id of the +element (element_ids), the topology type of the element (element_types), and +which nodes are connected together to form the element (element_conn). The +element id is a unique (across all PETs) integer attached to the +particular element. The element type describes the topology of the element +(e.g. a triangle vs. a quadrilateral). The range of choices for the topology of +the elements in a Mesh are restricted by the Mesh's parametric dimension (e.g. a +Mesh can’t contain a 2D element like a triangle, when its parametric dimension +is 3D), but it can contain any combination of elements appropriate to its +dimension. In particular, in 2D ESMF supports two native element types triangle +and quadrilateral, but also provides support for polygons with any number of +sides. These polygons are represented internally as sets of triangles, but to +the user should behave like other elements. To specify a polygon with more than +four sides, the element type should be set to the number of corners of the +polygon (e.g. element type=6 for a hexagon). The element connectivity indicates +which nodes are to be connected together to form the element. The number of +nodes connected together for each element is implied by the elements topology +type (element_types). It is IMPORTANT to note, that the entries in this list are +NOT the global ids of the nodes, but are indices into the PET local lists +of node info used in the Mesh creation. In other words, the element connectivity +isn’t specified in terms of the global list of nodes, but instead is specified +in terms of the locally described node info. One other important point about +connectivities is that the order of the nodes in the connectivity list of an +element is important. In general, when specifying an element with parametric +dimension 2, the nodes should be given in counterclockwise order around the +element.

+

The three step Mesh creation process starts with a call to the Mesh constructor. +It is then followed by the add_nodes() call to +specify nodes, and then the add_elements() call to +specify elements.

+
#  2.5        8        10 --------11
+#          /     \   /            |
+#  2.1   7         9              12
+#        |         |      5       /
+#        |    4    |            /
+#        |         |          /
+#  1.0   4 ------- 5 ------- 6
+#        |         |  \   3  |
+#        |    1    |    \    |
+#        |         |  2   \  |
+# -0.1   1 ------- 2 ------- 3
+#
+#      -0.1       1.0       2.1   2.5
+#
+#          Node Ids at corners
+#          Element Ids in centers
+
+# Two parametric dimensions, and two spatial dimensions
+mesh = esmpy.Mesh(parametric_dim=2, spatial_dim=2, coord_sys=coord_sys)
+
+num_node = 12
+num_elem = 5
+nodeId = np.array([1,2,3,4,5,6,7,8,9,10,11,12])
+nodeCoord = np.array([-0.1,-0.1,  #node id 1
+                      1.0,-0.1,  #node id 2
+                      2.1,-0.1,  #node id 3
+                      0.1, 1.0,  #node id 4
+                      1.0, 1.0,  #node id 5
+                      2.1, 1.0,  #node id 6
+                      0.1, 2.1,  #node id 7
+                      0.5, 2.5,  #node id 8
+                      1.0, 2.1,  #node id 9
+                      1.5, 2.5,  #node id 10
+                      2.5, 2.5,  #node id 11
+                      2.5, 2.1]) #node id 12
+
+
+nodeOwner = np.zeros(num_node)
+
+elemId = np.array([1,2,3,4,5])
+elemType=np.array([esmpy.MeshElemType.QUAD,
+                   esmpy.MeshElemType.TRI,
+                   esmpy.MeshElemType.TRI, 5, 6])
+
+elemConn=np.array([0,1,4,3,         # elem id 1
+                   1,2,4,           # elem id 2
+                   2,5,4,           # elem id 3
+                   3,4,8,7,6,       # elem id 4
+                   4,5,11,10,9,8])  # elem id 5
+
+mesh.add_nodes(num_node,nodeId,nodeCoord,nodeOwner)
+
+mesh.add_elements(num_elem,elemId,elemType,elemConn)
+
+
+
+
+

Masking

+

There are two types of masking available in Mesh: node masking and element +masking. These both work in a similar manner, but vary slightly in the details +of setting the mask information during Mesh creation.

+

For node masking, the mask information is set using the node_mask parameter. +When a Regrid object is created the mask values arguments src_mask_values and +dst_mask_values can then be used to indicate which particular values set in +the node_mask array indicate that the node should be masked. For example, if +dst_mask_values has been set to 1, then any node in the destination Mesh whose +corresponding node_mask value is 1 will be masked out (a node with any other +value than 1 will not be masked).

+

For element masking, the mask information is set using the element_mask +parameter when adding elements to the Mesh. In a similar manner to node masking, +the mask values parameters to Regrid, src_mask_values and dst_mask_values +can then be used to indicate which particular values set in the element_mask +array indicate that the element should be masked. For example, if +dst_mask_values has been set to 1, then any element in the destination Mesh +whose corresponding element_mask value is 1 will be masked out (an element +with any other value than 1 will not be masked).

+
+
+

Areas

+

Mesh cell areas can be specified using the element_areas parameter to +add_elements().

+

If cell areas are not specified by the user they can be calculated by ESMPy +using get_area().

+
+
+
+

LocStream

+

A LocStream can be used to represent the locations of a set of +data points. For example, in the data assimilation world, LocStreams can be used +to represent a set of observations. The values of the data points are stored +within a Field created using the LocStream. +Refer to the LocStream Class of the +ESMF Reference Manual +for more information.

+

The locations are generally described using Cartesian (x, y, z), or +(lat, lon, radius) coordinates. The coordinates are stored using constructs +called keys. A key is essentially a list of point descriptors, one for each data +point. They may hold other information besides the coordinates - a mask, for +example. They may also hold a second set of coordinates. Keys are referenced by +name. Each key must contain the same number of elements as there are data points +in the LocStream. While there is no assumption in the ordering of the points, +the order chosen must be maintained in each of the keys.

+

A LocStream can be very large. Data assimilation systems might use LocStreams +with up to 10^8 observations, so efficiency is critical. LocStreams can be +created from file.

+

A LocStream is similar to a Mesh in that both are collections of irregularly +positioned points. However, the two structures differ because a Mesh also has +connectivity: each data point represents either a center or corner of a cell. +There is no requirement that the points in a LocStream have connectivity, in +fact there is no requirement that any two points have any particular spatial +relationship at all.

+
locstream = esmpy.LocStream(16, coord_sys=coord_sys)
+
+deg_rad = pi
+if coord_sys == esmpy.CoordSys.SPH_DEG:
+    deg_rad = 180
+
+locstream["ESMF:Lon"] = [0.0, 0.5*deg_rad, 1.5*deg_rad, 2*deg_rad, 0.0, 0.5*deg_rad, 1.5*deg_rad, 2*deg_rad, 0.0, 0.5*deg_rad, 1.5*deg_rad, 2*deg_rad, 0.0, 0.5*deg_rad, 1.5*deg_rad, 2*deg_rad]
+locstream["ESMF:Lat"] = [deg_rad/-2.0, deg_rad/-2.0, deg_rad/-2.0, deg_rad/-2.0, -0.25*deg_rad, -0.25*deg_rad, -0.25*deg_rad, -0.25*deg_rad, 0.25*deg_rad, 0.25*deg_rad, 0.25*deg_rad, 0.25*deg_rad, deg_rad/2.0, deg_rad/2.0, deg_rad/2.0, deg_rad/2.0]
+if domask:
+    locstream["ESMF:Mask"] = np.array([1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], dtype=np.int32)
+
+
+
+
+
+

Create a Grid or Mesh from File

+
+

File Formats

+

ESMPy can create Grid or Mesh objects from NetCDF files in a variety +of formats. A Mesh can be created from files in SCRIP, ESMFMESH, and UGRID +formats. Grid files can be in SCRIP and GRIDSPEC format.

+
+

SCRIP

+

This file format is used by the SCRIP [1], package, grid files that +work with that package should also work here. SCRIP format files are +capable of storing either 2D logically rectangular grids or 2D +unstructured grids. More information can be found in the +ESMF Reference Manual.

+
+
+

ESMFMESH

+

ESMF has a custom unstructured grid file format for describing Meshes. +This format is more compatible than the SCRIP format with the methods +used to create a Mesh object, so less conversion needs to be done to +create a Mesh. The ESMFMESH format is thus more efficient than SCRIP when +used with ESMPy. More information can be found in the +ESMF Reference Manual.

+
+
+

GRIDSPEC

+

GRIDSPEC is an extension to the Climate and Forecast (CF) metadata +conventions for the representation of gridded data for Earth System +Models. ESMPy supports NetCDF files that follow the CF GRIDSPEC +convention to support logically rectangular lat/lon grids. More +information can be found in the +ESMF Reference Manual.

+
+
+

UGRID

+

UGRID is an extension to the CF metadata +conventions for the unstructured grid data model. ESMPy support +NetCDF files that follow the CF UGRID convention for unstructured grids. +More information can be found in the +ESMF Reference Manual.

+
+
+
+

Meshes from File

+

When creating a Mesh from a SCRIP format file, there are a number of +options to control the output Mesh. The data is located at the center +of the grid cell in a SCRIP grid. Therefore, when the Mesh will be +part of a conservative regridding operation, the convert_to_dual +flag must be set to True to properly generate coordinates at the the +cell corners.

+

A Mesh may also be created with boolean flags to specify whether or not to +add an area property to the Mesh add_user_area, or to add a mask +add_mask held by the NetCDF variable indicated in the optional argument, +varname. These argument are only valid for UGRID formatted files. +The mask generated for a Mesh created from file will +have 0 for the masked values and 1 for the unmasked values.

+
+
+

Grids from File

+

A number of optional boolean arguments are also supported to create a +structured Grid from a file. These include is_sphere to indicate whether +the grid is spherical or regional, add_corner_stagger to add the corner +stagger information to the Grid for conservative regridding, and +add_user_area to specify whether to read in the cell area from the +NetCDF file or to calculate them.

+

For GRIDSPEC formated files +there is the add_mask optional argument +to add a mask held by the NetCDF variable indicated in optional +argument, varname, and the coord_names argument to specify the longitude +and latitude variable names in a GRIDSPEC file containing multiple sets of +coordinates.

+

For SCRIP formated files the integer array grid_imask is used to mask out grid cells which should not participate in the regridding.

+

The mask generated for a Grid created from +file (any format) will have 0 for the masked values and 1 for the unmasked values.

+
+
+
+

Regridding

+

The following table describe the regridding methods and options that are +available in ESMPy, the flag that is required to use it and a short description. +More information can be found on these options in the +ESMF Reference Manual.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Class

Description

BILINEAR

Linear regridding in two dimensions

PATCH

Higher-order least squares method

NEAREST_STOD

Nearest source point used for each destination

NEAREST_DTOS

Nearest destination point used for each source

CONSERVE

First-order conservative

CONSERVE_2ND

Second-order conservative

NormType

Normalization options for integral conservation

LineType

Line types for spherical and Cartesian space

UnmappedAction

Unmapped destination point handling options

CoordSys

Spherical grids and pole handling

+
+

Great Circle Cells

+

For Grids and Meshes on a sphere some combinations of interpolation options +(e.g. first and second-order conservative methods) use cells whose edges are +great circles. This section describes some behavior that the user may not expect +from these cells and some potential solutions. A great circle edge isn’t +necessarily the same as a straight line in latitude longitude space. For small +edges, this difference will be small, but for long edges it could be +significant. This means if the user expects cell edges as straight lines in +latitude longitude space, they should avoid using one large cell with long edges +to compute an average over a region (e.g. over an ocean basin).

+

Also, the user should also avoid using cells that contain one edge that runs +half way or more around the earth, because the regrid weight calculation assumes +the edge follows the shorter great circle path. There isn’t a unique great +circle edge defined between points on the exact opposite side of the earth from +one another (antipodal points). However, the user can work around both of these +problem by breaking the long edge into two smaller edges by inserting an extra +node, or by breaking the large target grid cells into two or more smaller grid +cells. This allows the application to resolve the ambiguity in edge direction.

+
+
+
+

Masking

+

Masking is the process whereby parts of a Grid, Mesh or LocStream can be marked to be ignored +during an operation, such as when they are used in regridding. Masking can be used on a Field +created from a regridding source to indicate that certain portions should not be used to generate +regridded data. This is useful, for example, if a portion of the source contains unusable values. +Masking can also be used on a Field created from a regridding destination to indicate that a certain +portion should not receive regridded data. This is useful, for example, when part of the destination +isn’t being used (e.g. the land portion of an ocean grid).

+

The user may mask out points in the source Field or destination Field or both. To do masking the user +sets mask information in the Grid, Mesh, or LocStream upon +which the Fields passed into the Regrid call are built. The src_mask_values and +dst_mask_values arguments to that call can then be used to specify which values in that mask information +indicate that a location should be masked out. For example, if dst_mask_values is set to [1,2], then any +location that has a value of 1 or 2 in the mask information of the Grid, Mesh or LocStream upon which +the destination Field is built will be masked out.

+

Masking behavior differs slightly between regridding methods. For non-conservative regridding methods +(e.g. bilinear or high-order patch), masking is done on points. For these methods, masking a destination +point means that the point will not participate in regridding. For these +methods, masking a source point means that the entire source cell using that point is masked out. +In other words, if any corner point making up a source cell is masked then the cell is masked. +For conservative regridding methods masking is done on cells. +Masking a destination cell means that the cell won’t participate in regridding. +Similarly, masking a source cell means that the cell won’t participate in regridding. +For any type of interpolation method (conservative or non-conservative) +the masking is set on the location upon which the +Fields passed into the regridding call are built. +For example, if Fields built on +StaggerLoc.CENTER are passed into +Regrid +then the masking should also be set on StaggerLoc.CENTER.

+

The mask generated for a Grid, +Mesh or LocStream created +from file will have 0 for the masked values and 1 for the unmasked values.

+
+

Note

+

The Region.SELECT flag to the

+
+

zero_region parameter of Regrid can be used to +maintain Fields values on locations that do not +participate in the regridding operation. This is useful when setting an +uninitialized value to help identify masked locations within the +Fields data.

+
+
+

Numpy Slicing and Indexing

+

Numpy arrays are used to represent Grid, Mesh and LocStream coordinates and Field data, +among other things. Standard numpy conventions for array indexing +and slicing can be expected. There are some exceptions when it comes to fancy +indexing, index arrays, and multi-dimensional slicing. Significant effort has +been put into raising exceptions where inappropriate indexing or slicing +operations are attempted.

+

It is very important to remember that all indexing +and slicing operations apply ONLY to the ESMPy level objects, and these operations +do not propagate down to the lower-level Fortran- and C-based representations +of the ESMF objects. One example of where this could come up is when passing +a Field slice into regridding. The entire original Field will still be run +through the ESMF regridding engine, and only the appropriate portion of +the Field slice will be updated with the regridded values.

+
+

Dimension Ordering

+
+

Warning

+

The underlying ESMF library is built with a mix of Fortran and C/C++ +and follows Fortran conventions with respect to array indexing and +dimension ordering. Some effort has been made to make ESMPy feel more +natural to the Python user where possible. This means that ESMPy uses +0-based indexing, which is translated to the 1-based indexing used by +the ESMPy backend. The only exception to this is NetCDF files that are +generated by ESMPy will continue to use the 1-based indexing from the +underlying ESMF code. Likewise, the dimension ordering still follows +Fortran conventions. This means that longitude comes before latitude, which +also comes before temporal dimensions, when in use.

+
In [1]: import numpy as np
+   ...: import esmpy
+   ...:
+   ...: grid = esmpy.Grid(np.array([3,4]), staggerloc=esmpy.StaggerLoc.CENTER)
+   ...:
+   ...: gridLon = grid.get_coords(0)
+   ...: gridLat = grid.get_coords(1)
+   ...:
+   ...: lon = np.linspace(-120,120,3)
+   ...: lat = np.linspace(-67.5, 67.5,4)
+   ...:
+   ...: lonm, latm = np.meshgrid(lon, lat, indexing='ij')
+   ...:
+   ...: gridLon[:] = lonm
+   ...: gridLat[:] = latm
+   ...:
+
+In [2]: grid.coords[esmpy.StaggerLoc.CENTER][0].shape
+Out[2]: (3, 4)
+
+In [3]: lon.shape
+Out[3]: (3,)
+
+In [4]: lat.shape
+Out[4]: (4,)
+
+In [5]: grid.coords[esmpy.StaggerLoc.CENTER][0]
+Out[5]:
+array([[-120., -120., -120., -120.],
+       [   0.,    0.,    0.,    0.],
+       [ 120.,  120.,  120.,  120.]])
+
+In [6]: grid.coords[esmpy.StaggerLoc.CENTER][1]
+Out[6]:
+array([[-67.5, -22.5,  22.5,  67.5],
+       [-67.5, -22.5,  22.5,  67.5],
+       [-67.5, -22.5,  22.5,  67.5]])
+
+In [7]: field = esmpy.Field(grid, ndbounds=[10]) # create a Field with a time dimension
+
+In [8]: field.data.shape
+Out[8]: (3, 4, 10)
+
+
+
+
+
+
+

Parallel Execution

+

ESMPy is a thin wrapper on top of ESMF, which was designed for high performance +and scalable computing. The ESMF virtual machine is used to manage the available +resources of the execution environment in a layer that is transparent to the +ESMPy user. This allows the full power of the high performance computing +environment to be utilized by the ESMPy user with little use of specialized +parallel programming techniques.

+

ESMPy objects will be distributed across the available computing resources with +no additional parameters required. The Grid, Mesh, LocStream, and Field classes +will all be transparently “parallelized” with no need for user calls to a +message passing interface. Likewise, the Regrid class will compute and apply +the interpolation weights using all available computing resources with no need +for user intervention.

+

However, it is useful to remember that resulting Field values will only be +accessible on certain PETs. The mpi4py package may be necessary for post +processing tasks that require access to global Field values.

+
+

mpirun vs. MPI.Spawn

+

There are a few different options for using ESMPy in a parallel +environment. Using mpirun to specify the desired number of computing cores +is probably the easiest way to start a parallel ESMPy job. Another option is to +call the MPI.Spawn() function from the mpi4py Python package from within a +serial Python script or interpreter. It has been observed that MPI.Spawn() may +not work properly when mpi4py is built with an underlying mpich +library, openmpi has seen better success. A third option is to call mpirun +using a system call from within a serial Python script or interpreter, however +this method is not highly recommended.

+

The following two examples demonstrate how to execute an ESMPy script in +parallel. Any of the scripts found in the examples directory of the ESMPy source +code can be run in parallel using mpirun as well as in serial mode.

+
+

mpirun

+
mpirun -n 4 python hello_world.py
+
+
+
+
+

MPI.Spawn

+
import sys
+from mpi4py import MPI
+
+# Parent
+if len(sys.argv) == 1:
+
+    # Spawn workers
+    comm = MPI.COMM_WORLD.Spawn(
+        sys.executable,
+        args=[sys.argv[0], 'worker'],
+        maxprocs=4)
+
+    # Shutdown
+    comm.Disconnect()
+
+# Worker
+elif sys.argv[1] == 'worker':
+
+    # Connect to parent
+    try:
+        comm = MPI.Comm.Get_parent()
+        rank = comm.Get_rank()
+    except:
+        raise ValueError('Could not connect to parent - ' + usage)
+
+    # worker code goes here, regridding etc..
+    print "Hello World from PET #"+str(rank)
+
+    # Shutdown
+    comm.Disconnect()
+
+# Catch
+else:
+    raise ValueError('Program should be started without arguments')
+
+
+

A more detailed example of using MPI.Spawn() can be found in the Tutorials section +of the documentation.

+
+
+
+
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/appendix.html b/docs/nightly/v8.8.0b03/html/appendix.html new file mode 100644 index 00000000..7eb4a31f --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/appendix.html @@ -0,0 +1,425 @@ + + + + + + + + Appendices — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

Appendices

+
+

Class APIs

+ +
+
+

Named Constants

+
+ +
+
+
+

References

+
+
+
+[1] +

SCRIP: A Spherical Coordinate Remapping and Interpolation Package. http://oceans11.lanl.gov/trac/SCRIP, last accessed on Dec 4, 2015. Los Alamos Software Release LACC 98-45.

+
+
+
+
+
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/examples.html b/docs/nightly/v8.8.0b03/html/examples.html new file mode 100644 index 00000000..ca0f7c77 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/examples.html @@ -0,0 +1,1298 @@ + + + + + + + + Tutorials — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

Tutorials

+
+

Hello World

+
+
import esmpy
+
+# This call enables debug logging
+# esmpy = esmpy.Manager(debug=True)
+
+print ("Hello ESMPy World from PET (processor) {0}!".format(esmpy.local_pet()))
+
+
+
+
+
+

Regridding Helper Functions

+

The following code snippets demonstrate how to build all of the pieces +necessary to regrid data between Fields built on +Grids, Meshes +and LocStreams.

+
+

LocStream Create

+
def create_locstream_spherical_16(coord_sys=esmpy.CoordSys.SPH_DEG, domask=False):
+    """
+    :param coord_sys: the coordinate system of the LocStream
+    :param domask: a boolean to tell whether or not to add a mask
+    :return: LocStream
+    """
+    if esmpy.pet_count() != 1:
+        raise ValueError("processor count must be 1 to use this function")
+
+    locstream = esmpy.LocStream(16, coord_sys=coord_sys)
+
+    deg_rad = pi
+    if coord_sys == esmpy.CoordSys.SPH_DEG:
+        deg_rad = 180
+
+    locstream["ESMF:Lon"] = [0.2*deg_rad, 0.5*deg_rad, 1.5*deg_rad, 1.8*deg_rad, 0.2*deg_rad, 0.5*deg_rad, 1.5*deg_rad, 1.8*deg_rad, 0.2*deg_rad, 0.5*deg_rad, 1.5*deg_rad, 1.8*deg_rad, 0.2*deg_rad, 0.5*deg_rad, 1.5*deg_rad, 1.8*deg_rad]
+    locstream["ESMF:Lat"] = [-0.4*deg_rad, -0.4*deg_rad, -0.4*deg_rad, -0.4*deg_rad, -0.25*deg_rad, -0.25*deg_rad, -0.25*deg_rad, -0.25*deg_rad, 0.25*deg_rad, 0.25*deg_rad, 0.25*deg_rad, 0.25*deg_rad, 0.4*deg_rad, 0.4*deg_rad, 0.4*deg_rad, 0.4*deg_rad]
+    if domask:
+        locstream["ESMF:Mask"] = np.array([1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], dtype=np.int32)
+
+    return locstream
+
+
+
+
+

LocStream Create Parallel

+
def create_locstream_spherical_16_parallel(coord_sys=esmpy.CoordSys.SPH_DEG, domask=False):
+    """
+    :param coord_sys: the coordinate system of the LocStream
+    :param domask: a boolean to tell whether or not to add a mask
+    :return: LocStream
+    """
+    if esmpy.pet_count() != 4:
+        raise ValueError("processor count must be 4 to use this function")
+
+    deg_rad = pi
+    if coord_sys == esmpy.CoordSys.SPH_DEG:
+        deg_rad = 180.0
+
+    locstream = None
+    if esmpy.local_pet() == 0:
+        locstream = esmpy.LocStream(4, coord_sys=coord_sys)
+        locstream["ESMF:Lon"] = [0.2*deg_rad, 0.5*deg_rad, 0.2*deg_rad, 0.5*deg_rad]
+        locstream["ESMF:Lat"] = [-0.4*deg_rad, -0.4*deg_rad, -0.25*deg_rad, -0.25*deg_rad]
+        if domask:
+            locstream["ESMF:Mask"] = np.array([1, 0, 1, 1], dtype=np.int32)
+    elif esmpy.local_pet() == 1:
+        locstream = esmpy.LocStream(4, coord_sys=coord_sys)
+        locstream["ESMF:Lon"] = [1.5*deg_rad, 1.8*deg_rad, 1.5*deg_rad, 1.8*deg_rad]
+        locstream["ESMF:Lat"] = [-0.4*deg_rad, -0.4*deg_rad, -0.25*deg_rad, -0.25*deg_rad]
+        if domask:
+            locstream["ESMF:Mask"] = np.array([0, 1, 1, 1], dtype=np.int32)
+    elif esmpy.local_pet() == 2:
+        locstream = esmpy.LocStream(4, coord_sys=coord_sys)
+        locstream["ESMF:Lon"] = [0.2*deg_rad, 0.5*deg_rad, 0.2*deg_rad, 0.5*deg_rad]
+        locstream["ESMF:Lat"] = [0.25*deg_rad, 0.25*deg_rad, 0.4*deg_rad, 0.4*deg_rad]
+        if domask:
+            locstream["ESMF:Mask"] = np.array([1, 1, 1, 1], dtype=np.int32)
+    elif esmpy.local_pet() == 3:
+        locstream = esmpy.LocStream(4, coord_sys=coord_sys)
+        locstream["ESMF:Lon"] = [1.5*deg_rad, 1.8*deg_rad, 1.5*deg_rad, 1.8*deg_rad]
+        locstream["ESMF:Lat"] = [0.25*deg_rad, 0.25*deg_rad, 0.4*deg_rad, 0.4*deg_rad]
+        if domask:
+            locstream["ESMF:Mask"] = np.array([1, 1, 1, 1], dtype=np.int32)
+
+    return locstream
+
+
+
+
+

Create a 2D Grid

+
+
def grid_create_from_coordinates(xcoords, ycoords, xcorners=False, ycorners=False, corners=False, domask=False, doarea=False, ctk=esmpy.TypeKind.R8):
+    """
+    Create a 2 dimensional Grid using the bounds of the x and y coordiantes.
+    :param xcoords: The 1st dimension or 'x' coordinates at cell centers, as a Python list or numpy Array
+    :param ycoords: The 2nd dimension or 'y' coordinates at cell centers, as a Python list or numpy Array
+    :param xcorners: The 1st dimension or 'x' coordinates at cell corners, as a Python list or numpy Array
+    :param ycorners: The 2nd dimension or 'y' coordinates at cell corners, as a Python list or numpy Array
+    :param domask: boolean to determine whether to set an arbitrary mask or not
+    :param doarea: boolean to determine whether to set an arbitrary area values or not
+    :param ctk: the coordinate typekind
+    :return: grid
+    """
+    [x, y] = [0, 1]
+
+    # create a grid given the number of grid cells in each dimension, the center stagger location is allocated, the
+    # Cartesian coordinate system and type of the coordinates are specified
+    max_index = np.array([len(xcoords), len(ycoords)])
+    grid = esmpy.Grid(max_index, staggerloc=[esmpy.StaggerLoc.CENTER], coord_sys=esmpy.CoordSys.CART, coord_typekind=ctk)
+
+    # set the grid coordinates using numpy arrays, parallel case is handled using grid bounds
+    gridXCenter = grid.get_coords(x)
+    x_par = xcoords[grid.lower_bounds[esmpy.StaggerLoc.CENTER][x]:grid.upper_bounds[esmpy.StaggerLoc.CENTER][x]]
+    gridXCenter[...] = x_par.reshape((x_par.size, 1))
+
+    gridYCenter = grid.get_coords(y)
+    y_par = ycoords[grid.lower_bounds[esmpy.StaggerLoc.CENTER][y]:grid.upper_bounds[esmpy.StaggerLoc.CENTER][y]]
+    gridYCenter[...] = y_par.reshape((1, y_par.size))
+
+    # create grid corners in a slightly different manner to account for the bounds format common in CF-like files
+    if corners:
+        grid.add_coords([esmpy.StaggerLoc.CORNER])
+        lbx = grid.lower_bounds[esmpy.StaggerLoc.CORNER][x]
+        ubx = grid.upper_bounds[esmpy.StaggerLoc.CORNER][x]
+        lby = grid.lower_bounds[esmpy.StaggerLoc.CORNER][y]
+        uby = grid.upper_bounds[esmpy.StaggerLoc.CORNER][y]
+
+        gridXCorner = grid.get_coords(x, staggerloc=esmpy.StaggerLoc.CORNER)
+        for i0 in range(ubx - lbx - 1):
+            gridXCorner[i0, :] = xcorners[i0+lbx, 0]
+        gridXCorner[i0 + 1, :] = xcorners[i0+lbx, 1]
+
+        gridYCorner = grid.get_coords(y, staggerloc=esmpy.StaggerLoc.CORNER)
+        for i1 in range(uby - lby - 1):
+            gridYCorner[:, i1] = ycorners[i1+lby, 0]
+        gridYCorner[:, i1 + 1] = ycorners[i1+lby, 1]
+
+    # add an arbitrary mask
+    if domask:
+        mask = grid.add_item(esmpy.GridItem.MASK)
+        mask[:] = 1
+        mask[np.where((1.75 <= gridXCenter.any() < 2.25) &
+                      (1.75 <= gridYCenter.any() < 2.25))] = 0
+
+    # add arbitrary areas values
+    if doarea:
+        area = grid.add_item(esmpy.GridItem.AREA)
+        area[:] = 5.0
+
+    return grid
+
+
+
+
+
+

Create a 3D Grid

+
+
def grid_create_from_coordinates_3d(xcoords, ycoords, zcoords, xcorners=False, ycorners=False, zcorners=False, corners=False, domask=False, doarea=False):
+    """
+    Create a 3 dimensional Grid using the xcoordinates, ycoordinates and zcoordinates.
+    :param xcoords: The 1st dimension or 'x' coordinates at cell centers, as a Python list or numpy Array
+    :param ycoords: The 2nd dimension or 'y' coordinates at cell centers, as a Python list or numpy Array
+    :param zcoords: The 3rd dimension or 'z' coordinates at cell centers, as a Python list or numpy Array
+    :param xcorners: The 1st dimension or 'x' coordinates at cell corners, as a Python list or numpy Array
+    :param ycorners: The 2nd dimension or 'y' coordinates at cell corners, as a Python list or numpy Array
+    :param zcorners: The 3rd dimension or 'z' coordinates at cell corners, as a Python list or numpy Array
+    :param corners: boolean to determine whether or not to add corner coordinates to this grid
+    :param domask: boolean to determine whether to set an arbitrary mask or not
+    :param doarea: boolean to determine whether to set an arbitrary area values or not
+    :return: grid
+    """
+    [x, y, z] = [0, 1, 2]
+
+    # create a grid given the number of grid cells in each dimension, the center stagger location is allocated and the
+    # Cartesian coordinate system is specified
+    max_index = np.array([len(xcoords), len(ycoords), len(zcoords)])
+    grid = esmpy.Grid(max_index, staggerloc=[esmpy.StaggerLoc.CENTER_VCENTER], coord_sys=esmpy.CoordSys.CART)
+
+    # set the grid coordinates using numpy arrays, parallel case is handled using grid bounds
+    gridXCenter = grid.get_coords(x)
+    x_par = xcoords[grid.lower_bounds[esmpy.StaggerLoc.CENTER_VCENTER][x]:grid.upper_bounds[esmpy.StaggerLoc.CENTER_VCENTER][x]]
+    gridXCenter[...] = x_par.reshape(x_par.size, 1, 1)
+
+    gridYCenter = grid.get_coords(y)
+    y_par = ycoords[grid.lower_bounds[esmpy.StaggerLoc.CENTER_VCENTER][y]:grid.upper_bounds[esmpy.StaggerLoc.CENTER_VCENTER][y]]
+    gridYCenter[...] = y_par.reshape(1, y_par.size, 1)
+
+    gridZCenter = grid.get_coords(z)
+    z_par = zcoords[grid.lower_bounds[esmpy.StaggerLoc.CENTER_VCENTER][z]:grid.upper_bounds[esmpy.StaggerLoc.CENTER_VCENTER][z]]
+    gridZCenter[...] = z_par.reshape(1, 1, z_par.size)
+
+    # create grid corners in a slightly different manner to account for the bounds format common in CF-like files
+    if corners:
+        grid.add_coords([esmpy.StaggerLoc.CORNER_VFACE])
+        lbx = grid.lower_bounds[esmpy.StaggerLoc.CORNER_VFACE][x]
+        ubx = grid.upper_bounds[esmpy.StaggerLoc.CORNER_VFACE][x]
+        lby = grid.lower_bounds[esmpy.StaggerLoc.CORNER_VFACE][y]
+        uby = grid.upper_bounds[esmpy.StaggerLoc.CORNER_VFACE][y]
+        lbz = grid.lower_bounds[esmpy.StaggerLoc.CORNER_VFACE][z]
+        ubz = grid.upper_bounds[esmpy.StaggerLoc.CORNER_VFACE][z]
+
+        gridXCorner = grid.get_coords(x, staggerloc=esmpy.StaggerLoc.CORNER_VFACE)
+        for i0 in range(ubx - lbx - 1):
+            gridXCorner[i0, :, :] = xcorners[i0+lbx, 0]
+        gridXCorner[i0 + 1, :, :] = xcorners[i0+lbx, 1]
+
+        gridYCorner = grid.get_coords(y, staggerloc=esmpy.StaggerLoc.CORNER_VFACE)
+        for i1 in range(uby - lby - 1):
+            gridYCorner[:, i1, :] = ycorners[i1+lby, 0]
+        gridYCorner[:, i1 + 1, :] = ycorners[i1+lby, 1]
+
+        gridZCorner = grid.get_coords(z, staggerloc=esmpy.StaggerLoc.CORNER_VFACE)
+        for i2 in range(ubz - lbz - 1):
+            gridZCorner[:, :, i2] = zcorners[i2+lbz, 0]
+        gridZCorner[:, :, i2 + 1] = zcorners[i2+lbz, 1]
+
+    # add an arbitrary mask
+    if domask:
+        mask = grid.add_item(esmpy.GridItem.MASK)
+        mask[:] = 1
+        mask[np.where((1.75 < gridXCenter.data < 2.25) &
+                      (1.75 < gridYCenter.data < 2.25) &
+                      (1.75 < gridZCenter.data < 2.25))] = 0
+
+    # add arbitrary areas values
+    if doarea:
+        area = grid.add_item(esmpy.GridItem.AREA)
+        area[:] = 5.0
+
+    return grid
+
+
+
+
+
+

Create a Periodic Grid

+
+
def grid_create_from_coordinates_periodic(longitudes, latitudes, lon_corners=False, lat_corners=False, corners=False, domask=False):
+    """
+    Create a 2 dimensional periodic Grid using the 'longitudes' and 'latitudes'.
+    :param longitudes: longitude coordinate values at cell centers
+    :param latitudes: latitude coordinate values at cell centers
+    :param lon_corners: longitude coordinate values at cell corners
+    :param lat_corners: latitude coordinate values at cell corners
+    :param corners: boolean to determine whether or not to add corner coordinates to this grid
+    :param domask: boolean to determine whether to set an arbitrary mask or not
+    :return: grid
+    """
+    [lon, lat] = [0, 1]
+
+    # create a grid given the number of grid cells in each dimension the center stagger location is allocated
+    max_index = np.array([len(longitudes), len(latitudes)])
+    grid = esmpy.Grid(max_index, num_peri_dims=1, staggerloc=[esmpy.StaggerLoc.CENTER])
+
+    # set the grid coordinates using numpy arrays, parallel case is handled using grid bounds
+    gridXCenter = grid.get_coords(lon)
+    lon_par = longitudes[grid.lower_bounds[esmpy.StaggerLoc.CENTER][lon]:grid.upper_bounds[esmpy.StaggerLoc.CENTER][lon]]
+    gridXCenter[...] = lon_par.reshape((lon_par.size, 1))
+
+    gridYCenter = grid.get_coords(lat)
+    lat_par = latitudes[grid.lower_bounds[esmpy.StaggerLoc.CENTER][lat]:grid.upper_bounds[esmpy.StaggerLoc.CENTER][lat]]
+    gridYCenter[...] = lat_par.reshape((1, lat_par.size))
+
+    # create grid corners in a slightly different manner to account for the bounds format common in CF-like files
+    if corners:
+        grid.add_coords([esmpy.StaggerLoc.CORNER])
+        lbx = grid.lower_bounds[esmpy.StaggerLoc.CORNER][lon]
+        ubx = grid.upper_bounds[esmpy.StaggerLoc.CORNER][lon]
+        lby = grid.lower_bounds[esmpy.StaggerLoc.CORNER][lat]
+        uby = grid.upper_bounds[esmpy.StaggerLoc.CORNER][lat]
+
+        gridXCorner = grid.get_coords(lon, staggerloc=esmpy.StaggerLoc.CORNER)
+        for i0 in range(ubx - lbx - 1):
+            gridXCorner[i0, :] = lon_corners[i0+lbx, 0]
+        gridXCorner[i0 + 1, :] = lon_corners[i0+lbx, 1]
+
+        gridYCorner = grid.get_coords(lat, staggerloc=esmpy.StaggerLoc.CORNER)
+        for i1 in range(uby - lby - 1):
+            gridYCorner[:, i1] = lat_corners[i1+lby, 0]
+        gridYCorner[:, i1 + 1] = lat_corners[i1+lby, 1]
+
+    # add an arbitrary mask
+    if domask:
+        mask = grid.add_item(esmpy.GridItem.MASK)
+        mask[:] = 1
+        mask[np.where((1.75 <= gridXCenter.any() < 2.25) &
+                      (1.75 <= gridYCenter.any() < 2.25))] = 0
+
+    return grid
+
+
+
+
+
+

Create a 5 Element Mesh

+
+
def mesh_create_5():
+    """
+    PRECONDITIONS: None
+    POSTCONDITIONS: A 5 element Mesh has been created.    
+    RETURN VALUES: \n Mesh :: mesh \n
+    
+      4.0   31 ------ 32 ------ 33
+            |         |  22  /   |
+            |    21   |     /    |
+            |         |   /  23  |
+      2.0   21 ------ 22 ------ 23
+            |         |          |
+            |    11   |    12    |
+            |         |          |
+      0.0   11 ------ 12 ------ 13
+    
+           0.0       2.0        4.0
+    
+          Node Ids at corners
+          Element Ids in centers
+    
+    Note: This mesh is not parallel, it can only be used in serial
+    """
+    # Two parametric dimensions, and two spatial dimensions
+    mesh = esmpy.Mesh(parametric_dim=2, spatial_dim=2)
+    
+    num_node = 9
+    num_elem = 5
+    nodeId = np.array([11,12,13,21,22,23,31,32,33])
+    nodeCoord = np.array([0.0,0.0,  # node 11
+                          2.0,0.0,  # node 12
+                          4.0,0.0,  # node 13
+                          0.0,2.0,  # node 21
+                          2.0,2.0,  # node 22
+                          4.0,2.0,  # node 23
+                          0.0,4.0,  # node 31
+                          2.0,4.0,  # node 32
+                          4.0,4.0]) # node 33
+    nodeOwner = np.zeros(num_node)
+
+    elemId = np.array([11,12,21,22,23])
+    elemType=np.array([esmpy.MeshElemType.QUAD,
+                       esmpy.MeshElemType.QUAD,
+                       esmpy.MeshElemType.QUAD,
+                       esmpy.MeshElemType.TRI,
+                       esmpy.MeshElemType.TRI])
+    elemConn=np.array([0,1,4,3, # element 11
+                       1,2,5,4, # element 12
+                       3,4,7,6, # element 21
+                       4,8,7,   # element 22
+                       4,5,8])  # element 23
+    elemCoord = np.array([1.0, 1.0,
+                          3.0, 1.0,
+                          1.0, 3.0,
+                          2.5, 3.5,
+                          3.5, 2.5])
+
+    mesh.add_nodes(num_node,nodeId,nodeCoord,nodeOwner)
+
+    mesh.add_elements(num_elem,elemId,elemType,elemConn, element_coords=elemCoord)
+
+    return mesh, nodeCoord, nodeOwner, elemType, elemConn, elemCoord
+
+
+
+
+
+

Create a Field

+
+
    def create_field(gml, name):
+        '''
+        PRECONDITIONS: An Grid, Mesh or LocStream has been created, and 'name' is a string that
+                       will be used to initialize the name of a new Field.\n
+        POSTCONDITIONS: A Field has been created.\n
+        RETURN VALUES: \n Field :: field \n
+        '''
+        field = Field(gml, name=name)
+
+        return field
+
+
+
+
+
+

Initialize an Analytic Field

+
+
def initialize_field_grid_periodic(field):
+    """
+    PRECONDITIONS: A Field has been created as 'field' with a 'grid'
+                   where coordinates have been set on both 
+                   the center and corner stagger locations. \n
+    POSTCONDITIONS: The 'field' has been initialized to an analytic 
+                    field.\n
+    RETURN VALUES: \n Field :: field \n
+    """
+    DEG2RAD = 3.141592653589793/180.0
+
+    # get the coordinate pointers and set the coordinates
+    [x,y] = [0, 1]
+    gridXCoord = field.grid.get_coords(x, esmpy.StaggerLoc.CENTER)
+    gridYCoord = field.grid.get_coords(y, esmpy.StaggerLoc.CENTER)
+
+    field.data[:] = 2.0 + np.cos(DEG2RAD*gridXCoord)**2 * \
+                          np.cos(2.0*DEG2RAD*(90.0 - gridYCoord))
+
+    return field
+
+
+
+
+
+

Run ESMPy Regridding

+
+
    def run_regridding(srcfield, dstfield, srcfracfield, dstfracfield):
+        # This is for documentation. Do not modify.
+        '''
+        PRECONDITIONS: Two Fields have been created and a regridding
+                       operation is desired from 'srcfield' to 'dstfield'.
+                       The 'srcfracfield' and 'dstfractfield' are Fields
+                       created to hold the fractions of the source and
+                       destination fields which contribute to conservative
+                       regridding.\n
+        POSTCONDITIONS: A regridding operation has set the data on
+                        'dstfield', 'srcfracfield', and 'dstfracfield'.\n
+        RETURN VALUES: \n Field :: dstfield \n
+                          Field :: srcfracfield \n
+                          Field :: dstfracfield \n
+        '''
+        # call the regridding functions
+        regridSrc2Dst = esmpy.Regrid(srcfield, dstfield,
+                                    regrid_method=esmpy.RegridMethod.CONSERVE,
+                                    unmapped_action=esmpy.UnmappedAction.ERROR,
+                                    src_frac_field=srcfracfield,
+                                    dst_frac_field=dstfracfield)
+        dstfield = regridSrc2Dst(srcfield, dstfield)
+
+        return dstfield, srcfracfield, dstfracfield
+
+
+
+
+
+

Compute Field Mass

+
+
def compute_mass_grid(valuefield, dofrac=False, fracfield=None,
+                      uninitval=422397696.):
+    """
+    PRECONDITIONS: 'fracfield' contains the fractions of each cell
+                   which contributed to a regridding operation involving
+                   'valuefield.  'dofrac' is a boolean value that gives 
+                   the option to not use the 'fracfield'.\n
+    POSTCONDITIONS: The mass of the data field is computed.\n
+    RETURN VALUES: float :: mass \n
+    """
+    mass = 0.0
+    areafield = esmpy.Field(valuefield.grid, name='areafield')
+    areafield.get_area()
+
+    ind = np.where(valuefield.data != uninitval)
+
+    if dofrac:
+        mass = np.sum(areafield.data[ind] * valuefield.data[ind] * fracfield.data[ind])
+    else:
+        mass = np.sum(areafield.data[ind] * valuefield.data[ind])
+
+    return mass
+
+
+
+
+
+
+

Regridding

+

The following stand alone scripts demonstrate how to use regridding between +Fields built on +Grids, Meshes +and LocStreams. These scripts +can be run in serial or parallel with no modification.

+
+

Grid, Mesh and Field Created from File

+
+
# This example demonstrates how to create ESMPy Grid, Mesh and Field objects 
+# from file and use them for regridding.
+
+
+import os
+import esmpy
+
+from esmpy.util.cache_data import DATA_DIR
+from esmpy.util.exceptions import DataMissing
+
+# The data files can be retrieved from the ESMF data repository by uncommenting the
+# following block of code:
+#
+# from esmpy.util.cache_data import cache_data_file
+# cache_data_file(os.path.join(DATA_DIR, "so_Omon_GISS-E2.nc"))
+# cache_data_file(os.path.join(DATA_DIR, "mpas_uniform_10242_dual_counterclockwise.nc"))
+
+# This call enables debug logging
+# esmpy.Manager(debug=True)
+
+datafile = os.path.join(DATA_DIR, "so_Omon_GISS-E2.nc")
+if not os.path.exists(datafile):
+    raise DataMissing("Data not available, try 'make download'.")
+meshfile = os.path.join(DATA_DIR, "mpas_uniform_10242_dual_counterclockwise.nc")
+if not os.path.exists(meshfile):
+    raise DataMissing("Data not available, try 'make download'.")
+
+
+# Create a  global grid from a GRIDSPEC formatted file
+grid = esmpy.Grid(filename=os.path.join(DATA_DIR, datafile),
+                 filetype=esmpy.FileFormat.GRIDSPEC)
+
+# Create a field on the centers of the grid, with extra dimensions
+srcfield = esmpy.Field(grid, staggerloc=esmpy.StaggerLoc.CENTER, ndbounds=[33, 2])
+
+# Read the field data from file
+srcfield.read(filename=os.path.join(DATA_DIR, datafile),
+           variable="so", timeslice=2)
+
+# Create an ESMF formatted unstructured mesh with clockwise cells removed
+mesh = esmpy.Mesh(filename=os.path.join(DATA_DIR, meshfile),
+                 filetype=esmpy.FileFormat.ESMFMESH)
+
+# Create a field on the nodes of the mesh
+dstfield = esmpy.Field(mesh, meshloc=esmpy.MeshLoc.NODE, ndbounds=[33, 2])
+
+dstfield.data[:] = 1e20
+
+# compute the weight matrix for regridding
+regrid = esmpy.Regrid(srcfield, dstfield,
+                     regrid_method=esmpy.RegridMethod.BILINEAR,
+                     unmapped_action=esmpy.UnmappedAction.IGNORE)
+
+# calculate the regridding from source to destination field
+dstfield = regrid(srcfield, dstfield)
+
+if esmpy.local_pet() == 0:
+    print ("Fields created from file regridded successfully :)")
+
+
+
+
+
+

Read and Write a Weight File

+
+
# This example demonstrates how to regrid between a Grid and a Mesh.
+
+
+import esmpy
+import numpy
+
+import os
+
+import esmpy.util.helpers as helpers
+import esmpy.api.constants as constants
+
+
+# This call enables debug logging
+mg = esmpy.Manager(debug=True)
+
+# ESMPy uses Fortran style dimension ordering (as of November 2017)
+[lat,lon] = [1,0]
+
+# Create the source grid from memory with periodic dimension specified.
+lons = numpy.arange(5, 350.1, 10)
+lats  = numpy.arange(-85, 85.1, 10)
+srcgrid = esmpy.Grid(numpy.array([lons.size, lats.size]),
+                    coord_sys=esmpy.CoordSys.SPH_DEG,
+                    staggerloc=esmpy.StaggerLoc.CENTER,
+                    num_peri_dims=1, periodic_dim=0, pole_dim=1)
+
+# Get and set the source grid coordinates.
+srcGridCoordLon = srcgrid.get_coords(lon)
+srcGridCoordLat = srcgrid.get_coords(lat)
+
+slons_par = lons[srcgrid.lower_bounds[esmpy.StaggerLoc.CENTER][0]:srcgrid.upper_bounds[esmpy.StaggerLoc.CENTER][0]]
+slats_par = lats[srcgrid.lower_bounds[esmpy.StaggerLoc.CENTER][1]:srcgrid.upper_bounds[esmpy.StaggerLoc.CENTER][1]]
+
+# make sure to use indexing='ij' as ESMPy backend uses matrix indexing (not Cartesian)
+lonm, latm = numpy.meshgrid(slons_par, slats_par, indexing='ij')
+
+srcGridCoordLon[:] = lonm
+srcGridCoordLat[:] = latm
+
+# Create the dest grid from memory with periodic dimension specified.
+lons = numpy.arange(2.5, 357.6, 5)
+lats = numpy.arange(-87.5, 87.6, 5)
+dstgrid = esmpy.Grid(numpy.array([lons.size, lats.size]),
+                    coord_sys=esmpy.CoordSys.SPH_DEG,
+                    staggerloc=esmpy.StaggerLoc.CENTER,
+                    num_peri_dims=1, periodic_dim=1, pole_dim=0)
+
+# Get and set the source grid coordinates.
+dstGridCoordLat = dstgrid.get_coords(lat)
+dstGridCoordLon = dstgrid.get_coords(lon)
+
+dlons_par = lons[dstgrid.lower_bounds[esmpy.StaggerLoc.CENTER][0]:dstgrid.upper_bounds[esmpy.StaggerLoc.CENTER][0]]
+dlats_par = lats[dstgrid.lower_bounds[esmpy.StaggerLoc.CENTER][1]:dstgrid.upper_bounds[esmpy.StaggerLoc.CENTER][1]]
+
+# make sure to use indexing='ij' as ESMPy backend uses matrix indexing (not Cartesian)
+lonm, latm = numpy.meshgrid(dlons_par, dlats_par, indexing='ij')
+
+dstGridCoordLon[:] = lonm
+dstGridCoordLat[:] = latm
+
+# Create a field on the centers of the source grid with the mask applied.
+srcfield = esmpy.Field(srcgrid, name="srcfield", staggerloc=esmpy.StaggerLoc.CENTER)
+
+# Create a field on the centers of the source grid with the mask applied.
+dstfield = esmpy.Field(dstgrid, name="dstfield", staggerloc=esmpy.StaggerLoc.CENTER)
+xctfield = esmpy.Field(dstgrid, name="xctfield", staggerloc=esmpy.StaggerLoc.CENTER)
+
+gridLon = srcfield.grid.get_coords(lon, esmpy.StaggerLoc.CENTER)
+gridLat = srcfield.grid.get_coords(lat, esmpy.StaggerLoc.CENTER)
+
+# wave = lambda x,k:  numpy.sin(x*k*numpy.pi/180.0)
+# srcfield.data[...] = numpy.outer(wave(slons_par,3), wave(slats_par,3)) + 2
+
+srcfield.data[:,:] = 2.0 + numpy.cos(numpy.radians(srcGridCoordLat)[...])**2 * \
+                           numpy.cos(2.0*numpy.radians(srcGridCoordLon)[...])
+
+# wave = lambda x,k:  numpy.sin(x*k*numpy.pi/180.0)
+# xctfield.data[...] = numpy.outer(wave(dlons_par,3), wave(dlats_par,3)) + 2
+
+xctfield.data[:,:] = 2.0 + numpy.cos(numpy.radians(dstGridCoordLat)[...])**2 * \
+                           numpy.cos(2.0*numpy.radians(dstGridCoordLon)[...])
+
+dstfield.data[:] = 1e20
+
+# write regridding weights to file
+filename = "esmpy_example_weight_file.nc"
+if esmpy.local_pet() == 0:
+    if os.path.isfile(
+        os.path.join(os.getcwd(), filename)):
+        os.remove(os.path.join(os.getcwd(), filename))
+
+mg.barrier()
+regrid = esmpy.Regrid(srcfield, dstfield, filename=filename,
+                     regrid_method=esmpy.RegridMethod.BILINEAR,
+                     unmapped_action=esmpy.UnmappedAction.IGNORE)
+
+
+# # create a regrid object from file
+regrid = esmpy.RegridFromFile(srcfield, dstfield, filename)
+
+# calculate the regridding from source to destination field
+dstfield = regrid(srcfield, dstfield)
+
+# compute the mean relative error
+num_nodes = numpy.prod(xctfield.data.shape[:])
+relerr = 0
+meanrelerr = 0
+if num_nodes != 0:
+    relerr = numpy.sum(numpy.abs(dstfield.data - xctfield.data) /
+                       numpy.abs(xctfield.data))
+    meanrelerr = relerr / num_nodes
+
+# handle the parallel case
+if esmpy.pet_count() > 1:
+    relerr = helpers.reduce_val(relerr, op=constants.Reduce.SUM)
+    num_nodes = helpers.reduce_val(num_nodes, op=constants.Reduce.SUM)
+
+# output the results from one processor only
+if esmpy.local_pet() == 0:
+    meanrelerr = relerr / num_nodes
+    print ("ESMPy Grid Mesh Regridding Example")
+    print ("  interpolation mean relative error = {0}".format(meanrelerr))
+
+    if os.path.isfile(os.path.join(os.getcwd(), filename)):
+        os.remove(os.path.join(os.getcwd(), filename))
+
+# set to 1 to output results
+# if esmpy.pet_count() == 0:
+#     import matplotlib.pyplot as plt
+#     fig = plt.figure(1, (15, 6))
+#     fig.suptitle('ESMPy Periodic Grids', fontsize=14, fontweight='bold')
+# 
+#     ax = fig.add_subplot(1, 2, 1)
+#     im = ax.imshow(srcfield.data, vmin=1, vmax=3, cmap='gist_ncar', aspect='auto',
+#                    extent=[min(slons_par), max(slons_par), min(slats_par), max(slats_par)])
+#     ax.set_xbound(lower=min(slons_par), upper=max(slons_par))
+#     ax.set_ybound(lower=min(slats_par), upper=max(slats_par))
+#     ax.set_xlabel("Longitude")
+#     ax.set_ylabel("Latitude")
+#     ax.set_title("Source Data")
+# 
+#     ax = fig.add_subplot(1, 2, 2)
+#     im = ax.imshow(dstfield.data, vmin=1, vmax=3, cmap='gist_ncar', aspect='auto',
+#                    extent=[min(dlons_par), max(dlons_par), min(dlats_par), max(dlats_par)])
+#     ax.set_xlabel("Longitude")
+#     ax.set_ylabel("Latitude")
+#     ax.set_title("Regrid Solution")
+# 
+#     fig.subplots_adjust(right=0.8)
+#     cbar_ax = fig.add_axes([0.9, 0.1, 0.01, 0.8])
+#     fig.colorbar(im, cax=cbar_ax)
+# 
+#     plt.show()
+
+
+
+
+
+

Grid to LocStream

+
+
# This example demonstrates how to regrid between a Grid and a LocStream.
+
+import esmpy
+import numpy
+
+import os
+
+import esmpy.util.helpers as helpers
+import esmpy.api.constants as constants
+from esmpy.util.cache_data import DATA_DIR
+from esmpy.util.exceptions import DataMissing
+
+# The data files can be retrieved from the ESMF data repository by uncommenting the
+# following block of code:
+#
+# from esmpy.util.cache_data import cache_data_file
+# cache_data_file(os.path.join(DATA_DIR, "ll1deg_grid.nc"))
+
+# This call enables debug logging
+esmpy.Manager(debug=True)
+
+grid1 = os.path.join(DATA_DIR, "ll1deg_grid.nc")
+if not os.path.exists(grid1):
+    raise DataMissing("Data not available, try 'make download'.")
+
+from esmpy.util.locstream_utilities import create_locstream_spherical_16, create_locstream_spherical_16_parallel
+coord_sys=esmpy.CoordSys.SPH_DEG
+domask=True
+if esmpy.pet_count() == 1:
+    locstream = create_locstream_spherical_16(coord_sys=coord_sys, domask=domask)
+else:
+    locstream = create_locstream_spherical_16_parallel(coord_sys=coord_sys, domask=domask)
+
+grid = esmpy.Grid(filename=grid1, filetype=esmpy.FileFormat.SCRIP)
+
+# create a field
+srcfield = esmpy.Field(grid, name='srcfield')
+
+dstfield = esmpy.Field(locstream, name='dstfield')
+xctfield = esmpy.Field(locstream, name='xctfield')
+
+# initialize the fields
+[x, y] = [0, 1]
+deg2rad = 3.14159/180
+
+gridXCoord = srcfield.grid.get_coords(x)
+gridYCoord = srcfield.grid.get_coords(y)
+srcfield.data[...] = 10.0 + numpy.cos(gridXCoord * deg2rad) ** 2 + numpy.cos(2 * gridYCoord * deg2rad)
+
+gridXCoord = locstream["ESMF:Lon"]
+gridYCoord = locstream["ESMF:Lat"]
+if coord_sys == esmpy.CoordSys.SPH_DEG:
+    xctfield.data[...] = 10.0 + numpy.cos(gridXCoord * deg2rad) ** 2 + numpy.cos(2 * gridYCoord * deg2rad)
+elif coord_sys == esmpy.CoordSys.SPH_RAD:
+    xctfield.data[...] = 10.0 + numpy.cos(gridXCoord) ** 2 + numpy.cos(2 * gridYCoord)
+else:
+    raise ValueError("coordsys value does not work in this example")
+
+dstfield.data[...] = 1e20
+
+# create an object to regrid data from the source to the destination field
+dst_mask_values=None
+if domask:
+    dst_mask_values=numpy.array([0])
+
+regrid = esmpy.Regrid(srcfield, dstfield,
+                     regrid_method=esmpy.RegridMethod.BILINEAR,
+                     unmapped_action=esmpy.UnmappedAction.ERROR,
+                     dst_mask_values=dst_mask_values)
+
+# do the regridding from source to destination field
+dstfield = regrid(srcfield, dstfield, zero_region=esmpy.Region.SELECT)
+
+# compute the mean relative error
+num_nodes = numpy.prod(xctfield.data.shape[:])
+relerr = 0
+meanrelerr = 0
+
+dstfield = numpy.ravel(dstfield.data)
+xctfield = numpy.ravel(xctfield.data)
+
+if num_nodes != 0:
+    ind = numpy.where((dstfield != 1e20) & (xctfield != 0))[0]
+    relerr = numpy.sum(numpy.abs(dstfield[ind] - xctfield[ind]) / numpy.abs(xctfield[ind]))
+    meanrelerr = relerr / num_nodes
+
+# handle the parallel case
+if esmpy.pet_count() > 1:
+    relerr = helpers.reduce_val(relerr, op=constants.Reduce.SUM)
+    num_nodes = helpers.reduce_val(num_nodes, op=constants.Reduce.SUM)
+
+# output the results from one processor only
+if esmpy.local_pet() == 0:
+    meanrelerr = relerr / num_nodes
+    print ("ESMPy Grid LocStream Regridding Example")
+    print ("  interpolation mean relative error = {0}".format(meanrelerr))
+
+    assert (meanrelerr < 5e-6)
+
+
+
+
+
+

Mesh to LocStream

+
+
# This example demonstrates how to regrid between a mesh and a locstream.
+
+import esmpy
+import numpy
+
+import esmpy.util.helpers as helpers
+import esmpy.api.constants as constants
+
+# This call enables debug logging
+# esmpy.Manager(debug=True)
+
+from esmpy.util.mesh_utilities import mesh_create_5, mesh_create_5_parallel
+from esmpy.util.locstream_utilities import create_locstream_16, create_locstream_16_parallel
+if esmpy.pet_count() == 1:
+    mesh, _, _, _, _, _ = mesh_create_5()
+    locstream = create_locstream_16()
+else:
+    mesh, _, _, _, _ = mesh_create_5_parallel()
+    locstream = create_locstream_16_parallel()
+
+# create a field
+srcfield = esmpy.Field(mesh, name='srcfield')#, meshloc=esmpy.MeshLoc.ELEMENT)
+
+# create a field on the locstream
+dstfield = esmpy.Field(locstream, name='dstfield')
+xctfield = esmpy.Field(locstream, name='xctfield')
+
+# initialize the fields
+[x, y] = [0, 1]
+deg2rad = 3.14159/180
+
+gridXCoord = srcfield.grid.get_coords(x)
+gridYCoord = srcfield.grid.get_coords(y)
+srcfield.data[...] = 10.0 + (gridXCoord * deg2rad) ** 2 + (gridYCoord * deg2rad) ** 2
+
+gridXCoord = locstream["ESMF:X"]
+gridYCoord = locstream["ESMF:Y"]
+xctfield.data[...] = 10.0 + (gridXCoord * deg2rad) ** 2 + (gridYCoord * deg2rad) ** 2
+
+dstfield.data[...] = 1e20
+
+# create an object to regrid data from the source to the destination field
+# TODO: this example seems to fail occasionally with UnmappedAction.ERROR, probably due to a tolerance issue - ask Bob
+regrid = esmpy.Regrid(srcfield=srcfield, dstfield=dstfield, regrid_method=esmpy.RegridMethod.BILINEAR,
+                     unmapped_action=esmpy.UnmappedAction.IGNORE)
+
+# do the regridding from source to destination field
+dstfield = regrid(srcfield, dstfield)
+
+# compute the mean relative error
+num_nodes = numpy.prod(xctfield.data.shape[:])
+relerr = 0
+meanrelerr = 0
+if num_nodes != 0:
+    ind = numpy.where((dstfield.data != 1e20) & (xctfield.data != 0))[0]
+    relerr = numpy.sum(numpy.abs(dstfield.data[ind] - xctfield.data[ind]) / numpy.abs(xctfield.data[ind]))
+    meanrelerr = relerr / num_nodes
+
+# handle the parallel case
+if esmpy.pet_count() > 1:
+    relerr = helpers.reduce_val(relerr, op=constants.Reduce.SUM)
+    num_nodes = helpers.reduce_val(num_nodes, op=constants.Reduce.SUM)
+
+# output the results from one processor only
+if esmpy.local_pet() == 0:
+    meanrelerr = relerr / num_nodes
+    print ("ESMPy Grid Mesh Regridding Example")
+    print ("  interpolation mean relative error = {0}".format(meanrelerr))
+
+    assert (meanrelerr < 3e-5)
+
+
+
+
+
+

LocStream to Grid

+
+
# This example demonstrates how to regrid between a LocStream and a Grid.
+
+import esmpy
+import numpy
+
+import os
+
+import esmpy.util.helpers as helpers
+import esmpy.api.constants as constants
+from esmpy.util.cache_data import DATA_DIR
+from esmpy.util.exceptions import DataMissing
+
+# The data files can be retrieved from the ESMF data repository by uncommenting the
+# following block of code:
+#
+# from esmpy.util.cache_data import cache_data_file
+# cache_data_file(os.path.join(DATA_DIR, "ll1deg_grid.nc"))
+
+# This call enables debug logging
+esmpy.Manager(debug=True)
+
+grid1 = os.path.join(DATA_DIR, "ll1deg_grid.nc")
+if not os.path.exists(grid1):
+    raise DataMissing("Data not available, try 'make download'.")
+
+grid = esmpy.Grid(filename=grid1, filetype=esmpy.FileFormat.SCRIP)
+
+from esmpy.util.locstream_utilities import create_locstream_spherical_16, create_locstream_spherical_16_parallel
+coord_sys=esmpy.CoordSys.SPH_DEG
+domask=True
+if esmpy.pet_count() == 1:
+    locstream = create_locstream_spherical_16(coord_sys=coord_sys, domask=domask)
+else:
+    locstream = create_locstream_spherical_16_parallel(coord_sys=coord_sys, domask=domask)
+
+# create a field
+srcfield = esmpy.Field(locstream, name='srcfield')
+
+dstfield = esmpy.Field(grid, name='dstfield')
+xctfield = esmpy.Field(grid, name='xctfield')
+
+# initialize the fields
+[x, y] = [0, 1]
+deg2rad = 3.14159/180
+
+gridXCoord = locstream["ESMF:Lon"]
+gridYCoord = locstream["ESMF:Lat"]
+if coord_sys == esmpy.CoordSys.SPH_DEG:
+    srcfield.data[...] = 10.0 + numpy.cos(gridXCoord * deg2rad) ** 2 + numpy.cos(2 * gridYCoord * deg2rad)
+elif coord_sys == esmpy.CoordSys.SPH_RAD:
+    srcfield.data[...] = 10.0 + numpy.cos(gridXCoord) ** 2 + numpy.cos(2 * gridYCoord)
+else:
+    raise ValueError("coordsys value does not apply in this example")
+
+gridXCoord = xctfield.grid.get_coords(x)
+gridYCoord = xctfield.grid.get_coords(y)
+xctfield.data[...] = 10.0 + numpy.cos(gridXCoord * deg2rad) ** 2 + numpy.cos(2 * gridYCoord * deg2rad)
+
+
+dstfield.data[...] = 1e20
+
+# create an object to regrid data from the source to the destination field
+mask_values=None
+if domask:
+    mask_values=numpy.array([0])
+
+regrid = esmpy.Regrid(srcfield, dstfield,
+                     regrid_method=esmpy.RegridMethod.NEAREST_DTOS,
+                     unmapped_action=esmpy.UnmappedAction.ERROR,
+                     src_mask_values=mask_values)
+
+# do the regridding from source to destination field
+dstfield = regrid(srcfield, dstfield, zero_region=esmpy.Region.SELECT)
+
+# compute the mean relative error
+from operator import mul
+num_nodes = numpy.prod(xctfield.data.shape[:])
+relerr = 0
+meanrelerr = 0
+
+dstfield = numpy.ravel(dstfield.data)
+xctfield = numpy.ravel(xctfield.data)
+
+if num_nodes != 0:
+    ind = numpy.where((dstfield != 1e20) & (xctfield != 0))[0]
+    relerr = numpy.sum(numpy.abs(dstfield[ind] - xctfield[ind]) / numpy.abs(xctfield[ind]))
+    meanrelerr = relerr / num_nodes
+
+# handle the parallel case
+if esmpy.pet_count() > 1:
+    relerr = helpers.reduce_val(relerr, op=constants.Reduce.SUM)
+    num_nodes = helpers.reduce_val(num_nodes, op=constants.Reduce.SUM)
+
+# output the results from one processor only
+if esmpy.local_pet() == 0:
+    meanrelerr = relerr / num_nodes
+    print ("ESMPy LocStream Grid Regridding Example")
+    print ("  interpolation mean relative error = {0}".format(meanrelerr))
+
+    assert (meanrelerr < 4e-7)
+
+
+
+
+
+

Using MPI.Spawn() from a Serial Python Driver

+
+
# This example demonstrates how to call ESMPy regridding as a parallel
+# subprocess spawned using mpi4py from a serial Python driver.
+#
+# NOTE: MPI.COMM_WORLD.Spawn does not seem to work for mpi4py installations
+#       installations built with mpich, however openmpi does work (July 2016).
+#
+
+import numpy
+from mpi4py import MPI
+import sys, os
+
+from esmpy.util.cache_data import DATA_DIR
+from esmpy.util.exceptions import DataMissing
+
+# The data files can be retrieved from the ESMF data repository by uncommenting the
+# following block of code:
+#
+# from esmpy.util.cache_data import cache_data_file
+# cache_data_file(os.path.join(DATA_DIR, "ll1deg_grid.nc"))
+# cache_data_file(os.path.join(DATA_DIR, "mpas_uniform_10242_dual_counterclockwise.nc"))
+
+
+def regrid():
+    try:
+        import esmpy
+    except:
+        raise ImportError("ESMF is not available on this machine")
+
+    grid1 = os.path.join(DATA_DIR, "ll1deg_grid.nc")
+    if not os.path.exists(grid1):
+        raise DataMissing("Data not available, try 'make download'.")
+
+    grid2 = os.path.join(DATA_DIR, "mpas_uniform_10242_dual_counterclockwise.nc")
+    if not os.path.exists(grid2):
+        raise DataMissing("Data not available, try 'make download'.")
+
+    # Create a uniform global latlon grid from a SCRIP formatted file
+    grid = esmpy.Grid(filename=grid1, filetype=esmpy.FileFormat.SCRIP)
+    # NOTE: corners are needed for conservative regridding
+    # grid = esmpy.Grid(filename=grid1, filetype=esmpy.FileFormat.SCRIP,
+    #                  add_corner_stagger=True)
+
+    # create a field on the center stagger locations of the source grid
+    srcfield = esmpy.Field(grid, name='srcfield',
+                          staggerloc=esmpy.StaggerLoc.CENTER)
+
+    # create an ESMF formatted unstructured mesh with clockwise cells removed
+    mesh = esmpy.Mesh(filename=grid2, filetype=esmpy.FileFormat.ESMFMESH)
+
+    # create a field on the nodes of the destination mesh
+    dstfield = esmpy.Field(mesh, name='dstfield', meshloc=esmpy.MeshLoc.NODE)
+    xctfield = esmpy.Field(mesh, name='xctfield', meshloc=esmpy.MeshLoc.NODE)
+    # NOTE: Field must be built on elements of Mesh for conservative regridding
+    # dstfield = esmpy.Field(mesh, name='dstfield', meshloc=esmpy.MeshLoc.ELEMENT)
+    # xctfield = esmpy.Field(mesh, name='xctfield', meshloc=esmpy.MeshLoc.ELEMENT)
+
+    # initialize the fields
+    [lon, lat] = [0, 1]
+    deg2rad = 3.14159 / 180
+
+    gridXCoord = srcfield.grid.get_coords(lon, esmpy.StaggerLoc.CENTER)
+    gridYCoord = srcfield.grid.get_coords(lat, esmpy.StaggerLoc.CENTER)
+    srcfield.data[...] = 10.0 + (gridXCoord * deg2rad) ** 2 + (
+                                                              gridYCoord * deg2rad) ** 2
+
+    gridXCoord = xctfield.grid.get_coords(lon, esmpy.StaggerLoc.CENTER)
+    gridYCoord = xctfield.grid.get_coords(lat, esmpy.StaggerLoc.CENTER)
+    xctfield.data[...] = 10.0 + (gridXCoord * deg2rad) ** 2 + (
+                                                              gridYCoord * deg2rad) ** 2
+
+    dstfield.data[...] = 1e20
+
+    # create an object to regrid data from the source to the destination field
+    regrid = esmpy.Regrid(srcfield, dstfield,
+                         regrid_method=esmpy.RegridMethod.BILINEAR,
+                         unmapped_action=esmpy.UnmappedAction.ERROR)
+
+    # do the regridding from source to destination field
+    dstfield = regrid(srcfield, dstfield)
+
+    return dstfield, xctfield
+
+def compute_error(dstfield, xctfield):
+    # compute the mean relative error
+    from operator import mul
+    num_nodes = reduce(mul, xctfield.shape)
+    relerr = 0
+    meanrelerr = 0
+    if num_nodes != 0:
+        ind = numpy.where((dstfield != 1e20) & (xctfield != 0))[0]
+        relerr = numpy.sum(
+            numpy.abs(dstfield[ind] - xctfield[ind]) / numpy.abs(
+                xctfield[ind]))
+        meanrelerr = relerr / num_nodes
+
+    meanrelerr = relerr / num_nodes
+    print "ESMPy regridding as a spawned MPI process:"
+    print "  interpolation mean relative error = {0}".format(meanrelerr)
+
+
+########################################### MAIN #############################
+
+start_worker = 'worker'
+usage = 'Program should be started without arguments'
+pet_count = 4
+
+# Parent
+if len(sys.argv) == 1:
+
+    # Spawn workers
+    comm = MPI.COMM_WORLD.Spawn(
+        sys.executable,
+        args=[sys.argv[0], start_worker],
+        maxprocs=pet_count)
+
+    # gather output fields from workers
+    dstfield = None
+    dstfield = comm.gather(dstfield, root=MPI.ROOT)
+    dstfield = numpy.concatenate([dstfield[i] for i in range(pet_count)])
+
+    xctfield = None
+    xctfield = comm.gather(xctfield, root=MPI.ROOT)
+    xctfield = numpy.concatenate([xctfield[i] for i in range(pet_count)])
+
+    # plot results
+    compute_error(dstfield, xctfield)
+
+    # Shutdown
+    comm.Disconnect()
+
+# Worker
+elif sys.argv[1] == start_worker:
+
+    # Connect to parent
+    try:
+        comm = MPI.Comm.Get_parent()
+        rank = comm.Get_rank()
+    except:
+        raise ValueError('Could not connect to parent - ' + usage)
+
+    try:
+        # call ESMPy regridding
+        dstfield, xctfield = regrid()
+
+        # send output to parent
+        comm.gather(sendobj=dstfield.data, root=0)
+        comm.gather(sendobj=xctfield.data, root=0)
+    except:
+        comm.Disconnect()
+
+    # Shutdown
+    comm.Disconnect()
+
+# Catch
+else:
+    raise ValueError(usage)
+
+
+
+
+
+
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/field.html b/docs/nightly/v8.8.0b03/html/field.html new file mode 100644 index 00000000..8ced211d --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/field.html @@ -0,0 +1,387 @@ + + + + + + + + Field — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

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. The Field class +contains distributed and discretized field data, a reference to its +associated grid, and metadata. The Field 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 different Fields which are on the same underlying Grid but +have different staggerings can share the same Grid 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 a Grid, Mesh or +LocStream.

+

REQUIRED:

+
+
:param Grid/Mesh/LocStream grid: A Grid,

Mesh or LocStream +with coordinates allocated on at least one stagger location.

+
+
+

OPTIONAL:

+
+
Parameters:
+
    +
  • name (str) – An optional user friendly name for the +Field.

  • +
  • typekind (TypeKind) – Type of the Field +data. If None, defaults to R8.

  • +
  • staggerloc (StaggerLoc) – The stagger location of the +Field data, only specify this argument when +using a Grid. +If None, defaults to CENTER +in 2D and CENTER_VCENTER in 3D.

  • +
  • meshloc (MeshLoc) – The mesh location of the +Field data, only specify this argument when +using a Mesh +if None, defaults to NODE.

  • +
  • 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 the Field. The +time dimension must be last, following Fortran indexing conventions.

  • +
+
+
+
+
+property data
+
+
Return type:
+

TypeKind

+
+
Returns:
+

The data of the Field

+
+
+
+ +
+
+property grid
+
+
Return type:
+

Grid, Mesh, or +LocStream

+
+
Returns:
+

The discretization object upon which the +Field is built.

+
+
+
+ +
+
+property lower_bounds
+
+
Return type:
+

ndarray

+
+
Returns:
+

The lower bounds of the Field.

+
+
+
+ +
+
+property name
+
+
Return type:
+

str

+
+
Returns:
+

the name of the Field.

+
+
+
+ +
+
+property ndbounds
+
+
Return type:
+

list

+
+
Returns:
+

The bounds of the extra dimensions in the +Field.

+
+
+
+ +
+
+property rank
+
+
Return type:
+

int

+
+
Returns:
+

The rank of the Field.

+
+
+
+ +
+
+property staggerloc
+
+
Return type:
+

StaggerLoc or +MeshLoc

+
+
Returns:
+

The location upon which the Field +is built.

+
+
+
+ +
+
+property type
+
+
Return type:
+

TypeKind

+
+
Returns:
+

The type of the data in the Field.

+
+
+
+ +
+
+property upper_bounds
+
+
Return type:
+

ndarray

+
+
Returns:
+

The upper bounds of the Field.

+
+
+
+ +
+
+property xd
+
+
Return type:
+

int

+
+
Returns:
+

The number of extra (ungridded) dimensions of the +Field.

+
+
+
+ +
+
+copy()
+

Copy a Field in an ESMF-safe manner.

+
+
Returns:
+

A Field shallow copy.

+
+
+
+ +
+
+destroy()
+

Release the memory associated with a Field.

+
+ +
+
+get_area()
+

Initialize an existing Field with the areas of +the cells of the underlying Grid or +Mesh.

+
+ +
+
+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:
+
    +
  • filename (str) – The name of the NetCDF file.

  • +
  • variable (str) – The name of the data variable to read from file.

  • +
+
+
+

OPTIONAL:

+
+
Parameters:
+

timeslice (int) – The number of timeslices to read.

+
+
+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/genindex.html b/docs/nightly/v8.8.0b03/html/genindex.html new file mode 100644 index 00000000..1b099681 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/genindex.html @@ -0,0 +1,633 @@ + + + + + + + Index — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + +
+
+
+
+ + +

Index

+ +
+ _ + | A + | B + | C + | D + | E + | F + | G + | H + | I + | L + | M + | N + | P + | Q + | R + | S + | T + | U + | V + | W + | X + +
+

_

+ + +
+ +

A

+ + + +
+ +

B

+ + + +
+ +

C

+ + + +
+ +

D

+ + + +
+ +

E

+ + + +
+ +

F

+ + + +
+ +

G

+ + + +
+ +

H

+ + + +
+ +

I

+ + + +
+ +

L

+ + + +
+ +

M

+ + + +
+ +

N

+ + + +
+ +

P

+ + + +
+ +

Q

+ + +
+ +

R

+ + + +
+ +

S

+ + + +
+ +

T

+ + + +
+ +

U

+ + + +
+ +

V

+ + +
+ +

W

+ + +
+ +

X

+ + +
+ + + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/grid.html b/docs/nightly/v8.8.0b03/html/grid.html new file mode 100644 index 00000000..51bfa963 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/grid.html @@ -0,0 +1,655 @@ + + + + + + + + Grid — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

Grid

+
+
+class esmpy.api.grid.Grid(max_index=None, num_peri_dims=0, periodic_dim=None, pole_dim=None, coord_sys=None, coord_typekind=None, staggerloc=None, pole_kind=None, filename=None, filetype=None, reg_decomp=None, decompflag=None, is_sphere=None, add_corner_stagger=None, add_user_area=None, add_mask=None, varname=None, coord_names=None, tilesize=None, regDecompPTile=None, name=None)
+

The Grid class is a Python wrapper object for the ESMF Grid. The individual +values of all coordinate and mask arrays are referenced to those of the +underlying Fortran ESMF object.

+

The Grid class is used to describe the geometry and +discretization of logically rectangular physical grids. It also contains +the description of the underlying topology and decomposition of the physical +grid across the available computational resources. The most frequent use of +the Grid class is to describe physical grids in user +code so that sufficient information is available to perform regridding +operations.

+

Refer to the Grid Class of the +ESMF Reference Manual +for more information.

+

A Grid can be created in two different ways, as a +Grid in memory, or from SCRIP formatted or CF compliant GRIDSPEC file. The +arguments for each type of Grid creation are +outlined below.

+

Created in-memory:

+

REQUIRED:

+
+
Parameters:
+

max_index (list) – An integer list of length 2 or 3, with the +number of grid cells in each dimension.

+
+
+

OPTIONAL:

+
+
Parameters:
+
    +
  • num_peri_dims (int) – The number of periodic dimensions, either 0 +or 1. If None, defaults to 0.

  • +
  • periodic_dim (int) – The periodic dimension: 0, 1 or 2. +If None, defaults to 0.

  • +
  • pole_dim (int) – The pole dimension 0 or 1. +If None, defaults to 1.

  • +
  • coord_sys (CoordSys) – Coordinate system for the +Grid. +If None, defaults to SPH_DEG.

  • +
  • coord_typekind (TypeKind) – Type of the Grid +coordinates. +If None, defaults to R8.

  • +
+
+
+

Created either from file or in-memory:

+
+
Parameters:
+
    +
  • staggerloc (StaggerLoc) – The stagger location of the coordinate values. +If None, defaults to CENTER +in 2D and CENTER_VCENTER in 3D.

  • +
  • pole_kind (PoleKind) – Two item list which specifies the type of +connection which occurs at the pole. The first value specifies the +connection that occurs at the minimum end of the pole dimension. +The second value specifies the connection that occurs at the maximum +end of the pole dimension. +If None, defaults to MONOPOLE.

  • +
+
+
+

Created from file:

+

REQUIRED:

+
+
Parameters:
+
+
+
+

OPTIONAL:

+
+
Parameters:
+
    +
  • is_sphere (bool) – Set to True for a spherical grid, or False +for regional. Defaults to True.

  • +
  • add_corner_stagger (bool) – Set to True to use the information in +the grid file to add the corner stagger to the grid. The coordinates for +the corner stagger are required for conservative regridding. If +not specified, defaults to False.

  • +
  • add_user_area (bool) – Set to True to read in the cell area from the +grid file; otherwise, ESMF will calculate it. Defaults to False.

  • +
  • add_mask (bool) – Set to True to generate the mask using the +missing_value attribute defined in varname. This argument is +only supported with filetype +GRIDSPEC. +Defaults to False.

  • +
  • varname (str) – If add_mask is True, provide a variable name stored +in the grid file and the mask will be generated using the missing value +of the data value of this variable. The first two dimensions of the +variable has to be the longitude and the latitude dimension and the +mask is derived from the first 2D values of this variable even if this +data is a 3D, or 4D array. This argument is only supported with +filetype GRIDSPEC. +Defaults to None.

  • +
  • coord_names (list) – A two-element array containing the longitude and +latitude variable names in a GRIDSPEC file if there are multiple +coordinates defined in the file. This argument is only supported with +filetype GRIDSPEC. +Defaults to None.

  • +
+
+
+

Cubed sphere:

+

REQUIRED:

+
+
Parameters:
+

tilesize (int) – The number of elements on each side of the tile of the +cubed sphere grid.

+
+
+

OPTIONAL:

+
+
Parameters:
+
    +
  • regDecompPTile (list) – List of DE counts for each dimension. The second index steps through +the tiles. The total deCount is determined as the sum over +the products of regDecompPTile elements for each tile. +By default every tile is decomposed in the same way. If the total +PET count is less than 6, one tile will be assigned to one DE and the DEs +will be assigned to PETs sequentially, therefore, some PETs may have +more than one DE. If the total PET count is greater than 6, the total +number of DEs will be a multiple of 6 and less than or equal to the total +PET count. For instance, if the total PET count is 16, the total DE count +will be 12 with each tile decomposed into 1x2 blocks. The 12 DEs are mapped +to the first 12 PETs and the remaining 4 PETs have no DEs locally.

  • +
  • name (str) – The name of the Grid.

  • +
+
+
+
+
+property area
+
+
Return type:
+

A list of numpy arrays with an entry for every stagger location +of the Grid.

+
+
Returns:
+

The Grid cell areas represented as +numpy arrays of floats of size given by +upper_bounds - lower_bounds.

+
+
+
+ +
+
+property areatype
+
+
Return type:
+

TypeKind

+
+
Returns:
+

The ESMF typekind of the Grid cell +areas.

+
+
+
+ +
+
+property coords
+
+
Return type:
+

2D list of numpy arrays of size given by +upper_bounds - lower_bounds, where the first index represents +the stagger locations of the Grid and the +second index represent the coordinate dimensions of the +Grid.

+
+
Returns:
+

The coordinates of the Grid.

+
+
+
+ +
+
+property coord_sys
+
+
Return type:
+

CoordSys

+
+
Returns:
+

The coordinate system of the Grid.

+
+
+
+ +
+
+property has_corners
+
+
Return type:
+

bool

+
+
Returns:
+

A boolean value to tell if the Grid +has corners allocated.

+
+
+
+ +
+
+property lower_bounds
+
+
Return type:
+

A list of numpy arrays with an entry for every stagger location +of the Grid.

+
+
Returns:
+

The lower bounds of the Grid +represented as numpy arrays of ints of size given by +upper_bounds - lower_bounds.

+
+
+
+ +
+
+property mask
+
+
Return type:
+

A list of numpy arrays with an entry for every stagger location +of the Grid.

+
+
Returns:
+

The mask of the Grid represented as +numpy arrays of ints of size given by ` +upper_bounds - lower_bounds`.

+
+
+
+ +
+
+property max_index
+
+
Return type:
+

A numpy array with as many values as the +Grid rank.

+
+
Returns:
+

The number of Grid cells in each +dimension of the grid.

+
+
+
+ +
+
+property num_peri_dims
+
+
Return type:
+

int

+
+
Returns:
+

The total number of periodic dimensions in the +Grid.

+
+
+
+ +
+
+property periodic_dim
+
+
Return type:
+

int

+
+
Returns:
+

The periodic dimension of the Grid +(e.g. 0 for x or longitude, 1 for y or +latitude, etc.).

+
+
+
+ +
+
+property pole_dim
+
+
Return type:
+

int

+
+
Returns:
+

The pole dimension of the Grid +(e.g. 0 for x or longitude, 1 for y or +latitude, etc.).

+
+
+
+ +
+
+property rank
+
+
Return type:
+

int

+
+
Returns:
+

The rank of the Grid.

+
+
+
+ +
+
+property size
+
+
Return type:
+

A list of numpy arrays with an entry for every stagger location +of the Grid.

+
+
Returns:
+

The size of the Grid represented as +numpy arrays of ints of size given by +upper_bounds - lower_bounds.

+
+
+
+ +
+
+property staggerloc
+
+
Return type:
+

list of bools

+
+
Returns:
+

The stagger locations that have been allocated for the +Grid.

+
+
+
+ +
+
+property type
+
+
Return type:
+

TypeKind

+
+
Returns:
+

The ESMF typekind of the Grid +coordinates.

+
+
+
+ +
+
+property upper_bounds
+
+
Return type:
+

A list of numpy arrays with an entry for every stagger location +of the Grid.

+
+
Returns:
+

The upper bounds of the Grid +represented as numpy arrays of ints of size given by +upper_bounds - lower_bounds.

+
+
+
+ +
+
+add_coords(staggerloc=None, coord_dim=None, from_file=False)
+

Add coordinates to the Grid at the specified +stagger location.

+
+
Parameters:
+
    +
  • staggerloc (StaggerLoc) – The stagger location of the coordinate +values. If None, defaults to +CENTER +in 2D and CENTER_VCENTER in +3D.

  • +
  • coord_dim (int) – The dimension number of the coordinates to return +e.g. [x, y, z] = (0, 1, 2), or [lon, lat] = (0, 1) +(coordinates will not be returned if coord_dim is not specified and +staggerlocs is a list with more than one element).

  • +
  • from_file (bool) – Boolean for internal use to determine whether the +Grid has already been created from file.

  • +
+
+
Returns:
+

A numpy array of coordinate values if staggerloc and +coord_dim are specified, otherwise return None.

+
+
+
+ +
+
+add_item(item, staggerloc=None, from_file=False)
+

Allocate space for a Grid item (mask or areas) +at a specified stagger location.

+

REQUIRED:

+
+
Parameters:
+

item (GridItem) – The GridItem to +allocate.

+
+
+

OPTIONAL:

+
+
Parameters:
+
    +
  • staggerloc (StaggerLoc) – The stagger location of the item +values. If None, defaults to +CENTER +in 2D and CENTER_VCENTER in +3D.

  • +
  • from_file (bool) – Boolean for internal use to determine whether the +Grid has already been created from file.

  • +
+
+
Returns:
+

A numpy array of the mask or area values if a single +staggerloc is given, otherwise return None.

+
+
+
+ +
+
+copy()
+

Copy a Grid in an ESMF-safe manner.

+
+
Returns:
+

A Grid shallow copy.

+
+
+
+ +
+
+destroy()
+

Release the memory associated with a Grid.

+
+ +
+
+get_coords(coord_dim, staggerloc=None)
+

Return a numpy array of coordinates at a specified stagger +location. The returned array is NOT a copy, it is +directly aliased to the underlying memory allocated by esmpy.

+

REQUIRED:

+
+
Parameters:
+

coord_dim (int) – The dimension number of the coordinates to return +e.g. [x, y, z] = (0, 1, 2), or [lon, lat] = (0, 1) +(coordinates will not be returned if coord_dim is not specified +and staggerlocs is a list with more than one element).

+
+
+

OPTIONAL:

+
+
Parameters:
+

staggerloc (StaggerLoc) – The stagger location of the coordinate +values. If None, defaults to +CENTER +in 2D and CENTER_VCENTER in +3D.

+
+
Returns:
+

A numpy array of coordinate values at the specified staggerloc.

+
+
+
+ +
+
+get_item(item, staggerloc=None)
+

Return a numpy array of item values at a specified stagger +location. The returned array is NOT a copy, it is +directly aliased to the underlying memory allocated by esmpy.

+

REQUIRED:

+
+
Parameters:
+

item (GridItem) – The GridItem to +return.

+
+
+

OPTIONAL:

+
+
Parameters:
+

staggerloc (StaggerLoc) – The stagger location of the item +values. If None, defaults to +CENTER in 2D and +CENTER_VCENTER in 3D.

+
+
Returns:
+

A numpy array of mask or area values at the specified staggerloc.

+
+
+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/index.html b/docs/nightly/v8.8.0b03/html/index.html new file mode 100644 index 00000000..e0113306 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/index.html @@ -0,0 +1,221 @@ + + + + + + + + Table of Contents — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + +
+ + +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/install.html b/docs/nightly/v8.8.0b03/html/install.html new file mode 100644 index 00000000..be04cb7c --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/install.html @@ -0,0 +1,268 @@ + + + + + + + + Installation — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

Installation

+
+

Requirements

+

The following packages are required to work with ESMPy:

+ +

The following packages are optional:

+
    +
  • +
    ESMF installation with NetCDF - required to create Grids, Meshes and Fields from file, and to write regridding weights to file
      +
    • NetCDF must be built as a shared library for ESMPy installation to succeed

    • +
    +
    +
    +
  • +
  • ESMF installation with PIO (the Parallel IO library) - required to create Meshes and Fields from file, and to write regridding weights to file

  • +
  • mpi4py- python bindings to MPI, needed to run some of the parallel regridding examples

  • +
  • pytest - for testing

  • +
+
+
+

Getting the code

+

The ESMPy source code can be downloaded from the +ESMF git repository.

+

The ESMF User’s Guide +contains information on building and installing esmpy.

+

The ESMF Reference Manual +contains information on the architecture of ESMF, example code, and details of the API (Application Programming +Interface).

+
+

Anaconda Packages

+

ESMPy conda packages are available through the conda-forge channel:

+
conda create -n esmpy -c conda-forge esmpy
+
+
+

Specific versions of the conda package can be installed like this:

+
conda create -n esmpy -c conda-forge esmpy=8.1.0
+
+
+

Development versions can be found in the esmpy_dev channel:

+
conda create -n esmpy -c conda-forge -c esmpy_dev esmpy
+
+
+
+
+
+

Installing ESMPy from Source

+

When installing from source, ESMPy uses pip +to build and install the package. An installation of ESMPy in the default location for Python packages can be done +with the following command issued from the top level ESMPy directory (src/addon/esmpy):

+
python3 -m pip install .
+
+
+

Please contact esmf_support@ucar.edu with any questions.

+
+

Note

+

With some python versions, there is a problem with the automatic installation of the required package setuptools-git-versioning. If the output from the pip install command ends with Successfully installed esmpy-0.0.0, this indicates that the setuptools-git-versioning package was not invoked and the build thinks you are using ESMF version 0.0.0. This will cause problems when you try to use ESMPy. To solve this problem, simply rerun the above installation command (python3 -m pip install .). You should then see a reasonable version number at the end, such as, Successfully installed esmpy-8.4.0.

+
+
+
+

Importing ESMPy

+

To use ESMPy in an external program, import it with:

+
import esmpy
+
+
+

The environment variable ESMFMKFILE should be set when using ESMPy. If it is not found, the package will +try to guess a few very common locations, but we recommend correctly setting the variable nonetheless.

+
+

Note

+

The Python module name for ESMPy was changed in v8.4.0 from “ESMF” to “esmpy”. If you are using a version older than v8.4.0, the import command is import ESMF. See the ESMF Release Notes for more details and links to previous versions of the ESMPy documentation.

+
+
+
+

Validation

+

The ESMPy testing is done with the pytest package, both in serial and +parallel. Basic unit tests can be run with the following command, from +the top level ESMPy directory (src/addon/esmpy):

+
python3 -m pytest
+
+
+

There are a few other pytest targets available for a wider range of testing if +greater test coverage is desired:

+
make test_unit
+
+make test_examples
+
+make test_unit_parallel
+
+make test_examples_parallel
+
+make test_regrid_from_file
+
+
+
+

Note

+

The regrid_from_file and example tests can take up a lot of memory +and bandwidth. The download_regrid_from_file and download_examples +commands will simply download the test files without actually running them +(allowing the stress on the machine to be applied to bandwidth first, and +then memory).

+
+
+

Note

+

By default, test data will be downloaded to a data subdirectory of the ESMPy installation directory. This location can be changed by setting one of the following environment variables:

+
    +
  • If ESMPY_DATA_DIR is set, this should point to a directory that has already been populated with the necessary data; the pre-existing data will be read from this directory and no automatic downloads will be attempted.

  • +
  • Otherwise, if ESMPY_DATA_NEW_DIR is set, data will be downloaded to the path set by this variable instead of using the data subdirectory of the ESMPy installation directory.

  • +
+
+
+
+

Limitations

+

ESMPy doesn’t include many aspects of ESMF, including components, field bundles, +time management, etc. The limitations listed here are relative +to ESMF offline and integrated regridding capabilities.

+
    +
  • ESMPy cannot use an ESMF installation that is built with external LAPACK +support.

  • +
  • Coordinates cannot be retrieved from the elements of a +Mesh. This can affect the ability to set +Field values on a source Mesh +created from file when using conservative regridding.

  • +
  • Multi-tile Grid support is limited to cubed-sphere +grids created on 6 processors. A cubed-sphere grid can be created on any +number of processors, but only when it is created on 6 processors will the +coordinates be retrievable for the entire object. A +Field created from a cubed-sphere +Grid cannot be written to file in parallel.

  • +
  • There is no FieldBundle class, only single Fields.

  • +
+

Testing related:

+
    +
  • Nightly regression testing is limited to a small subset of the ESMF test platforms, +including Darwin and Linux running gfortran with openMPI.

  • +
+
+
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/intro.html b/docs/nightly/v8.8.0b03/html/intro.html new file mode 100644 index 00000000..3f923747 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/intro.html @@ -0,0 +1,193 @@ + + + + + + + + Overview — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

Overview

+

ESMPy is a Python interface to the Earth System Modeling Framework (ESMF) +regridding utility. ESMF is software for +building and coupling weather, climate, and related models. ESMF has a robust, +parallel and scalable remapping package, used to generate remapping weights. +It can handle a wide variety of grids and options: logically rectangular grids, +unstructured meshes and sets of unconnected points; regional or global grids; +2D or 3D; and pole and masking options. ESMF also has capabilities to read grid +information from NetCDF files in a variety of formats, including the +Climate and Forecast (CF) V1.6 (a.k.a GridSpec), +UGRID, +ESMF Unstructured and SCRIP conventions. Information on these last two conventions +can be found in the +ESMF Reference Manual.

+

ESMPy provides a Grid to represent single-tile logically +rectangular coordinate data, a Mesh for unstructured +coordinates, and a LocStream for collections of +unconnected points like observational data streams. +ESMPy supports bilinear, nearest neighbor, higher order patch recovery, +first-order conservative and second-order conservative regridding. There is +also an option to ignore unmapped destination points, mask out points on either +the source or destination, choose straight line or great circle paths when using +spherical coordinates and extrapolate data to points outside of the destination +domain. Regridding on the sphere takes place in 3D Cartesian space, so the pole +problem is not an issue as it commonly is with many Earth system grid remapping +softwares. Grid and Mesh +objects can be created in 2D or 3D space, and 3D conservative regridding is +fully supported.

+

Regridding, also called remapping or interpolation, is the process of changing +the grid underneath field data values while preserving the qualities of the +original data. Different kinds of transformations are appropriate for +different problems. Regridding may be needed when communicating data between +Earth system modeling components such as land and atmosphere, or between +different data sets to support analysis or visualization.

+

Regridding can be broken into two stages. The first stage is generation of an +interpolation weight matrix that describes how points in the source grid +contribute to points in the destination grid. The second stage is the +multiplication of values on the source grid by the interpolation weight matrix +to produce the appropriate values on the destination grid. ESMPy provides +access to both stages through two separate interfaces.

+

There are many different interpolation methods, suitable for different problems. +In ESMPy, the basic bilinear option is a two dimensional variant of linear +interpolation. The higher order patch recovery is a second degree polynomial +regridding method, which uses a least squares algorithm to calculate the +polynomial. This method gives better derivatives in the resulting destination +field than the bilinear. There are two nearest-neighbor methods which map the +points from one grid to the nearest corresponding point on the other grid, from +either source to destination or vice versa. These are useful for extrapolation +or categorical fields.

+

The first-order conservative regridding is a method designed to preserve the +integral of the field across the interpolation from source to destination. It +uses the proportion of the area of the overlapping source and destination cells +to determine appropriate weights. The second-order conservative method also +preserves the integral, but uses the source gradient to give a smoother result +than the first-order conservative. All of these methods can be broken down to a +simple sparse matrix multiplication operation between interpolation weights and +data values.

+
+ + + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/locstream.html b/docs/nightly/v8.8.0b03/html/locstream.html new file mode 100644 index 00000000..1ba0b168 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/locstream.html @@ -0,0 +1,299 @@ + + + + + + + + LocStream — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

LocStream

+
+
+class esmpy.api.locstream.LocStream(location_count, coord_sys=None, name=None, esmf=True)
+

The LocStream class is a Python wrapper object for the ESMF LocStream. +LocStream is a derived type of a Python dictionary.

+

The individual values of all key arrays are referenced to those of the +underlying Fortran ESMF object.

+

A LocStream is used to represent the locations of a +set of data points. The values of the data points are stored within a +Field created using the LocStream.

+

In the data assimilation world, location streams can be thought of as a set +of observations. Their locations are generally described using Cartesian +(x, y, z), or (lat, lon, height) coordinates. There is no assumption +of any regularity in the positions of the points. To make the concept more +general, the locations for each data point are represented using a construct +called keys. Keys can include other descriptors besides location, including +a second set of coordinates.

+

Refer to the LocStrea Class of the +ESMF Reference Manual +for more information.

+

LocStream follows standard dictionary syntax. For example:

+
>>> locstream["ESMF:X"] = [1, 2, 3]
+>>> x = locstream["ESMF:X"]
+>>> locstream["ESMF:Y"] = [1, 2, 3]
+>>> y = locstream["ESMF:Y"]
+>>> locstream["ESMF:Mask"] = [0, 1, 0]
+>>> mask = locstream["ESMF:Mask"]
+
+
+
+

Note

+

Setting keys of lists of mixed types can result in errors due to +type mismatches from the ESMF library.

+
+
+

Note

+

Mask must be of type I4, +and coordinates must by of type R8.

+
+

For ESMF to be able to recognize coordinates specified in a LocStream key +they need to be named with the appropriate identifiers. The particular +identifiers depend on the coordinate system (i.e. coord_sys argument) +used to create the LocStream.

+

The valid values are:

+ + + + + + + + + + + + + + + + + + + + + + + + + +

Coordinate System

dimension 1

dimension 2

dimension 3

SPH_DEG

ESMF:Lon

ESMF:Lat

ESMF:Radius

SPH_RAD

ESMF:Lon

ESMF:Lat

ESMF:Radius

CART

ESMF:X

ESMF:Y

ESMF:Z

+
+
Parameters:
+
    +
  • location_count (int) – The number of points in this stream.

  • +
  • coord_sys (CoordSys) – Coordinate system for the location stream. +If None, defaults to SPH_DEG.

  • +
  • name (str) – Optional name for the location stream.

  • +
  • esmf (bool) – Internal parameter controlling shallow copying by esmpy.

  • +
+
+
+
+
+property lower_bounds
+
+
Return type:
+

int

+
+
Returns:
+

The lower bounds of the LocStream.

+
+
+
+ +
+
+property name
+
+
Return type:
+

str

+
+
Returns:
+

The name of the LocStream.

+
+
+
+ +
+
+property rank
+
+
Return type:
+

int

+
+
Returns:
+

The rank of the LocStream.

+
+
+
+ +
+
+property size
+
+
Return type:
+

int

+
+
Returns:
+

The size of the LocStream.

+
+
+
+ +
+
+property upper_bounds
+
+
Return type:
+

int

+
+
Returns:
+

The upper bounds of the LocStream.

+
+
+
+ +
+
+copy()
+

Copy a LocStream in an ESMF-safe manner.

+
+
Returns:
+

A LocStream shallow copy.

+
+
+
+ +
+
+destroy()
+

Release the memory associated with a +LocStream.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/manager.html b/docs/nightly/v8.8.0b03/html/manager.html new file mode 100644 index 00000000..6db922b4 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/manager.html @@ -0,0 +1,233 @@ + + + + + + + + Manager — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

Manager

+
+
+class esmpy.api.esmpymanager.Manager(debug=False, endFlag=<EndAction.NORMAL: 1>)
+

This singleton class is designed to ensure that ESMF is properly initialized +and finalized. ESMF is initialized at +Manager creation, and the __del__ +method is registered with atexit to ensure ESMF is always finalized prior to +exiting Python. If the object is copied, the copy will always be an alias +to the original Manager object. The +Manager will be created when the first +ESMPy object is created if it is not created explicitly by the user.

+

Explicit creation of a Manager object allows +for setting a flag which +results in the output of debug information from the ESMF logging capability +during the application runtime. The output log files are named +PET<PET number>.ESMF_LogFile.

+

The PET rank (local_pet) and total number of PETs (pet_count) +can also be retrieved from the Manager +using the following calls:

+
esmpy.local_pet()
+esmpy.pet_count()
+
+
+

local_pet and pet_count are also properties of the +Manager.

+

Calls ESMP_Initialize and registers __del__ with atexit when called the +first time. Subsequent calls only return whether or not ESMF is +initialized. Registering __del__ with atexit ensures the ESMP_Finalize +will always be called prior to exiting Python. Calling __init__ +explicitly results in a no-op.

+

The Manager can be used to enable the +MOAB +mesh backend to the Mesh. This is done by calling set_moab() with moab_on=True.

+

The Manager has a test_exhaustive member +variable that can be enabled to run +combinatorial expansions of Grid and +Field creation parameters.

+
+
Parameters:
+
    +
  • debug (bool) – outputs logging information to ESMF logfiles. If +None, defaults to False.

  • +
  • endFlag (bool) – determines the action to take on ESMF finalization. +See EndAction docstring for details. Defaults to EndAction.NORMAL.

  • +
+
+
+
+
+property local_pet
+
+
Return type:
+

int

+
+
Returns:
+

The id of the current Persistent Execution Thread (PET i.e. processing core).

+
+
+
+ +
+
+property moab
+
+
Return type:
+

bool

+
+
Returns:
+

A boolean value to indicate if the MOAB mesh backend is in use.

+
+
+
+ +
+
+property pet_count
+
+
Return type:
+

int

+
+
Returns:
+

The number of Persistent Execution Threads (PETs i.e. processing cores) +available in this execution.

+
+
+
+ +
+
+barrier()
+

Collective VM communication call that blocks calling PET until +all PETs of the VM have issued the call.

+
+ +
+
+set_moab(moab_on=True)
+

Set the Mesh backend to use MOAB or the Native ESMF mesh.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/mesh.html b/docs/nightly/v8.8.0b03/html/mesh.html new file mode 100644 index 00000000..645269ae --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/mesh.html @@ -0,0 +1,464 @@ + + + + + + + + Mesh — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

Mesh

+
+
+class esmpy.api.mesh.Mesh(parametric_dim=None, spatial_dim=None, coord_sys=None, filename=None, filetype=None, convert_to_dual=None, add_user_area=None, meshname='', mask_flag=None, varname='')
+

The Mesh class is a Python wrapper object for the ESMF Mesh. +The individual values of all coordinate and mask arrays are referenced to +those of the underlying Fortran ESMF object.

+

The ESMF library provides a class for representing unstructured grids called +the Mesh. Fields can be created on a Mesh to hold data. Fields created on a +Mesh can also be used as either the source or destination or both of a +regrididng operation which allows data to be moved between unstructured +grids. A Mesh is constructed of nodes and elements. A node, also known as +a vertex or corner, is a part of a Mesh which represents a single point. +Coordinate information is set in a node. An element, also known as a cell, +is a part of a mesh which represents a small region of space. Elements are +described in terms of a connected set of nodes which represent locations +along their boundaries. Field data may be located on either the nodes or +elements of a Mesh.

+

Refer to the Mesh Class of the +ESMF Reference Manual +for more information.

+

An unstructured Mesh can be created in two different ways, as a Mesh in +memory, or from a SCRIP formatted or CF compliant UGRID file. The arguments +for each type of Mesh creation are outlined below.

+

Created in-memory:

+
+
The in-memory Mesh can be created manually in 3 steps:
    +
  1. create the Mesh (specifying parametric_dim and spatial_dim),

  2. +
  3. add nodes,

  4. +
  5. add elements.

  6. +
+
+
+

REQUIRED:

+
+
Parameters:
+
    +
  • parametric_dim (int) – the dimension of the topology of the +Mesh (e.g. a Mesh composed of squares would have a +parametric dimension of 2 and a Mesh composed of cubes +would have a parametric dimension of 3).

  • +
  • spatial_dim (int) – the number of coordinate dimensions +needed to describe the locations of the nodes making up the +Mesh. For a manifold the spatial dimension can be larger +than the parametric dimension (e.g. the 2D surface of a +sphere in 3D space), but it cannot be smaller.

  • +
+
+
+

OPTIONAL:

+
+
Parameters:
+

coord_sys (CoordSys) – Coordinate system for the +Mesh. +If None, defaults to SPH_DEG.

+
+
+

Created from file:

+

Note that Meshes created from file do not use the parametric_dim and +spatial_dim parameters.

+

REQUIRED:

+
+
Parameters:
+
+
+
+

OPTIONAL:

+
+
Parameters:
+
    +
  • convert_to_dual (bool) – a boolean value to specify if the +dual Mesh should be calculated. Defaults to False. This +argument is only supported with +SCRIP.

  • +
  • add_user_area (bool) – a boolean value to specify if an area +property should be added to the mesh. This argument is only +supported for SCRIP +or ESMFMESH. +If None, defaults to False.

  • +
  • meshname (str) – the name of the Mesh metadata variable in +a UGRID file. This argument is only supported with +UGRID. +If None, defaults to the empty string.

  • +
  • mask_flag (MeshLoc) – an enumerated integer that, if +specified, tells whether a mask in a UGRID file should be +defined on the Mesh. +This argument is only supported with +UGRID. +If None, defaults to no masking.

  • +
  • varname (str) – a variable name for the mask in a UGRID file +if mask_flag is specified. This argument is only supported +for UGRID. +If None, defaults to the empty string.

  • +
+
+
+
+
+property area
+
+
Return type:
+

A two element list of numpy arrays to hold values for the nodes +and elements of the Mesh.

+
+
Returns:
+

The Mesh area represented as a numpy +array of floats of the same number of entries as Mesh elements.

+
+
+
+ +
+
+property coords
+
+
Return type:
+

A two element list of numpy arrays to hold values for the nodes +and elements of the Mesh.

+
+
Returns:
+

The coordinates represented as a numpy array of floats +with a value for each node and/or element of the Mesh +Mesh.

+
+
+
+ +
+
+property coord_sys
+
+
Return type:
+

CoordSys

+
+
Returns:
+

The coordinate system of the Mesh.

+
+
+
+ +
+
+property mask
+
+
Return type:
+

A two element list of numpy arrays to hold values for the nodes +and elements of the Mesh.

+
+
Returns:
+

The masked values on the nodes and elements of the +Mesh.

+
+
+
+ +
+
+property rank
+
+
Return type:
+

int

+
+
Returns:
+

The rank of the Mesh, (i.e. always 1).

+
+
+
+ +
+
+property size
+
+
Return type:
+

A two element list of integers.

+
+
Returns:
+

The number of nodes and elements in the Mesh on the current +processor.

+
+
+
+ +
+
+property size_owned
+
+
Return type:
+

A two element list of integers.

+
+
Returns:
+

The number of owned nodes and elements in the Mesh on the +current processor.

+
+
+
+ +
+
+add_elements(element_count, element_ids, element_types, element_conn, element_mask=None, element_area=None, element_coords=None)
+

Add elements to a Mesh, this must be done after adding nodes.

+

REQUIRED:

+
+
Parameters:
+
    +
  • element_count (int) – the number of elements to add to the Mesh.

  • +
  • element_ids (ndarray) – a numpy array of of shape +(element_count, 1) to specify the element ids.

  • +
  • element_types (ndarray) – a numpy array of +MeshElemType`s of shape +``(element_count, 1)` to specify the element types.

  • +
  • element_conn (ndarray) – a numpy array of shape +sum(element_types[:], 1) to specify the connectivity of the +Mesh. The connectivity array is constructed by concatenating the +tuples that correspond to the element_ids. The connectivity tuples +are constructed by listing the node_ids of each element in +COUNTERCLOCKWISE order.

  • +
+
+
+

OPTIONAL:

+
+
Parameters:
+
    +
  • element_mask (ndarray) – a numpy array of shape +(element_count, 1) containing integer values to specify masked +elements. The specific values that are masked are specified in the +Regrid constructor.

  • +
  • element_area (ndarray) – a numpy array of shape +(element_count, 1) to specify the areas of the elements.

  • +
  • element_coords (ndarray) – a numpy array of shape +(element_count, 1) to specify the coordinates of the elements.

  • +
+
+
+
+ +
+
+add_nodes(node_count, node_ids, node_coords, node_owners, node_mask=None)
+

Add nodes to a Mesh, this must be done before adding elements.

+
+
Parameters:
+
    +
  • node_count (int) – the number of nodes to add to the Mesh.

  • +
  • node_ids (ndarray) – a numpy array of shape (node_count, 1) to +specify the node_ids.

  • +
  • node_coords (ndarray) – a numpy array of shape +(spatial_dim*node_count, 1) to specify the coordinates of the Mesh. +The array should be constructed by concatenating the coordinate +tuples into a numpy array that correspond to node_ids.

  • +
  • node_owners (ndarray) – a numpy array of shape (node_count, 1) to +specify the rank of the processor that owns each node.

  • +
+
+
+

OPTIONAL:

+
+
Parameters:
+

node_mask (ndarray) – a numpy array of shape +(node_count, 1) containing integer values to specify masked +nodes. The specific values that are masked are specified in the +Regrid constructor.

+
+
+
+ +
+
+copy()
+

Copy a Mesh in an ESMF-safe manner.

+
+
Returns:
+

A Mesh shallow copy.

+
+
+
+ +
+
+destroy()
+

Release the memory associated with a Mesh.

+
+ +
+
+free_memory()
+

Free memory associated with the creation of a +Mesh which is no longer needed for ongoing +operations.

+
+ +
+
+get_coords(coord_dim, meshloc=<MeshLoc.NODE: 0>)
+

Return a numpy array of coordinates at a specified Mesh +location (coordinates can only be returned for the Mesh +NODE +at this time). The returned array is NOT a copy, it is +directly aliased to the underlying memory allocated by esmpy.

+

REQUIRED:

+
+
Parameters:
+

coord_dim (int) – the dimension number of the coordinates to return: +e.g. [x, y, z] = (0, 1, 2), or [lat, lon] = (0, 1)

+
+
+

OPTIONAL:

+
+
Parameters:
+

meshloc (MeshLoc) – the MeshLoc of the +coordinates. If None, defaults to +NODE.

+
+
Returns:
+

A numpy array of coordinate values at the specified +MeshLoc.

+
+
+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/objects.inv b/docs/nightly/v8.8.0b03/html/objects.inv new file mode 100644 index 00000000..29b32f42 Binary files /dev/null and b/docs/nightly/v8.8.0b03/html/objects.inv differ diff --git a/docs/nightly/v8.8.0b03/html/py-modindex.html b/docs/nightly/v8.8.0b03/html/py-modindex.html new file mode 100644 index 00000000..ee545e31 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/py-modindex.html @@ -0,0 +1,101 @@ + + + + + + + Python Module Index — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + + + + +
+
+
+
+ + +

Python Module Index

+ +
+ e +
+ + + + + + + +
 
+ e
+ esmpy +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/regrid.html b/docs/nightly/v8.8.0b03/html/regrid.html new file mode 100644 index 00000000..05e5dd32 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/regrid.html @@ -0,0 +1,366 @@ + + + + + + + + Regrid — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

Regrid

+
+
+class esmpy.api.regrid.Regrid(srcfield=None, dstfield=None, filename=None, rh_filename=None, src_mask_values=None, dst_mask_values=None, regrid_method=None, pole_method=None, regrid_pole_npoints=None, line_type=None, norm_type=None, extrap_method=None, extrap_num_src_pnts=None, extrap_dist_exponent=None, extrap_num_levels=None, unmapped_action=None, ignore_degenerate=None, create_rh=None, filemode=None, src_file=None, dst_file=None, src_file_type=None, dst_file_type=None, factors=False, large_file=None, src_frac_field=None, dst_frac_field=None)
+

The Regrid object represents a regridding operator between two Fields. The +creation of this object is analogous to ESMF_FieldRegridStore(), and +calling this object corresponds to ESMF_FieldRegrid(). +ESMF_FieldRegridRelease() is called when the Regrid object goes out of +scope (this only happens when the Manager goes out of scope, there is a +destroy() call for explicit deallocation of the Regrid).

+

Refer to the ESMF_FieldRegrid methods in the +ESMF Reference Manual +for more information.

+

The following arguments are used to create a handle to a Regridding +operation between two Fields.

+

REQUIRED:

+
+
Parameters:
+
+
+
+

OPTIONAL:

+
+
Parameters:
+
    +
  • filename (string) – path to the output netCDF weight file.

  • +
  • rh_filename (string) – path to the output RouteHandle file.

  • +
  • src_mask_values (ndarray) – a numpy array of values that should be +considered masked value on the source Field.

  • +
  • dst_mask_values (ndarray) – a numpy array of values that should be +considered masked value on the destination Field.

  • +
  • regrid_method (RegridMethod) – specifies which +RegridMethod to use. If None, defaults +to BILINEAR.

  • +
  • pole_method (PoleMethod) – specifies which type of artificial pole +to construct on the source Grid for regridding. If +None, defaults to: NONE for +regridmethod == CONSERVE, or +ALLAVG for +regridmethod != CONSERVE.

  • +
  • regrid_pole_npoints (int) – specifies how many points to average over +if polemethod == ALLAVG.

  • +
  • line_type (LineType) – select the path of the line that connects two +points on the surface of a sphere. This in turn controls the path along +which distances are calculated and the shape of the edges that make up a +cell. If None, defaults to: +GREAT_CIRCLE for +regridmethod == CONSERVE, or +CART for +regridmethod != CONSERVE.

  • +
  • norm_type (NormType) – control which type of normalization to do when +generating conservative regridding weights. If None, defaults to +DSTAREA.

  • +
  • extrap_method (ExtrapMethod) – Specify which extrapolation method to use on +unmapped destination points after regridding.

  • +
  • extrap_num_src_pnts (int) – The number of source points to use for the +extrapolation methods that use more than one source point +(e.g. NEAREST_IDAVG). If not +specified, defaults to 8.

  • +
  • extrap_dist_exponent (float) – The exponent to raise the distance to when +calculating weights for the NEAREST_IDAVG +extrapolation method. A higher value reduces the influence of more distant +points. If not specified, defaults to 2.0.

  • +
  • extrap_num_levels (int) – The number of levels to output for the extrapolation +methods that fill levels (e.g. CREEP). +When a method is used that requires this, then an error will be returned if it +is not specified.

  • +
  • unmapped_action (UnmappedAction) – specifies which action to take if a +destination point is found which does not map to any source point. If +None, defaults to ERROR.

  • +
  • ignore_degenerate (bool) – Ignore degenerate cells when checking the +input Grids or Meshes +for errors. If this is set to True, then the regridding proceeds, but +degenerate cells will be skipped. If set to False, a degenerate cell produces +an error. This currently only applies to CONSERVE, +other regrid methods currently always skip degenerate cells. If None, defaults +to False.

  • +
  • src_frac_field (ndarray) – return a numpy array of values containing +weights corresponding to the amount of each Field +value which contributes to the total mass of the Field.

  • +
  • dst_frac_field (ndarray) – return a numpy array of values containing +weights corresponding to the amount of each Field +value which contributes to the total mass of the Field.

  • +
  • factors (bool) –

    If True, return the factor and factor index list +when calling into ESMF’s regrid store method. These lists are converted +to NumPy arrays and attached to the regrid object. The factor arrays +are retrievable via get_factors() or get_weights_dict(). +See the respective documentation on those methods for additional information. +For more information on how ESMF treats factor retrieval see the +ESMF_FieldRegridStore interface in the +ESMF Reference Manual.

    +

  • +
  • large_file (bool) – If True, create the weight file in NetCDF using the +64-bit offset format to allow variables larger than 2GB. Note the 64-bit offset +format is not supported in the NetCDF version earlier than 3.6.0. An error message +will be generated if this flag is specified while the application is linked with a +NetCDF library earlier than 3.6.0. Defaults to False.

  • +
+
+
+
+
+__call__(srcfield, dstfield, zero_region=None)
+

Call a regridding operation from srcfield to dstfield.

+

REQUIRED:

+
+
Parameters:
+
    +
  • srcfield (Field) – the Field of source data to regrid.

  • +
  • dstfield (Field) – the Field to hold the regridded data.

  • +
+
+
+

OPTIONAL:

+
+
Parameters:
+

zero_region (Region) – specify which region of the field indices +will be zeroed out before adding the values resulting from the +interpolation. If None, defaults to +TOTAL.

+
+
Returns:
+

dstfield

+
+
+
+ +
+
+copy()
+

Copy a Regrid in an ESMF-safe manner.

+
+
Returns:
+

A Regrid shallow copy.

+
+
+
+ +
+
+destroy()
+

Release the memory associated with a Regrid.

+
+ +
+
+get_factors(deep_copy=False)
+

Return factor and factor index arrays. These arrays will only be +available if the Regrid object was initialized with factors=True. +See the ESMF_FieldRegridStore interface in the +ESMF Reference Manual +for additional information on these arrays (see below for indexing in +Python though).

+
>>> factors, factors_index = get_factors(...)
+
+
+

The first tuple element factors will have shape (m,) where +m is the number of factors or weights. It will be dtype(float64). +The second tupe element factors_index will have shape (m, 2) +where m is the number of factors or weights. The source/col indices +are selected by factors_index[:, 0]. The destination/row indices +are selected by factors_index[:, 1]. It will be dtype(int32).

+
+

Note

+

If deep_copy=True, array memory is C contiguous according +to NumPy array flags (<array>.flags).

+
+
+

Warning

+

Remember to call destroy() to deallocate +memory associated with a regrid operation. This will be called by +the Python garbage collector. However, if numerous regridding operations +are called in a tight loop, a memory leak will occur without a call +to destroy.

+
+
+
Parameters:
+

deep_copy (bool) – If True, make deep copies of the returned +arrays. If False (the default), the returned arrays will reference +the underlying ESMF memory.

+
+
Returns:
+

tuple of NumPy array objects

+
+
+
+ +
+
+get_weights_dict(deep_copy=False)
+

Return a dictionary mapping that is more user-friendly for weight/factor +retrieval. Please read the documentation for get_factors() +before using this function.

+ + + + + + + + + + + + + + + + + +

Key

Value

weights

Weight value array

row_dst

Destination/row indices

col_src

Source/col indices

+
+

Note

+

If deep_copy=True, array memory is C contiguous according +to NumPy array flags (<array>.flags).

+
+
+
Parameters:
+

deep_copy (bool) – If True, make deep copies of the returned +arrays. If False (the default), the returned arrays will reference +the underlying ESMF memory.

+
+
Returns:
+

dict

+
+
+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/regridfromfile.html b/docs/nightly/v8.8.0b03/html/regridfromfile.html new file mode 100644 index 00000000..b7e0bddd --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/regridfromfile.html @@ -0,0 +1,210 @@ + + + + + + + + RegridFromFile — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + +
+
+
+
+ +
+

RegridFromFile

+
+
+class esmpy.api.regrid.RegridFromFile(srcfield, dstfield, filename=None, rh_filename=None)
+

The RegridFromFile object represents a regridding +operator between two Fields that is read +from a file. The creation of this object is analogous to= ESMF_FieldSMMStore(), +and calling this object corresponds to ESMF_FieldRegrid(). ESMF_FieldRegridRelease() +is called when the RegridFromFile object goes +out of scope (this only happens when the Manager +goes out of scope, there is a destroy() call for explicit deallocation of +the RegridFromFile).

+

For more information about the ESMF Regridding functionality, please see +the ESMF_FieldRegrid methods in the +ESMF Reference Manual.

+

The following arguments are used to create a handle to a regridding +operation between two Fields.

+

REQUIRED:

+
+
Parameters:
+
    +
  • srcfield (Field) – source Field associated +with an underlying Grid, Mesh +or LocStream.

  • +
  • dstfield (Field) – destination Field associated +with an underlying Grid, Mesh +or LocStream. The data in this Field +may be overwritten by this call.

  • +
  • filename (string) – the name of the file from which to retrieve the +weights.

  • +
  • rh_filename (string) – the name of the file from which to retrieve the +routehandle information.

  • +
+
+
+
+
+__call__(srcfield, dstfield, zero_region=None)
+

Call a regridding operation from srcfield to dstfield.

+

REQUIRED:

+
+
Parameters:
+
    +
  • srcfield (Field) – the Field of source data to regrid.

  • +
  • dstfield (Field) – the Field to hold the regridded data.

  • +
+
+
+

OPTIONAL:

+
+
Parameters:
+

zero_region (Region) – specify which region of the field indices +will be zeroed out before adding the values resulting from the +interpolation. If None, defaults to +TOTAL.

+
+
Returns:
+

dstfield

+
+
+
+ +
+
+copy()
+

Copy a Regrid in an ESMF-safe manner.

+
+
Returns:
+

A Regrid shallow copy.

+
+
+
+ +
+
+destroy()
+

Release the memory associated with the RegridFromFile +object.

+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/search.html b/docs/nightly/v8.8.0b03/html/search.html new file mode 100644 index 00000000..a3f965a8 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/search.html @@ -0,0 +1,102 @@ + + + + + + + Search — ESMPy 8.8.0b0 documentation + + + + + + + + + + + + + + + + + + +
+
+
+
+ +

Search

+ + + + +

+ Searching for multiple words only shows matches that contain + all words. +

+ + +
+ + + +
+ + + +
+ +
+ + +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/nightly/v8.8.0b03/html/searchindex.js b/docs/nightly/v8.8.0b03/html/searchindex.js new file mode 100644 index 00000000..c1944f88 --- /dev/null +++ b/docs/nightly/v8.8.0b03/html/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({"docnames": ["CoordSys", "ExtrapMethod", "FileFormat", "FileMode", "GridItem", "LineType", "LogKind", "MeshElemType", "MeshLoc", "NormType", "PoleKind", "PoleMethod", "Region", "RegridMethod", "StaggerLoc", "TypeKind", "UnmappedAction", "api", "appendix", "examples", "field", "grid", "index", "install", "intro", "locstream", "manager", "mesh", "regrid", "regridfromfile"], "filenames": ["CoordSys.rst", "ExtrapMethod.rst", "FileFormat.rst", "FileMode.rst", "GridItem.rst", "LineType.rst", "LogKind.rst", "MeshElemType.rst", "MeshLoc.rst", "NormType.rst", "PoleKind.rst", "PoleMethod.rst", "Region.rst", "RegridMethod.rst", "StaggerLoc.rst", "TypeKind.rst", "UnmappedAction.rst", "api.rst", "appendix.rst", "examples.rst", "field.rst", "grid.rst", "index.rst", "install.rst", "intro.rst", "locstream.rst", "manager.rst", "mesh.rst", "regrid.rst", "regridfromfile.rst"], "titles": ["CoordSys", "ExtrapMethod", "FileFormat", "FileMode", "GridItem", "LineType", "LogKind", "MeshElemType", "MeshLoc", "NormType", "PoleKind", "PoleMethod", "Region", "RegridMethod", "StaggerLoc", "TypeKind", "UnmappedAction", "API", "Appendices", "Tutorials", "Field", "Grid", "Table of Contents", "Installation", "Overview", "LocStream", "Manager", "Mesh", "Regrid", "RegridFromFile"], "terms": {"class": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "esmpi": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 24, 25, 26, 27, 28, 29], "api": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29], "constant": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 22], "valu": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29], "name": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 25, 26, 27, 29], "none": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 20, 21, 25, 26, 27, 28, 29], "modul": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 22, 23], "type": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 25, 26, 27, 28], "start": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19], "1": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 23, 25, 26, 27, 28], "thi": [0, 1, 2, 4, 5, 6, 9, 10, 11, 12, 13, 15, 16, 17, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29], "flag": [0, 2, 6, 17, 26, 28], "indic": [0, 1, 2, 3, 11, 15, 16, 17, 23, 26, 28, 29], "coordin": [0, 3, 4, 13, 14, 18, 19, 20, 21, 23, 24, 25, 27], "system": [0, 17, 19, 21, 24, 25, 27], "grid": [0, 2, 3, 4, 5, 9, 10, 11, 13, 14, 18, 20, 22, 23, 24, 26, 27, 28, 29], "i": [0, 1, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29], "us": [0, 1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 15, 16, 17, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "both": [0, 5, 17, 19, 23, 24, 27], "other": [0, 4, 9, 17, 23, 24, 25, 28], "user": [0, 1, 9, 17, 20, 21, 23, 26, 28], "also": [0, 1, 3, 9, 13, 17, 21, 24, 26, 27], "control": [0, 5, 17, 25, 28], "how": [0, 5, 6, 17, 19, 20, 24, 28], "ar": [0, 1, 5, 7, 9, 11, 12, 13, 16, 17, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29], "interpret": [0, 17], "regrid": [0, 1, 4, 5, 9, 11, 12, 13, 18, 21, 22, 23, 24, 27, 29], "method": [0, 1, 5, 13, 14, 17, 24, 26, 28, 29], "e": [0, 1, 11, 17, 20, 21, 25, 26, 27, 28], "g": [0, 1, 11, 17, 20, 21, 27, 28], "cart": [0, 5, 18, 19, 25, 28], "0": [0, 1, 3, 4, 5, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 27, 28], "cartesian": [0, 5, 17, 19, 24, 25], "In": [0, 9, 13, 14, 17, 24, 25], "map": [0, 1, 11, 12, 13, 20, 21, 24, 28], "dimens": [0, 7, 14, 19, 20, 21, 22, 25, 27], "follow": [0, 5, 7, 17, 19, 20, 23, 25, 26, 28, 29], "order": [0, 13, 19, 22, 24, 27], "x": [0, 17, 19, 21, 25, 27], "y": [0, 17, 19, 21, 25, 27], "z": [0, 17, 19, 21, 25, 27], "coord_dim": [0, 21, 27], "get_coord": [0, 17, 18, 19, 21, 27], "refer": [0, 4, 17, 20, 21, 22, 23, 24, 25, 27, 28, 29], "sph_deg": [0, 17, 18, 19, 21, 25, 27], "spheric": [0, 18, 21, 24], "degre": [0, 17, 24], "longitud": [0, 17, 19, 21], "latitud": [0, 17, 19, 21], "radiu": [0, 17, 25], "sph_rad": [0, 17, 18, 19, 25], "2": [0, 1, 2, 6, 10, 11, 12, 13, 14, 17, 19, 21, 25, 27, 28], "radian": [0, 17, 19], "specifi": [1, 3, 5, 6, 12, 13, 14, 17, 19, 20, 21, 25, 27, 28, 29], "which": [1, 3, 5, 7, 9, 11, 13, 17, 19, 20, 21, 24, 26, 27, 28, 29], "extrapol": [1, 17, 24, 28], "unmap": [1, 16, 17, 24, 28], "destin": [1, 9, 11, 13, 16, 17, 19, 24, 27, 28, 29], "point": [1, 5, 11, 13, 16, 17, 23, 24, 25, 27, 28], "after": [1, 13, 17, 27, 28], "should": [1, 3, 6, 12, 17, 19, 23, 27, 28], "done": [1, 6, 9, 17, 23, 26, 27], "nearest_stod": [1, 13, 17, 18], "nearest": [1, 13, 17, 24], "sourc": [1, 9, 11, 13, 17, 19, 22, 24, 27, 28, 29], "here": [1, 9, 11, 17, 23], "each": [1, 7, 11, 13, 17, 19, 20, 21, 25, 27, 28], "closest": [1, 13], "A": [1, 4, 7, 13, 15, 17, 18, 19, 20, 21, 23, 25, 26, 27, 28, 29], "given": [1, 9, 10, 13, 17, 19, 21], "mai": [1, 2, 4, 11, 13, 17, 21, 24, 27, 28, 29], "go": [1, 13], "multipl": [1, 6, 13, 17, 20, 21, 24], "receiv": [1, 13, 17], "input": [1, 13, 17, 27, 28], "from": [1, 2, 7, 11, 13, 14, 20, 21, 22, 24, 25, 26, 27, 28, 29], "more": [1, 13, 17, 20, 21, 23, 24, 25, 27, 28, 29], "than": [1, 13, 17, 21, 23, 24, 27, 28], "one": [1, 6, 13, 17, 19, 20, 21, 23, 24, 28], "nearest_idavg": [1, 18, 28], "invers": 1, "distanc": [1, 5, 13, 28], "weight": [1, 3, 5, 9, 13, 17, 22, 23, 24, 28, 29], "averag": [1, 11, 13, 17, 28], "n": [1, 10, 11, 17, 19, 23], "The": [1, 2, 4, 7, 8, 11, 13, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "reciproc": 1, "rais": [1, 17, 19, 28], "power": [1, 17], "p": 1, "all": [1, 5, 11, 17, 19, 20, 21, 24, 25, 26, 27], "contribut": [1, 19, 24, 28], "normal": [1, 9, 17, 26, 28], "so": [1, 13, 17, 19, 21, 24], "thei": [1, 17, 25], "sum": [1, 13, 19, 21, 27], "can": [1, 4, 5, 7, 11, 14, 17, 19, 20, 21, 23, 24, 25, 26, 27], "choos": [1, 24], "when": [1, 3, 5, 9, 13, 14, 17, 20, 23, 24, 26, 28, 29], "default": [1, 5, 17, 20, 21, 23, 25, 26, 27, 28, 29], "provid": [1, 13, 17, 21, 24, 27], "creep_fil": [1, 18], "3": [1, 2, 6, 7, 11, 13, 14, 15, 17, 19, 21, 23, 25, 27, 28], "creep": [1, 28], "fill": [1, 11, 28], "repeatedli": 1, "move": [1, 27], "data": [1, 2, 4, 8, 12, 14, 17, 18, 19, 20, 21, 23, 24, 25, 27, 28, 29], "locat": [1, 8, 13, 14, 17, 19, 20, 21, 23, 25, 27], "neighbor": [1, 13, 24], "new": [1, 11, 19], "its": [1, 13, 17, 20], "alreadi": [1, 21, 23], "process": [1, 17, 19, 24, 26], "repeat": 1, "number": [1, 11, 17, 19, 20, 21, 23, 25, 26, 27, 28], "level": [1, 17, 23, 28], "via": [1, 28], "extrap_num_level": [1, 28], "paramet": [1, 11, 17, 20, 21, 25, 26, 27, 28, 29], "support": [1, 17, 20, 21, 23, 24, 27, 28], "conserv": [1, 4, 5, 9, 13, 17, 18, 19, 21, 23, 24, 28], "mesh": [2, 7, 8, 9, 13, 18, 20, 22, 23, 24, 26, 28, 29], "object": [2, 12, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "creat": [2, 13, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "specif": [2, 17, 23, 27], "netcdf": [2, 17, 20, 21, 23, 24, 27, 28], "file": [2, 3, 6, 20, 21, 22, 23, 24, 26, 27, 28, 29], "format": [2, 19, 21, 22, 24, 27, 28], "vtk": [2, 18], "scrip": [2, 18, 19, 21, 24, 27], "esmfmesh": [2, 18, 19, 27], "unstructur": [2, 17, 19, 24, 27], "esmfgrid": [2, 18], "4": [2, 7, 13, 14, 15, 17, 18, 19, 21, 23], "esmf": [2, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "structur": [2, 17], "ugrid": [2, 18, 24, 27], "5": [2, 13, 14, 15, 17, 22], "gridspec": [2, 18, 19, 21, 24], "6": [2, 7, 14, 15, 17, 19, 21, 23, 24, 28], "singl": [2, 17, 20, 21, 23, 24, 27], "tile": [2, 21, 23, 24], "base": [2, 13, 17], "cf": [2, 17, 19, 20, 21, 24, 27], "v1": [2, 24], "convent": [2, 17, 20, 24], "k": [2, 19, 24], "mode": [3, 17], "write": [3, 22, 23], "basic": [3, 18, 23, 24], "onli": [3, 5, 13, 17, 19, 20, 21, 23, 26, 27, 28, 29], "factorlist": 3, "factorindexlist": 3, "written": [3, 23], "withaux": [3, 18], "center": [3, 11, 13, 14, 17, 18, 19, 20, 21], "cell": [3, 5, 9, 13, 14, 19, 20, 21, 22, 24, 27, 28], "area": [3, 4, 9, 18, 19, 20, 21, 24, 27], "contain": [4, 13, 17, 19, 20, 21, 23, 27, 28], "kind": [4, 15, 17, 24], "besid": [4, 17, 25], "item": [4, 17, 20, 21], "some": [4, 11, 17, 21, 23], "calcul": [4, 5, 9, 13, 17, 19, 21, 24, 27, 28], "involv": [4, 17, 19], "mask": [4, 18, 19, 21, 22, 24, 25, 27, 28], "repres": [4, 17, 20, 21, 24, 25, 27, 28, 29], "an": [4, 11, 12, 15, 16, 17, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "field": [4, 8, 12, 13, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29], "argument": [5, 17, 19, 20, 21, 25, 27, 28, 29], "path": [5, 17, 19, 23, 24, 28], "line": [5, 17, 24, 28], "connect": [5, 10, 17, 19, 21, 27, 28], "two": [5, 17, 19, 21, 24, 27, 28, 29], "surfac": [5, 17, 27, 28], "sphere": [5, 11, 17, 21, 23, 24, 27, 28], "turn": [5, 28], "along": [5, 17, 27, 28], "shape": [5, 17, 19, 27, 28], "edg": [5, 10, 14, 17, 28], "make": [5, 17, 19, 23, 25, 27, 28], "up": [5, 17, 23, 27, 28], "quantiti": [5, 17], "influenc": [5, 17, 28], "interpol": [5, 11, 13, 17, 18, 19, 24, 28, 29], "As": [5, 17], "would": [5, 17, 27], "expect": [5, 17], "applic": [5, 17, 23, 24, 26, 28], "lie": [5, 11], "option": [5, 9, 11, 17, 19, 20, 21, 23, 24, 25, 27, 28, 29], "straight": [5, 17, 24], "through": [5, 17, 21, 23, 24], "3d": [5, 7, 14, 17, 20, 21, 22, 24, 27], "space": [5, 17, 21, 24, 27], "embed": [5, 17], "approxim": [5, 13], "plane": [5, 17], "bound": [5, 19, 20, 21, 25], "between": [5, 11, 13, 17, 19, 24, 27, 28, 29], "corner": [5, 13, 14, 17, 18, 19, 20, 21, 27], "vertic": [5, 14], "current": [5, 13, 17, 20, 26, 27, 28], "except": [5, 17, 19], "great_circl": [5, 18, 28], "great": [5, 22, 24], "circl": [5, 22, 24], "shortest": 5, "much": [6, 13, 17], "log": [6, 19, 22, 26], "multi": [6, 17, 18, 23], "per": [6, 17, 20], "pet": [6, 17, 19, 21, 26], "do": [6, 9, 17, 19, 27, 28], "issu": [6, 19, 23, 24, 26], "messag": [6, 17, 28], "construct": [7, 11, 13, 17, 25, 27, 28], "combin": [7, 13, 17], "differ": [7, 11, 13, 14, 17, 19, 20, 21, 24, 27], "element": [7, 8, 10, 12, 13, 17, 18, 21, 22, 23, 27, 28], "depend": [7, 25], "parametr": [7, 17, 19, 27], "set": [7, 11, 14, 17, 19, 21, 23, 24, 25, 26, 27, 28], "dure": [7, 13, 17, 26], "creation": [7, 21, 26, 27, 28, 29], "valid": [7, 17, 22, 25], "2d": [7, 13, 14, 17, 20, 21, 22, 24, 27], "tri": [7, 17, 18, 19], "triangular": 7, "side": [7, 17, 21], "quad": [7, 17, 18, 19], "quadrilater": [7, 17], "tetra": [7, 18], "10": [7, 17, 19], "tetrahedr": 7, "face": [7, 14], "hex": [7, 18], "12": [7, 17, 19, 21], "hexahedr": 7, "hold": [8, 17, 19, 27, 28, 29], "node": [8, 11, 17, 18, 19, 20, 27], "allow": [9, 17, 23, 26, 27, 28], "select": [9, 12, 17, 18, 19, 28], "produc": [9, 24, 28], "dstarea": [9, 18, 28], "divid": 9, "overlap": [9, 13, 24], "entir": [9, 11, 17, 23], "word": [9, 17], "fraction": [9, 19], "fracarea": [9, 18], "addit": [9, 17, 28], "just": 9, "part": [9, 17, 27], "describ": [10, 17, 21, 24, 25, 27], "occur": [10, 11, 21, 28], "pole": [10, 11, 21, 24, 28], "No": [10, 11], "monopol": [10, 18, 21], "itself": 10, "long": [10, 17], "bipol": [10, 18], "artifici": [11, 17, 28], "abov": [11, 23], "top": [11, 14, 17, 23], "below": [11, 21, 27, 28], "bottom": [11, 14], "row": [11, 28], "won": [11, 17], "t": [11, 17, 23], "allavg": [11, 18, 28], "place": [11, 17, 24], "project": [11, 24], "onto": [11, 20], "form": [11, 17], "rest": 11, "surround": [11, 13], "npntavg": [11, 18], "next": 11, "regridpolenpnt": 11, "rang": [11, 13, 17, 19, 23], "around": [11, 17], "zero": [11, 17, 19, 28, 29], "out": [11, 17, 24, 28, 29], "vector": 11, "compon": [11, 23, 24], "teeth": [11, 18], "instead": [11, 17, 23], "hole": 11, "triangl": [11, 17], "across": [11, 13, 17, 21, 24], "becaus": [11, 13, 17], "howev": [11, 13, 17, 19, 28], "now": [11, 17], "flat": 11, "big": 11, "enough": 11, "mismatch": [11, 25], "size": [11, 17, 18, 19, 21, 25, 27], "still": [11, 17], "abl": [11, 25], "variou": [12, 17, 24], "layout": [12, 17], "total": [12, 17, 18, 21, 26, 28, 29], "oper": [12, 17, 19, 21, 24, 27, 28, 29], "appli": [12, 17, 19, 23, 28], "everi": [12, 21], "domain": [12, 24], "portion": [12, 17], "One": [12, 17], "retain": 12, "origin": [12, 17, 24, 26], "oppos": 12, "being": [12, 17], "initi": [12, 17, 20, 22, 26, 28], "empti": [12, 18, 27], "doe": [12, 13, 17, 19, 20, 28], "ani": [12, 17, 19, 23, 24, 25, 28], "bilinear": [13, 17, 18, 19, 24, 28], "linear": [13, 17, 24], "patch": [13, 17, 18, 24], "higher": [13, 17, 24, 28], "recoveri": [13, 24], "polynomi": [13, 24], "typic": 13, "result": [13, 16, 17, 19, 24, 25, 26, 28, 29], "better": [13, 17, 24], "deriv": [13, 21, 24, 25], "larger": [13, 27, 28], "stencil": 13, "matrix": [13, 16, 19, 24], "thu": [13, 17], "routehandl": [13, 28, 29], "first": [13, 14, 17, 21, 23, 24, 26, 28], "main": [13, 19], "purpos": 13, "preserv": [13, 24], "integr": [13, 17, 23, 24], "treat": [13, 28], "have": [13, 17, 19, 20, 21, 26, 27, 28], "error": [13, 16, 18, 19, 25, 28], "determin": [13, 19, 21, 24, 26], "amount": [13, 28], "requir": [13, 17, 20, 21, 22, 27, 28, 29], "It": [13, 17, 21, 24, 28], "work": [13, 17, 19, 23], "": [13, 17, 23, 27, 28], "stagger": [13, 14, 19, 20, 21], "version": [13, 23, 24, 28], "nearest_dto": [13, 17, 18, 19], "conserve_2nd": [13, 17, 18], "second": [13, 14, 17, 21, 24, 25, 28], "take": [13, 16, 17, 23, 24, 26, 28], "gradient": [13, 24], "account": [13, 19], "yield": 13, "smoother": [13, 24], "match": 13, "particularli": 13, "appar": 13, "coars": 13, "finer": 13, "anoth": [13, 17], "guarante": 13, "within": [13, 17, 25], "For": [13, 17, 21, 25, 27, 28, 29], "exampl": [13, 17, 19, 23, 25], "mininum": 13, "possibl": [13, 17], "less": [13, 17, 21], "posit": [14, 17, 25], "retriev": [14, 17, 19, 23, 26, 28, 29], "tell": [14, 19, 21, 27], "where": [14, 17, 19, 21, 28], "get": [14, 19, 22], "edge1": [14, 18], "edge2": [14, 18], "center_vcent": [14, 18, 19, 20, 21], "edge1_vcent": [14, 18], "edge2_vcent": [14, 18], "corner_vcent": [14, 18], "center_vfac": [14, 18], "edge1_vfac": [14, 18], "edge2_vfac": [14, 18], "corner_vfac": [14, 18, 19], "7": [14, 17, 19, 23], "underli": [15, 17, 20, 21, 25, 27, 28, 29], "librari": [15, 17, 23, 25, 27, 28], "routin": [15, 17], "i4": [15, 18, 25], "four": [15, 17], "byte": 15, "integ": [15, 17, 21, 27], "equival": [15, 17], "numpi": [15, 19, 21, 22, 23, 27, 28], "int32": [15, 17, 19, 28], "i8": [15, 18], "eight": 15, "int64": 15, "r4": [15, 18], "real": 15, "float32": 15, "r8": [15, 18, 19, 20, 21, 25], "float64": [15, 28], "what": 16, "action": [16, 17, 26, 28], "respect": [16, 17, 28], "entri": [16, 17, 20, 21, 27], "spars": [16, 24], "correspond": [16, 17, 24, 27, 28, 29], "code": [16, 17, 19, 21, 22], "return": [16, 19, 20, 21, 25, 26, 27, 28, 29], "ignor": [16, 17, 18, 19, 24, 28], "variabl": [17, 19, 20, 21, 23, 26, 27, 28], "built": [17, 19, 20, 23], "accomplish": 17, "explain": 17, "detail": [17, 23, 26], "section": 17, "link": [17, 22, 23, 28], "tabl": 17, "descript": [17, 21], "final": [17, 26], "logic": [17, 21, 24], "rectangular": [17, 21, 24], "observ": [17, 24, 25], "collect": [17, 24, 26], "disconnect": [17, 19], "util": [17, 19, 24], "regridfromfil": [17, 18, 19, 22], "avail": [17, 19, 21, 23, 24, 26, 28], "varieti": [17, 24], "list": [17, 19, 20, 21, 23, 25, 27, 28], "page": [17, 22, 24], "further": 17, "coordsi": [17, 18, 19, 21, 22, 25, 27], "extrapmethod": [17, 18, 22, 28], "fileformat": [17, 18, 19, 21, 22, 27], "filemod": [17, 18, 22, 28], "griditem": [17, 18, 19, 21, 22], "linetyp": [17, 18, 22, 28], "logkind": [17, 18, 22], "meshelemtyp": [17, 18, 19, 22, 27], "meshloc": [17, 18, 19, 20, 22, 27], "nodal": 17, "normtyp": [17, 18, 22, 28], "polekind": [17, 18, 21, 22], "appear": 17, "polemethod": [17, 18, 22, 28], "region": [17, 18, 19, 21, 22, 24, 27, 28, 29], "regridmethod": [17, 18, 19, 22, 28], "staggerloc": [17, 18, 19, 20, 21, 22], "typekind": [17, 18, 19, 20, 21, 22], "unmappedact": [17, 18, 19, 22, 28], "simplifi": 17, "low": 17, "call": [17, 19, 24, 25, 26, 27, 28, 29], "framework": [17, 24], "enabl": [17, 19, 26], "garbag": [17, 28], "virtual": 17, "machin": [17, 19, 23], "vm": [17, 26], "begin": 17, "inform": [17, 20, 21, 23, 24, 25, 26, 27, 28, 29], "about": [17, 29], "topologi": [17, 21, 27], "characterist": 17, "comput": [17, 21, 22], "persist": [17, 26], "thread": [17, 26], "These": [17, 19, 24, 28], "lifetim": 17, "least": [17, 20, 24], "simplest": 17, "most": [17, 21], "common": [17, 19, 23], "case": [17, 19], "queri": 17, "mg": [17, 19], "pet_count": [17, 18, 19, 26], "local_pet": [17, 18, 19, 26], "manual": [17, 20, 21, 23, 24, 25, 27, 28, 29], "debug": [17, 19, 26], "true": [17, 19, 21, 25, 26, 28], "output": [17, 19, 23, 26, 28], "esmf_logfil": [17, 26], "need": [17, 19, 20, 23, 24, 25, 27], "onc": 17, "handl": [17, 19, 24, 28, 29], "intern": [17, 21, 25], "explicit": [17, 26, 28, 29], "intervent": 17, "featur": 17, "trigger": 17, "until": [17, 26], "invok": [17, 23], "happen": [17, 28, 29], "goe": [17, 28, 29], "scope": [17, 28, 29], "end": [17, 21, 23], "program": [17, 19, 23], "If": [17, 20, 21, 23, 25, 26, 27, 28, 29], "dealloc": [17, 28, 29], "prior": [17, 26], "destroi": [17, 18, 20, 21, 25, 27, 28, 29], "commonli": [17, 24], "reus": 17, "mani": [17, 21, 23, 24, 28], "pair": 17, "set_moab": [17, 18, 26], "moab_on": [17, 26], "altern": 17, "nativ": [17, 26], "yet": 17, "full": 17, "There": [17, 23, 24, 25], "three": 17, "represent": 17, "polygon": 17, "individu": [17, 20, 21, 25, 27], "nearli": 17, "ident": 17, "counterpart": 17, "same": [17, 20, 21, 27], "simplif": 17, "eas": 17, "python": [17, 20, 21, 22, 23, 24, 25, 26, 27, 28], "environ": [17, 23], "geometri": [17, 21], "physic": [17, 20, 21], "like": [17, 19, 23, 24], "finit": 17, "techniqu": 17, "includ": [17, 23, 24, 25], "count": [17, 19, 21], "assumpt": [17, 25], "suffici": [17, 21], "arakawa": 17, "shortcut": 17, "standard": [17, 25], "interfac": [17, 20, 22, 23, 24, 28], "custom": 17, "symmetr": 17, "enclos": 17, "perimet": 17, "mean": [17, 19, 20], "arrai": [17, 19, 20, 21, 25, 27, 28], "pad": 17, "achiev": 17, "alter": 17, "elimin": 17, "appropri": [17, 24, 25], "ad": [17, 27, 28, 29], "np": [17, 19], "coord_si": [17, 18, 19, 21, 25, 27], "either": [17, 21, 24, 27], "global": [17, 19, 24], "model": [17, 24], "assum": 17, "perfect": 17, "build": [17, 19, 23, 24], "num_peri_dim": [17, 18, 19, 21], "periodic_dim": [17, 18, 19, 21], "identifi": [17, 25], "consid": [17, 28], "must": [17, 19, 20, 23, 25, 27], "alwai": [17, 26, 27, 28], "non": 17, "pole_dim": [17, 18, 19, 21], "help": 17, "smooth": 17, "polar": 17, "mark": 17, "affect": [17, 23], "those": [17, 20, 21, 25, 27, 28], "assign": [17, 21], "defin": [17, 21, 27], "activ": 17, "discuss": 17, "cover": 17, "import": [17, 19, 22], "add_item": [17, 18, 19, 21], "dtype": [17, 19, 28], "Then": 17, "get_area": [17, 18, 19, 20], "function": [17, 22, 24, 28, 29], "unit": [17, 23], "ha": [17, 19, 21, 23, 24, 26], "been": [17, 19, 21, 23], "get_item": [17, 18, 21], "gridlon": [17, 19], "gridlat": [17, 19], "gridloncorn": 17, "gridlatcorn": 17, "lon": [17, 19, 21, 25, 27], "linspac": 17, "120": 17, "lat": [17, 19, 21, 25, 27], "67": 17, "lon_corn": [17, 19], "arang": [17, 19], "180": [17, 19], "lat_corn": [17, 19], "90": [17, 19], "lonm": [17, 19], "latm": [17, 19], "meshgrid": [17, 19], "ij": [17, 19], "lonm_corn": 17, "latm_corn": 17, "32224085": 17, "02707409": 17, "known": [17, 24, 27], "vertex": [17, 20, 27], "small": [17, 23, 27], "term": [17, 27], "boundari": [17, 27], "thought": [17, 25], "compos": [17, 27], "tetrahedra": 17, "squar": [17, 24, 27], "were": 17, "whose": 17, "equal": [17, 21], "manifold": [17, 27], "behav": 17, "tetrahedron": 17, "hexahedron": 17, "particular": [17, 25], "mix": [17, 25], "cannot": [17, 23, 27], "To": [17, 23, 25], "we": [17, 23], "properti": [17, 20, 21, 25, 26, 27], "whole": 17, "hand": 17, "distribut": [17, 20], "strategi": 17, "present": 17, "associ": [17, 20, 21, 25, 27, 28, 29], "without": [17, 19, 20, 23, 28], "home": [17, 24], "sinc": 17, "duplic": 17, "manner": [17, 19, 20, 21, 25, 27, 28, 29], "own": [17, 27], "ownership": 17, "smaller": [17, 27], "id": [17, 19, 26, 27], "node_id": [17, 27], "node_coord": [17, 27], "node_own": [17, 27], "uniqu": 17, "attach": [17, 28], "togeth": 17, "piec": [17, 19], "owner": 17, "charg": 17, "element_id": [17, 27], "element_typ": [17, 27], "element_conn": [17, 27], "choic": 17, "restrict": 17, "hexagon": 17, "impli": 17, "note": [17, 19, 20, 23, 24, 27, 28], "NOT": [17, 21, 27], "local": [17, 21], "info": 17, "isn": 17, "counterclockwis": [17, 27], "step": [17, 21, 27], "constructor": [17, 27], "add_nod": [17, 18, 19, 27], "add_el": [17, 18, 19, 27], "8": [17, 19, 23, 28], "11": [17, 19], "9": [17, 19], "parametric_dim": [17, 19, 27], "spatial_dim": [17, 19, 27], "num_nod": [17, 19], "num_elem": [17, 19], "nodeid": [17, 19], "nodecoord": [17, 19], "nodeown": [17, 19], "elemid": [17, 19], "elemtyp": [17, 19], "elemconn": [17, 19], "elem": 17, "similar": 17, "vari": 17, "slightli": [17, 19], "node_mask": [17, 27], "src_mask_valu": [17, 19, 28], "dst_mask_valu": [17, 19, 28], "element_mask": [17, 27], "element_area": [17, 27], "assimil": [17, 25], "world": [17, 22, 25], "store": [17, 20, 21, 25, 28], "kei": [17, 25, 28], "essenti": 17, "descriptor": [17, 25], "referenc": [17, 20, 21, 25, 27], "while": [17, 24, 28], "chosen": 17, "maintain": 17, "veri": [17, 23], "larg": 17, "might": 17, "effici": 17, "critic": 17, "irregularli": 17, "fact": 17, "relationship": [17, 20], "16": [17, 19, 21], "deg_rad": [17, 19], "pi": [17, 19], "25": [17, 19], "domask": [17, 19], "packag": [17, 18, 22, 24], "capabl": [17, 23, 24, 26], "found": [17, 23, 24, 28], "compat": 17, "convers": 17, "extens": 17, "climat": [17, 24], "forecast": [17, 24], "metadata": [17, 20, 27], "earth": [17, 24], "therefor": [17, 21], "convert_to_du": [17, 27], "properli": [17, 26], "boolean": [17, 19, 21, 26, 27], "whether": [17, 19, 21, 26, 27], "add": [17, 19, 21, 27], "add_user_area": [17, 21, 27], "add_mask": [17, 21], "held": 17, "varnam": [17, 21, 27], "unmask": 17, "is_spher": [17, 21], "add_corner_stagg": [17, 19, 21], "read": [17, 18, 20, 21, 22, 23, 24, 28, 29], "them": [17, 19, 23], "coord_nam": [17, 21], "grid_imask": 17, "particip": 17, "short": 17, "behavior": 17, "potenti": 17, "solut": [17, 19], "necessarili": 17, "could": [17, 19], "signific": 17, "avoid": 17, "over": [17, 21, 28], "ocean": 17, "basin": 17, "run": [17, 22, 23, 26], "half": 17, "wai": [17, 21, 27], "shorter": 17, "exact": 17, "opposit": 17, "antipod": 17, "problem": [17, 23, 24], "break": 17, "insert": 17, "extra": [17, 19, 20], "target": [17, 23], "resolv": 17, "ambigu": 17, "direct": 17, "wherebi": 17, "certain": 17, "unus": 17, "land": [17, 24], "upon": [17, 20], "pass": 17, "high": 17, "similarli": 17, "zero_region": [17, 19, 28, 29], "uniniti": 17, "among": 17, "thing": 17, "come": 17, "fanci": 17, "dimension": [17, 19, 24], "effort": 17, "put": 17, "inappropri": 17, "attempt": [17, 23], "rememb": [17, 28], "propag": 17, "down": [17, 24], "lower": [17, 19, 20, 21, 25], "fortran": [17, 19, 20, 21, 25, 27], "c": [17, 23, 28], "engin": [17, 24], "updat": 17, "made": 17, "feel": 17, "natur": 17, "translat": 17, "continu": 17, "likewis": 17, "befor": [17, 27, 28, 29], "tempor": 17, "coord": [17, 18, 21, 27], "22": [17, 19], "ndbound": [17, 18, 19, 20], "time": [17, 20, 23, 26, 27], "thin": 17, "wrapper": [17, 20, 21, 25, 27], "wa": [17, 23, 28], "design": [17, 24, 26], "perform": [17, 21], "scalabl": [17, 24], "layer": 17, "transpar": 17, "littl": 17, "special": 17, "access": [17, 18, 24], "mpi4pi": [17, 19, 23], "necessari": [17, 19, 23], "post": 17, "task": 17, "few": [17, 23], "desir": [17, 19, 20, 23], "core": [17, 26], "probabl": [17, 19], "easiest": 17, "job": 17, "serial": [17, 22, 23], "script": [17, 19], "mpich": [17, 19], "openmpi": [17, 19, 23], "seen": 17, "success": 17, "third": 17, "highli": 17, "recommend": [17, 23], "demonstr": [17, 19], "directori": [17, 23], "well": 17, "hello_world": 17, "py": 17, "sy": [17, 19], "parent": [17, 19], "len": [17, 19], "argv": [17, 19], "worker": [17, 19], "comm": [17, 19], "comm_world": [17, 19], "arg": [17, 19], "maxproc": [17, 19], "shutdown": [17, 19], "elif": [17, 19], "try": [17, 19, 23], "get_par": [17, 19], "rank": [17, 18, 19, 20, 21, 25, 26, 27], "get_rank": [17, 19], "valueerror": [17, 19], "usag": [17, 19], "etc": [17, 20, 21, 23], "print": [17, 19], "hello": [17, 22], "str": [17, 20, 21, 25, 27], "catch": [17, 19], "els": [17, 19], "tutori": [17, 22], "document": [17, 19, 23, 28], "manag": [18, 19, 22, 23, 28, 29], "moab": [18, 22, 26], "barrier": [18, 19, 26], "lower_bound": [18, 19, 20, 21, 25], "upper_bound": [18, 19, 20, 21, 25], "xd": [18, 20], "copi": [18, 20, 21, 25, 26, 27, 28, 29], "areatyp": [18, 21], "has_corn": [18, 21], "max_index": [18, 19, 21], "add_coord": [18, 19, 21], "size_own": [18, 27], "free_memori": [18, 27], "locstream": [18, 20, 22, 24, 28, 29], "__call__": [18, 28, 29], "get_factor": [18, 28], "get_weights_dict": [18, 28], "remap": [18, 24], "http": 18, "oceans11": 18, "lanl": 18, "gov": 18, "trac": 18, "last": [18, 20, 24], "dec": 18, "2015": 18, "lo": 18, "alamo": 18, "softwar": [18, 24], "releas": [18, 20, 21, 23, 24, 25, 27, 28, 29], "lacc": 18, "98": 18, "45": 18, "processor": [19, 23, 27], "snippet": 19, "def": 19, "create_locstream_spherical_16": 19, "fals": [19, 21, 26, 27, 28], "param": [19, 20], "create_locstream_spherical_16_parallel": 19, "grid_create_from_coordin": 19, "xcoord": 19, "ycoord": 19, "xcorner": 19, "ycorner": 19, "doarea": 19, "ctk": 19, "coordiant": 19, "1st": 19, "2nd": 19, "arbitrari": 19, "alloc": [19, 20, 21, 22, 27], "coord_typekind": [19, 21], "gridxcent": 19, "x_par": 19, "reshap": 19, "gridycent": 19, "y_par": 19, "lbx": 19, "ubx": 19, "lby": 19, "ubi": 19, "gridxcorn": 19, "i0": 19, "gridycorn": 19, "i1": 19, "75": 19, "grid_create_from_coordinates_3d": 19, "zcoord": 19, "zcorner": 19, "xcoordin": 19, "ycoordin": 19, "zcoordin": 19, "3rd": 19, "gridzcent": 19, "z_par": 19, "lbz": 19, "ubz": 19, "gridzcorn": 19, "i2": 19, "grid_create_from_coordinates_period": 19, "lon_par": 19, "lat_par": 19, "mesh_create_5": 19, "precondit": 19, "postcondit": 19, "31": 19, "32": 19, "33": 19, "21": 19, "23": 19, "13": 19, "spatial": [19, 22, 27], "elemcoord": 19, "element_coord": [19, 27], "create_field": 19, "gml": 19, "string": [19, 27, 28, 29], "initialize_field_grid_period": 19, "deg2rad": 19, "141592653589793": 19, "pointer": 19, "gridxcoord": 19, "gridycoord": 19, "co": 19, "run_regrid": 19, "srcfield": [19, 28, 29], "dstfield": [19, 28, 29], "srcfracfield": 19, "dstfracfield": 19, "modifi": 19, "dstfractfield": 19, "regridsrc2dst": 19, "regrid_method": [19, 28], "unmapped_act": [19, 28], "src_frac_field": [19, 28], "dst_frac_field": [19, 28], "compute_mass_grid": 19, "valuefield": 19, "dofrac": 19, "fracfield": 19, "uninitv": 19, "422397696": 19, "give": [19, 24], "float": [19, 21, 27, 28], "areafield": 19, "ind": 19, "stand": 19, "alon": 19, "modif": 19, "o": 19, "cache_data": 19, "data_dir": 19, "datamiss": 19, "repositori": [19, 23], "uncom": 19, "block": [19, 21, 26], "cache_data_fil": 19, "join": 19, "so_omon_giss": 19, "e2": 19, "nc": 19, "mpas_uniform_10242_dual_counterclockwis": 19, "datafil": 19, "exist": [19, 20, 23], "download": [19, 23, 24], "meshfil": 19, "filenam": [19, 20, 21, 27, 28, 29], "filetyp": [19, 21, 27], "timeslic": [19, 20], "clockwis": 19, "remov": 19, "1e20": 19, "successfulli": [19, 23], "style": 19, "novemb": 19, "2017": 19, "memori": [19, 20, 21, 22, 23, 25, 27, 28, 29], "350": 19, "85": 19, "srcgrid": 19, "srcgridcoordlon": 19, "srcgridcoordlat": 19, "slons_par": 19, "slats_par": 19, "sure": 19, "index": [19, 20, 21, 22, 28], "backend": [19, 22, 26], "dest": 19, "357": 19, "87": 19, "dstgrid": 19, "dstgridcoordlat": 19, "dstgridcoordlon": 19, "dlons_par": 19, "dlats_par": 19, "xctfield": 19, "wave": 19, "lambda": 19, "sin": 19, "outer": 19, "esmpy_example_weight_fil": 19, "isfil": 19, "getcwd": 19, "rel": [19, 23], "prod": 19, "relerr": 19, "meanrelerr": 19, "ab": 19, "reduce_v": 19, "op": [19, 26], "reduc": [19, 28], "matplotlib": 19, "pyplot": 19, "plt": 19, "fig": 19, "figur": 19, "15": 19, "suptitl": 19, "fontsiz": 19, "14": 19, "fontweight": 19, "bold": 19, "ax": 19, "add_subplot": 19, "im": 19, "imshow": 19, "vmin": 19, "vmax": 19, "cmap": 19, "gist_ncar": 19, "aspect": [19, 23], "auto": 19, "extent": 19, "min": 19, "max": 19, "set_xbound": 19, "upper": [19, 20, 21, 25], "set_ybound": 19, "set_xlabel": 19, "set_ylabel": 19, "set_titl": 19, "subplots_adjust": 19, "right": 19, "cbar_ax": 19, "add_ax": 19, "01": 19, "colorbar": 19, "cax": 19, "show": 19, "ll1deg_grid": 19, "grid1": 19, "locstream_util": 19, "14159": 19, "ravel": 19, "assert": 19, "5e": 19, "mesh_util": 19, "mesh_create_5_parallel": 19, "create_locstream_16": 19, "create_locstream_16_parallel": 19, "_": 19, "todo": 19, "seem": 19, "fail": 19, "occasion": 19, "due": [19, 25], "toler": 19, "ask": 19, "bob": 19, "3e": 19, "mask_valu": 19, "mul": 19, "4e": 19, "subprocess": 19, "instal": [19, 22], "juli": 19, "2016": 19, "importerror": 19, "grid2": 19, "uniform": 19, "latlon": 19, "compute_error": 19, "start_work": 19, "execut": [19, 22, 26], "gather": 19, "root": 19, "concaten": [19, 27], "plot": 19, "send": 19, "sendobj": 19, "temperatur": 20, "discret": [20, 21, 22], "nw": 20, "share": [20, 23], "replic": 20, "friendli": [20, 28], "tupl": [20, 27, 28], "ndarrai": [20, 27, 28], "int": [20, 21, 25, 26, 27, 28], "ungrid": 20, "safe": [20, 21, 25, 27, 28, 29], "shallow": [20, 21, 25, 27, 28, 29], "compliant": [20, 21, 27], "esmf_comm": 20, "mpiuni": 20, "pole_kind": 21, "reg_decomp": 21, "decompflag": 21, "tiles": 21, "regdecompptil": 21, "decomposit": 21, "resourc": [21, 22], "frequent": 21, "outlin": [21, 27], "length": 21, "period": [21, 22], "minimum": [21, 23], "maximum": 21, "bool": [21, 25, 26, 27, 28], "otherwis": [21, 23], "gener": [21, 24, 25, 28], "missing_valu": 21, "attribut": 21, "miss": 21, "even": 21, "4d": 21, "cube": [21, 23, 27], "de": 21, "decount": 21, "product": 21, "By": [21, 23], "decompos": 21, "sequenti": 21, "greater": [21, 23], "instanc": 21, "1x2": 21, "remain": 21, "from_fil": 21, "directli": [21, 27], "alias": [21, 27], "welcom": 22, "overview": 22, "anaconda": 22, "limit": 22, "helper": 22, "parallel": [22, 23, 24], "analyt": 22, "mass": [22, 28], "mpi": [22, 23], "spawn": 22, "driver": 22, "slice": 22, "mpirun": 22, "v": 22, "appendic": 22, "search": 22, "succe": 23, "pio": 23, "io": 23, "bind": 23, "pytest": 23, "test": 23, "git": 23, "guid": 23, "architectur": 23, "conda": 23, "forg": 23, "channel": 23, "develop": 23, "esmpy_dev": 23, "pip": 23, "command": [23, 24], "src": 23, "addon": 23, "python3": 23, "m": [23, 28], "pleas": [23, 24, 28, 29], "contact": [23, 24], "esmf_support": [23, 24], "ucar": [23, 24], "edu": [23, 24], "question": [23, 24], "With": 23, "automat": 23, "setuptool": 23, "think": 23, "you": 23, "caus": 23, "solv": 23, "simpli": 23, "rerun": 23, "see": [23, 24, 26, 28, 29], "reason": 23, "extern": 23, "esmfmkfil": 23, "guess": 23, "correctli": 23, "nonetheless": 23, "chang": [23, 24], "v8": 23, "older": 23, "previou": 23, "wider": 23, "coverag": 23, "test_unit": 23, "test_exampl": 23, "test_unit_parallel": 23, "test_examples_parallel": 23, "test_regrid_from_fil": 23, "regrid_from_fil": 23, "lot": 23, "bandwidth": 23, "download_regrid_from_fil": 23, "download_exampl": 23, "actual": 23, "stress": 23, "subdirectori": 23, "esmpy_data_dir": 23, "popul": 23, "pre": 23, "esmpy_data_new_dir": 23, "doesn": 23, "bundl": 23, "offlin": 23, "lapack": 23, "abil": 23, "fieldbundl": 23, "relat": [23, 24], "nightli": 23, "regress": 23, "subset": 23, "platform": [23, 24], "darwin": 23, "linux": 23, "gfortran": 23, "coupl": 24, "weather": 24, "robust": 24, "wide": 24, "unconnect": 24, "stream": [24, 25], "outsid": 24, "fulli": 24, "underneath": 24, "qualiti": 24, "transform": 24, "commun": [24, 26], "atmospher": 24, "analysi": 24, "visual": 24, "broken": 24, "stage": 24, "separ": 24, "suitabl": 24, "variant": 24, "algorithm": 24, "vice": 24, "versa": 24, "categor": 24, "proport": 24, "simpl": 24, "latest": 24, "bug": 24, "webpag": 24, "nice": 24, "esmf_regridweightgen": 24, "regid": 24, "thorough": 24, "location_count": 25, "dictionari": [25, 28], "Their": 25, "height": 25, "regular": 25, "concept": 25, "locstrea": 25, "syntax": 25, "recogn": 25, "esmpymanag": 26, "endflag": 26, "endact": 26, "singleton": 26, "ensur": 26, "__del__": 26, "regist": 26, "atexit": 26, "exit": 26, "alia": 26, "explicitli": 26, "runtim": 26, "esmp_initi": 26, "subsequ": 26, "esmp_fin": 26, "__init__": 26, "test_exhaust": 26, "member": 26, "combinatori": 26, "expans": 26, "logfil": 26, "docstr": 26, "meshnam": 27, "mask_flag": 27, "regrididng": 27, "dual": 27, "enumer": 27, "element_count": 27, "node_count": 27, "free": 27, "longer": 27, "ongo": 27, "rh_filenam": [28, 29], "pole_method": 28, "regrid_pole_npoint": 28, "line_typ": 28, "norm_typ": 28, "extrap_method": 28, "extrap_num_src_pnt": 28, "extrap_dist_expon": 28, "ignore_degener": 28, "create_rh": 28, "src_file": 28, "dst_file": 28, "src_file_typ": 28, "dst_file_typ": 28, "factor": 28, "large_fil": 28, "analog": [28, 29], "esmf_fieldregridstor": 28, "esmf_fieldregrid": [28, 29], "esmf_fieldregridreleas": [28, 29], "overwritten": [28, 29], "expon": 28, "distant": 28, "degener": 28, "check": 28, "proce": 28, "skip": 28, "convert": 28, "64": 28, "bit": 28, "offset": 28, "2gb": 28, "earlier": 28, "deep_copi": 28, "though": 28, "factors_index": 28, "tupe": 28, "col": 28, "contigu": 28, "accord": 28, "collector": 28, "numer": 28, "tight": 28, "loop": 28, "leak": 28, "deep": 28, "row_dst": 28, "col_src": 28, "dict": 28, "esmf_fieldsmmstor": 29}, "objects": {"": [[24, 0, 0, "-", "esmpy"]], "esmpy.api.constants": [[0, 1, 1, "", "CoordSys"], [1, 1, 1, "", "ExtrapMethod"], [2, 1, 1, "", "FileFormat"], [3, 1, 1, "", "FileMode"], [4, 1, 1, "", "GridItem"], [5, 1, 1, "", "LineType"], [6, 1, 1, "", "LogKind"], [7, 1, 1, "", "MeshElemType"], [8, 1, 1, "", "MeshLoc"], [9, 1, 1, "", "NormType"], [10, 1, 1, "", "PoleKind"], [11, 1, 1, "", "PoleMethod"], [12, 1, 1, "", "Region"], [13, 1, 1, "", "RegridMethod"], [14, 1, 1, "", "StaggerLoc"], [15, 1, 1, "", "TypeKind"], [16, 1, 1, "", "UnmappedAction"]], "esmpy.api.constants.CoordSys": [[0, 2, 1, "", "CART"], [0, 2, 1, "", "SPH_DEG"], [0, 2, 1, "", "SPH_RAD"]], "esmpy.api.constants.ExtrapMethod": [[1, 2, 1, "", "CREEP_FILL"], [1, 2, 1, "", "NEAREST_IDAVG"], [1, 2, 1, "", "NEAREST_STOD"], [1, 2, 1, "", "NONE"]], "esmpy.api.constants.FileFormat": [[2, 2, 1, "", "ESMFGRID"], [2, 2, 1, "", "ESMFMESH"], [2, 2, 1, "", "GRIDSPEC"], [2, 2, 1, "", "SCRIP"], [2, 2, 1, "", "UGRID"], [2, 2, 1, "", "VTK"]], "esmpy.api.constants.FileMode": [[3, 2, 1, "", "BASIC"], [3, 2, 1, "", "WITHAUX"]], "esmpy.api.constants.GridItem": [[4, 2, 1, "", "AREA"], [4, 2, 1, "", "MASK"]], "esmpy.api.constants.LineType": [[5, 2, 1, "", "CART"], [5, 2, 1, "", "GREAT_CIRCLE"]], "esmpy.api.constants.LogKind": [[6, 2, 1, "", "MULTI"], [6, 2, 1, "", "NONE"]], "esmpy.api.constants.MeshElemType": [[7, 2, 1, "", "HEX"], [7, 2, 1, "", "QUAD"], [7, 2, 1, "", "TETRA"], [7, 2, 1, "", "TRI"]], "esmpy.api.constants.MeshLoc": [[8, 2, 1, "", "ELEMENT"], [8, 2, 1, "", "NODE"]], "esmpy.api.constants.NormType": [[9, 2, 1, "", "DSTAREA"], [9, 2, 1, "", "FRACAREA"]], "esmpy.api.constants.PoleKind": [[10, 2, 1, "", "BIPOLE"], [10, 2, 1, "", "MONOPOLE"], [10, 2, 1, "", "NONE"]], "esmpy.api.constants.PoleMethod": [[11, 2, 1, "", "ALLAVG"], [11, 2, 1, "", "NONE"], [11, 2, 1, "", "NPNTAVG"], [11, 2, 1, "", "TEETH"]], "esmpy.api.constants.Region": [[12, 2, 1, "", "EMPTY"], [12, 2, 1, "", "SELECT"], [12, 2, 1, "", "TOTAL"]], "esmpy.api.constants.RegridMethod": [[13, 2, 1, "", "BILINEAR"], [13, 2, 1, "", "CONSERVE"], [13, 2, 1, "", "CONSERVE_2ND"], [13, 2, 1, "", "NEAREST_DTOS"], [13, 2, 1, "", "NEAREST_STOD"], [13, 2, 1, "", "PATCH"]], "esmpy.api.constants.StaggerLoc": [[14, 2, 1, "", "CENTER"], [14, 2, 1, "", "CENTER_VCENTER"], [14, 2, 1, "", "CENTER_VFACE"], [14, 2, 1, "", "CORNER"], [14, 2, 1, "", "CORNER_VCENTER"], [14, 2, 1, "", "CORNER_VFACE"], [14, 2, 1, "", "EDGE1"], [14, 2, 1, "", "EDGE1_VCENTER"], [14, 2, 1, "", "EDGE1_VFACE"], [14, 2, 1, "", "EDGE2"], [14, 2, 1, "", "EDGE2_VCENTER"], [14, 2, 1, "", "EDGE2_VFACE"]], "esmpy.api.constants.TypeKind": [[15, 2, 1, "", "I4"], [15, 2, 1, "", "I8"], [15, 2, 1, "", "R4"], [15, 2, 1, "", "R8"]], "esmpy.api.constants.UnmappedAction": [[16, 2, 1, "", "ERROR"], [16, 2, 1, "", "IGNORE"]], "esmpy.api.esmpymanager": [[26, 1, 1, "", "Manager"]], "esmpy.api.esmpymanager.Manager": [[26, 3, 1, "", "barrier"], [26, 4, 1, "", "local_pet"], [26, 4, 1, "", "moab"], [26, 4, 1, "", "pet_count"], [26, 3, 1, "", "set_moab"]], "esmpy.api.field": [[20, 1, 1, "", "Field"]], "esmpy.api.field.Field": [[20, 3, 1, "", "copy"], [20, 4, 1, "", "data"], [20, 3, 1, "", "destroy"], [20, 3, 1, "", "get_area"], [20, 4, 1, "", "grid"], [20, 4, 1, "", "lower_bounds"], [20, 4, 1, "", "name"], [20, 4, 1, "", "ndbounds"], [20, 4, 1, "", "rank"], [20, 3, 1, "", "read"], [20, 4, 1, "", "staggerloc"], [20, 4, 1, "", "type"], [20, 4, 1, "", "upper_bounds"], [20, 4, 1, "", "xd"]], "esmpy.api.grid": [[21, 1, 1, "", "Grid"]], "esmpy.api.grid.Grid": [[21, 3, 1, "", "add_coords"], [21, 3, 1, "", "add_item"], [21, 4, 1, "", "area"], [21, 4, 1, "", "areatype"], [21, 4, 1, "", "coord_sys"], [21, 4, 1, "", "coords"], [21, 3, 1, "", "copy"], [21, 3, 1, "", "destroy"], [21, 3, 1, "", "get_coords"], [21, 3, 1, "", "get_item"], [21, 4, 1, "", "has_corners"], [21, 4, 1, "", "lower_bounds"], [21, 4, 1, "", "mask"], [21, 4, 1, "", "max_index"], [21, 4, 1, "", "num_peri_dims"], [21, 4, 1, "", "periodic_dim"], [21, 4, 1, "", "pole_dim"], [21, 4, 1, "", "rank"], [21, 4, 1, "", "size"], [21, 4, 1, "", "staggerloc"], [21, 4, 1, "", "type"], [21, 4, 1, "", "upper_bounds"]], "esmpy.api.locstream": [[25, 1, 1, "", "LocStream"]], "esmpy.api.locstream.LocStream": [[25, 3, 1, "", "copy"], [25, 3, 1, "", "destroy"], [25, 4, 1, "", "lower_bounds"], [25, 4, 1, "", "name"], [25, 4, 1, "", "rank"], [25, 4, 1, "", "size"], [25, 4, 1, "", "upper_bounds"]], "esmpy.api.mesh": [[27, 1, 1, "", "Mesh"]], "esmpy.api.mesh.Mesh": [[27, 3, 1, "", "add_elements"], [27, 3, 1, "", "add_nodes"], [27, 4, 1, "", "area"], [27, 4, 1, "", "coord_sys"], [27, 4, 1, "", "coords"], [27, 3, 1, "", "copy"], [27, 3, 1, "", "destroy"], [27, 3, 1, "", "free_memory"], [27, 3, 1, "", "get_coords"], [27, 4, 1, "", "mask"], [27, 4, 1, "", "rank"], [27, 4, 1, "", "size"], [27, 4, 1, "", "size_owned"]], "esmpy.api.regrid": [[28, 1, 1, "", "Regrid"], [29, 1, 1, "", "RegridFromFile"]], "esmpy.api.regrid.Regrid": [[28, 3, 1, "", "__call__"], [28, 3, 1, "", "copy"], [28, 3, 1, "", "destroy"], [28, 3, 1, "", "get_factors"], [28, 3, 1, "", "get_weights_dict"]], "esmpy.api.regrid.RegridFromFile": [[29, 3, 1, "", "__call__"], [29, 3, 1, "", "copy"], [29, 3, 1, "", "destroy"]]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:attribute", "3": "py:method", "4": "py:property"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "attribute", "Python attribute"], "3": ["py", "method", "Python method"], "4": ["py", "property", "Python property"]}, "titleterms": {"coordsi": 0, "extrapmethod": 1, "fileformat": 2, "filemod": 3, "griditem": 4, "linetyp": 5, "logkind": 6, "meshelemtyp": 7, "meshloc": 8, "normtyp": 9, "polekind": 10, "polemethod": 11, "region": 12, "regridmethod": 13, "staggerloc": 14, "typekind": 15, "unmappedact": 16, "api": [17, 18], "class": [17, 18], "name": [17, 18], "constant": [17, 18], "manag": [17, 26], "resourc": 17, "alloc": 17, "log": 17, "memori": 17, "moab": 17, "mesh": [17, 19, 27], "backend": 17, "spatial": 17, "discret": 17, "object": 17, "grid": [17, 19, 21], "stagger": 17, "spheric": 17, "coordin": 17, "period": [17, 19], "pole": 17, "gener": 17, "mask": 17, "cell": 17, "area": 17, "creation": 17, "locstream": [17, 19, 25], "creat": [17, 19], "from": [17, 19, 23], "file": [17, 19], "format": 17, "scrip": 17, "esmfmesh": 17, "gridspec": 17, "ugrid": 17, "regrid": [17, 19, 28], "great": 17, "circl": 17, "numpi": 17, "slice": 17, "index": 17, "dimens": 17, "order": 17, "parallel": [17, 19], "execut": 17, "mpirun": 17, "v": 17, "mpi": [17, 19], "spawn": [17, 19], "appendic": 18, "refer": 18, "tutori": 19, "hello": 19, "world": 19, "helper": 19, "function": 19, "2d": 19, "3d": 19, "5": 19, "element": 19, "field": [19, 20], "initi": 19, "an": 19, "analyt": 19, "run": 19, "esmpi": [19, 23], "comput": 19, "mass": 19, "read": 19, "write": 19, "weight": 19, "us": 19, "serial": 19, "python": 19, "driver": 19, "tabl": 22, "content": 22, "instal": 23, "requir": 23, "get": 23, "code": 23, "anaconda": 23, "packag": 23, "sourc": 23, "import": [23, 24], "valid": 23, "limit": 23, "overview": 24, "link": 24, "regridfromfil": 29}, "envversion": {"sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.intersphinx": 1, "sphinxcontrib.bibtex": 9, "sphinx": 58}, "alltitles": {"CoordSys": [[0, "coordsys"]], "ExtrapMethod": [[1, "extrapmethod"]], "FileFormat": [[2, "fileformat"]], "FileMode": [[3, "filemode"]], "GridItem": [[4, "griditem"]], "LineType": [[5, "linetype"]], "LogKind": [[6, "logkind"]], "MeshElemType": [[7, "meshelemtype"]], "MeshLoc": [[8, "meshloc"]], "NormType": [[9, "normtype"]], "PoleKind": [[10, "polekind"]], "PoleMethod": [[11, "polemethod"]], "Region": [[12, "region"]], "RegridMethod": [[13, "regridmethod"]], "StaggerLoc": [[14, "staggerloc"]], "TypeKind": [[15, "typekind"]], "UnmappedAction": [[16, "unmappedaction"]], "API": [[17, "api"]], "Classes": [[17, "classes"]], "Named Constants": [[17, "named-constants"], [18, "named-constants"]], "Manager": [[17, "manager"], [26, "manager"]], "Resource Allocation": [[17, "resource-allocation"]], "Logging": [[17, "logging"]], "Memory management": [[17, "memory-management"]], "MOAB Mesh backend": [[17, "moab-mesh-backend"]], "Spatial Discretization Objects": [[17, "spatial-discretization-objects"]], "Grid": [[17, "grid"], [21, "grid"]], "Staggering": [[17, "staggering"]], "Spherical Coordinates": [[17, "spherical-coordinates"]], "Periodicity": [[17, "periodicity"]], "Pole Generation": [[17, "pole-generation"]], "Masking": [[17, "masking"], [17, "id3"], [17, "id15"]], "Cell Areas": [[17, "cell-areas"]], "Mesh": [[17, "mesh"], [27, "mesh"]], "Mesh Creation": [[17, "mesh-creation"]], "Areas": [[17, "areas"]], "LocStream": [[17, "locstream"], [25, "locstream"]], "Create a Grid or Mesh from File": [[17, "create-a-grid-or-mesh-from-file"]], "File Formats": [[17, "file-formats"]], "SCRIP": [[17, "scrip"]], "ESMFMESH": [[17, "esmfmesh"]], "GRIDSPEC": [[17, "gridspec"]], "UGRID": [[17, "ugrid"]], "Meshes from File": [[17, "meshes-from-file"]], "Grids from File": [[17, "grids-from-file"]], "Regridding": [[17, "regridding"], [19, "regridding"]], "Great Circle Cells": [[17, "great-circle-cells"]], "Numpy Slicing and Indexing": [[17, "numpy-slicing-and-indexing"]], "Dimension Ordering": [[17, "dimension-ordering"]], "Parallel Execution": [[17, "parallel-execution"]], "mpirun vs. MPI.Spawn": [[17, "mpirun-vs-mpi-spawn"]], "mpirun": [[17, "mpirun"]], "MPI.Spawn": [[17, "mpi-spawn"]], "Appendices": [[18, "appendices"]], "Class APIs": [[18, "class-apis"]], "References": [[18, "references"]], "Tutorials": [[19, "tutorials"]], "Hello World": [[19, "hello-world"]], "Regridding Helper Functions": [[19, "regridding-helper-functions"]], "LocStream Create": [[19, "locstream-create"]], "LocStream Create Parallel": [[19, "locstream-create-parallel"]], "Create a 2D Grid": [[19, "create-a-2d-grid"]], "Create a 3D Grid": [[19, "create-a-3d-grid"]], "Create a Periodic Grid": [[19, "create-a-periodic-grid"]], "Create a 5 Element Mesh": [[19, "create-a-5-element-mesh"]], "Create a Field": [[19, "create-a-field"]], "Initialize an Analytic Field": [[19, "initialize-an-analytic-field"]], "Run ESMPy Regridding": [[19, "run-esmpy-regridding"]], "Compute Field Mass": [[19, "compute-field-mass"]], "Grid, Mesh and Field Created from File": [[19, "grid-mesh-and-field-created-from-file"]], "Read and Write a Weight File": [[19, "read-and-write-a-weight-file"]], "Grid to LocStream": [[19, "grid-to-locstream"]], "Mesh to LocStream": [[19, "mesh-to-locstream"]], "LocStream to Grid": [[19, "locstream-to-grid"]], "Using MPI.Spawn() from a Serial Python Driver": [[19, "using-mpi-spawn-from-a-serial-python-driver"]], "Field": [[20, "field"]], "Table of Contents": [[22, "table-of-contents"]], "Installation": [[23, "installation"]], "Requirements": [[23, "requirements"]], "Getting the code": [[23, "getting-the-code"]], "Anaconda Packages": [[23, "anaconda-packages"]], "Installing ESMPy from Source": [[23, "installing-esmpy-from-source"]], "Importing ESMPy": [[23, "importing-esmpy"]], "Validation": [[23, "validation"]], "Limitations": [[23, "limitations"]], "Overview": [[24, "module-esmpy"]], "Important Links": [[24, "important-links"]], "Regrid": [[28, "regrid"]], "RegridFromFile": [[29, "regridfromfile"]]}, "indexentries": {"cart (esmpy.api.constants.coordsys attribute)": [[0, "esmpy.api.constants.CoordSys.CART"]], "coordsys (class in esmpy.api.constants)": [[0, "esmpy.api.constants.CoordSys"]], "sph_deg (esmpy.api.constants.coordsys attribute)": [[0, "esmpy.api.constants.CoordSys.SPH_DEG"]], "sph_rad (esmpy.api.constants.coordsys attribute)": [[0, "esmpy.api.constants.CoordSys.SPH_RAD"]], "creep_fill (esmpy.api.constants.extrapmethod attribute)": [[1, "esmpy.api.constants.ExtrapMethod.CREEP_FILL"]], "extrapmethod (class in esmpy.api.constants)": [[1, "esmpy.api.constants.ExtrapMethod"]], "nearest_idavg (esmpy.api.constants.extrapmethod attribute)": [[1, "esmpy.api.constants.ExtrapMethod.NEAREST_IDAVG"]], "nearest_stod (esmpy.api.constants.extrapmethod attribute)": [[1, "esmpy.api.constants.ExtrapMethod.NEAREST_STOD"]], "none (esmpy.api.constants.extrapmethod attribute)": [[1, "esmpy.api.constants.ExtrapMethod.NONE"]], "esmfgrid (esmpy.api.constants.fileformat attribute)": [[2, "esmpy.api.constants.FileFormat.ESMFGRID"]], "esmfmesh (esmpy.api.constants.fileformat attribute)": [[2, "esmpy.api.constants.FileFormat.ESMFMESH"]], "fileformat (class in esmpy.api.constants)": [[2, "esmpy.api.constants.FileFormat"]], "gridspec (esmpy.api.constants.fileformat attribute)": [[2, "esmpy.api.constants.FileFormat.GRIDSPEC"]], "scrip (esmpy.api.constants.fileformat attribute)": [[2, "esmpy.api.constants.FileFormat.SCRIP"]], "ugrid (esmpy.api.constants.fileformat attribute)": [[2, "esmpy.api.constants.FileFormat.UGRID"]], "vtk (esmpy.api.constants.fileformat attribute)": [[2, "esmpy.api.constants.FileFormat.VTK"]], "basic (esmpy.api.constants.filemode attribute)": [[3, "esmpy.api.constants.FileMode.BASIC"]], "filemode (class in esmpy.api.constants)": [[3, "esmpy.api.constants.FileMode"]], "withaux (esmpy.api.constants.filemode attribute)": [[3, "esmpy.api.constants.FileMode.WITHAUX"]], "area (esmpy.api.constants.griditem attribute)": [[4, "esmpy.api.constants.GridItem.AREA"]], "griditem (class in esmpy.api.constants)": [[4, "esmpy.api.constants.GridItem"]], "mask (esmpy.api.constants.griditem attribute)": [[4, "esmpy.api.constants.GridItem.MASK"]], "cart (esmpy.api.constants.linetype attribute)": [[5, "esmpy.api.constants.LineType.CART"]], "great_circle (esmpy.api.constants.linetype attribute)": [[5, "esmpy.api.constants.LineType.GREAT_CIRCLE"]], "linetype (class in esmpy.api.constants)": [[5, "esmpy.api.constants.LineType"]], "logkind (class in esmpy.api.constants)": [[6, "esmpy.api.constants.LogKind"]], "multi (esmpy.api.constants.logkind attribute)": [[6, "esmpy.api.constants.LogKind.MULTI"]], "none (esmpy.api.constants.logkind attribute)": [[6, "esmpy.api.constants.LogKind.NONE"]], "hex (esmpy.api.constants.meshelemtype attribute)": [[7, "esmpy.api.constants.MeshElemType.HEX"]], "meshelemtype (class in esmpy.api.constants)": [[7, "esmpy.api.constants.MeshElemType"]], "quad (esmpy.api.constants.meshelemtype attribute)": [[7, "esmpy.api.constants.MeshElemType.QUAD"]], "tetra (esmpy.api.constants.meshelemtype attribute)": [[7, "esmpy.api.constants.MeshElemType.TETRA"]], "tri (esmpy.api.constants.meshelemtype attribute)": [[7, "esmpy.api.constants.MeshElemType.TRI"]], "element (esmpy.api.constants.meshloc attribute)": [[8, "esmpy.api.constants.MeshLoc.ELEMENT"]], "meshloc (class in esmpy.api.constants)": [[8, "esmpy.api.constants.MeshLoc"]], "node (esmpy.api.constants.meshloc attribute)": [[8, "esmpy.api.constants.MeshLoc.NODE"]], "dstarea (esmpy.api.constants.normtype attribute)": [[9, "esmpy.api.constants.NormType.DSTAREA"]], "fracarea (esmpy.api.constants.normtype attribute)": [[9, "esmpy.api.constants.NormType.FRACAREA"]], "normtype (class in esmpy.api.constants)": [[9, "esmpy.api.constants.NormType"]], "bipole (esmpy.api.constants.polekind attribute)": [[10, "esmpy.api.constants.PoleKind.BIPOLE"]], "monopole (esmpy.api.constants.polekind attribute)": [[10, "esmpy.api.constants.PoleKind.MONOPOLE"]], "none (esmpy.api.constants.polekind attribute)": [[10, "esmpy.api.constants.PoleKind.NONE"]], "polekind (class in esmpy.api.constants)": [[10, "esmpy.api.constants.PoleKind"]], "allavg (esmpy.api.constants.polemethod attribute)": [[11, "esmpy.api.constants.PoleMethod.ALLAVG"]], "none (esmpy.api.constants.polemethod attribute)": [[11, "esmpy.api.constants.PoleMethod.NONE"]], "npntavg (esmpy.api.constants.polemethod attribute)": [[11, "esmpy.api.constants.PoleMethod.NPNTAVG"]], "polemethod (class in esmpy.api.constants)": [[11, "esmpy.api.constants.PoleMethod"]], "teeth (esmpy.api.constants.polemethod attribute)": [[11, "esmpy.api.constants.PoleMethod.TEETH"]], "empty (esmpy.api.constants.region attribute)": [[12, "esmpy.api.constants.Region.EMPTY"]], "region (class in esmpy.api.constants)": [[12, "esmpy.api.constants.Region"]], "select (esmpy.api.constants.region attribute)": [[12, "esmpy.api.constants.Region.SELECT"]], "total (esmpy.api.constants.region attribute)": [[12, "esmpy.api.constants.Region.TOTAL"]], "bilinear (esmpy.api.constants.regridmethod attribute)": [[13, "esmpy.api.constants.RegridMethod.BILINEAR"]], "conserve (esmpy.api.constants.regridmethod attribute)": [[13, "esmpy.api.constants.RegridMethod.CONSERVE"]], "conserve_2nd (esmpy.api.constants.regridmethod attribute)": [[13, "esmpy.api.constants.RegridMethod.CONSERVE_2ND"]], "nearest_dtos (esmpy.api.constants.regridmethod attribute)": [[13, "esmpy.api.constants.RegridMethod.NEAREST_DTOS"]], "nearest_stod (esmpy.api.constants.regridmethod attribute)": [[13, "esmpy.api.constants.RegridMethod.NEAREST_STOD"]], "patch (esmpy.api.constants.regridmethod attribute)": [[13, "esmpy.api.constants.RegridMethod.PATCH"]], "regridmethod (class in esmpy.api.constants)": [[13, "esmpy.api.constants.RegridMethod"]], "center (esmpy.api.constants.staggerloc attribute)": [[14, "esmpy.api.constants.StaggerLoc.CENTER"]], "center_vcenter (esmpy.api.constants.staggerloc attribute)": [[14, "esmpy.api.constants.StaggerLoc.CENTER_VCENTER"]], "center_vface (esmpy.api.constants.staggerloc attribute)": [[14, "esmpy.api.constants.StaggerLoc.CENTER_VFACE"]], "corner (esmpy.api.constants.staggerloc attribute)": [[14, "esmpy.api.constants.StaggerLoc.CORNER"]], "corner_vcenter (esmpy.api.constants.staggerloc attribute)": [[14, "esmpy.api.constants.StaggerLoc.CORNER_VCENTER"]], "corner_vface (esmpy.api.constants.staggerloc attribute)": [[14, "esmpy.api.constants.StaggerLoc.CORNER_VFACE"]], "edge1 (esmpy.api.constants.staggerloc attribute)": [[14, "esmpy.api.constants.StaggerLoc.EDGE1"]], "edge1_vcenter (esmpy.api.constants.staggerloc attribute)": [[14, "esmpy.api.constants.StaggerLoc.EDGE1_VCENTER"]], "edge1_vface (esmpy.api.constants.staggerloc attribute)": [[14, "esmpy.api.constants.StaggerLoc.EDGE1_VFACE"]], "edge2 (esmpy.api.constants.staggerloc attribute)": [[14, "esmpy.api.constants.StaggerLoc.EDGE2"]], "edge2_vcenter (esmpy.api.constants.staggerloc attribute)": [[14, "esmpy.api.constants.StaggerLoc.EDGE2_VCENTER"]], "edge2_vface (esmpy.api.constants.staggerloc attribute)": [[14, "esmpy.api.constants.StaggerLoc.EDGE2_VFACE"]], "staggerloc (class in esmpy.api.constants)": [[14, "esmpy.api.constants.StaggerLoc"]], "i4 (esmpy.api.constants.typekind attribute)": [[15, "esmpy.api.constants.TypeKind.I4"]], "i8 (esmpy.api.constants.typekind attribute)": [[15, "esmpy.api.constants.TypeKind.I8"]], "r4 (esmpy.api.constants.typekind attribute)": [[15, "esmpy.api.constants.TypeKind.R4"]], "r8 (esmpy.api.constants.typekind attribute)": [[15, "esmpy.api.constants.TypeKind.R8"]], "typekind (class in esmpy.api.constants)": [[15, "esmpy.api.constants.TypeKind"]], "error (esmpy.api.constants.unmappedaction attribute)": [[16, "esmpy.api.constants.UnmappedAction.ERROR"]], "ignore (esmpy.api.constants.unmappedaction attribute)": [[16, "esmpy.api.constants.UnmappedAction.IGNORE"]], "unmappedaction (class in esmpy.api.constants)": [[16, "esmpy.api.constants.UnmappedAction"]], "field (class in esmpy.api.field)": [[20, "esmpy.api.field.Field"]], "copy() (esmpy.api.field.field method)": [[20, "esmpy.api.field.Field.copy"]], "data (esmpy.api.field.field property)": [[20, "esmpy.api.field.Field.data"]], "destroy() (esmpy.api.field.field method)": [[20, "esmpy.api.field.Field.destroy"]], "get_area() (esmpy.api.field.field method)": [[20, "esmpy.api.field.Field.get_area"]], "grid (esmpy.api.field.field property)": [[20, "esmpy.api.field.Field.grid"]], "lower_bounds (esmpy.api.field.field property)": [[20, "esmpy.api.field.Field.lower_bounds"]], "name (esmpy.api.field.field property)": [[20, "esmpy.api.field.Field.name"]], "ndbounds (esmpy.api.field.field property)": [[20, "esmpy.api.field.Field.ndbounds"]], "rank (esmpy.api.field.field property)": [[20, "esmpy.api.field.Field.rank"]], "read() (esmpy.api.field.field method)": [[20, "esmpy.api.field.Field.read"]], "staggerloc (esmpy.api.field.field property)": [[20, "esmpy.api.field.Field.staggerloc"]], "type (esmpy.api.field.field property)": [[20, "esmpy.api.field.Field.type"]], "upper_bounds (esmpy.api.field.field property)": [[20, "esmpy.api.field.Field.upper_bounds"]], "xd (esmpy.api.field.field property)": [[20, "esmpy.api.field.Field.xd"]], "grid (class in esmpy.api.grid)": [[21, "esmpy.api.grid.Grid"]], "add_coords() (esmpy.api.grid.grid method)": [[21, "esmpy.api.grid.Grid.add_coords"]], "add_item() (esmpy.api.grid.grid method)": [[21, "esmpy.api.grid.Grid.add_item"]], "area (esmpy.api.grid.grid property)": [[21, "esmpy.api.grid.Grid.area"]], "areatype (esmpy.api.grid.grid property)": [[21, "esmpy.api.grid.Grid.areatype"]], "coord_sys (esmpy.api.grid.grid property)": [[21, "esmpy.api.grid.Grid.coord_sys"]], "coords (esmpy.api.grid.grid property)": [[21, "esmpy.api.grid.Grid.coords"]], "copy() (esmpy.api.grid.grid method)": [[21, "esmpy.api.grid.Grid.copy"]], "destroy() (esmpy.api.grid.grid method)": [[21, "esmpy.api.grid.Grid.destroy"]], "get_coords() (esmpy.api.grid.grid method)": [[21, "esmpy.api.grid.Grid.get_coords"]], "get_item() (esmpy.api.grid.grid method)": [[21, "esmpy.api.grid.Grid.get_item"]], "has_corners (esmpy.api.grid.grid property)": [[21, "esmpy.api.grid.Grid.has_corners"]], "lower_bounds (esmpy.api.grid.grid property)": [[21, "esmpy.api.grid.Grid.lower_bounds"]], "mask (esmpy.api.grid.grid property)": [[21, "esmpy.api.grid.Grid.mask"]], "max_index (esmpy.api.grid.grid property)": [[21, "esmpy.api.grid.Grid.max_index"]], "num_peri_dims (esmpy.api.grid.grid property)": [[21, "esmpy.api.grid.Grid.num_peri_dims"]], "periodic_dim (esmpy.api.grid.grid property)": [[21, "esmpy.api.grid.Grid.periodic_dim"]], "pole_dim (esmpy.api.grid.grid property)": [[21, "esmpy.api.grid.Grid.pole_dim"]], "rank (esmpy.api.grid.grid property)": [[21, "esmpy.api.grid.Grid.rank"]], "size (esmpy.api.grid.grid property)": [[21, "esmpy.api.grid.Grid.size"]], "staggerloc (esmpy.api.grid.grid property)": [[21, "esmpy.api.grid.Grid.staggerloc"]], "type (esmpy.api.grid.grid property)": [[21, "esmpy.api.grid.Grid.type"]], "upper_bounds (esmpy.api.grid.grid property)": [[21, "esmpy.api.grid.Grid.upper_bounds"]], "esmpy": [[24, "module-esmpy"]], "module": [[24, "module-esmpy"]], "locstream (class in esmpy.api.locstream)": [[25, "esmpy.api.locstream.LocStream"]], "copy() (esmpy.api.locstream.locstream method)": [[25, "esmpy.api.locstream.LocStream.copy"]], "destroy() (esmpy.api.locstream.locstream method)": [[25, "esmpy.api.locstream.LocStream.destroy"]], "lower_bounds (esmpy.api.locstream.locstream property)": [[25, "esmpy.api.locstream.LocStream.lower_bounds"]], "name (esmpy.api.locstream.locstream property)": [[25, "esmpy.api.locstream.LocStream.name"]], "rank (esmpy.api.locstream.locstream property)": [[25, "esmpy.api.locstream.LocStream.rank"]], "size (esmpy.api.locstream.locstream property)": [[25, "esmpy.api.locstream.LocStream.size"]], "upper_bounds (esmpy.api.locstream.locstream property)": [[25, "esmpy.api.locstream.LocStream.upper_bounds"]], "manager (class in esmpy.api.esmpymanager)": [[26, "esmpy.api.esmpymanager.Manager"]], "barrier() (esmpy.api.esmpymanager.manager method)": [[26, "esmpy.api.esmpymanager.Manager.barrier"]], "local_pet (esmpy.api.esmpymanager.manager property)": [[26, "esmpy.api.esmpymanager.Manager.local_pet"]], "moab (esmpy.api.esmpymanager.manager property)": [[26, "esmpy.api.esmpymanager.Manager.moab"]], "pet_count (esmpy.api.esmpymanager.manager property)": [[26, "esmpy.api.esmpymanager.Manager.pet_count"]], "set_moab() (esmpy.api.esmpymanager.manager method)": [[26, "esmpy.api.esmpymanager.Manager.set_moab"]], "mesh (class in esmpy.api.mesh)": [[27, "esmpy.api.mesh.Mesh"]], "add_elements() (esmpy.api.mesh.mesh method)": [[27, "esmpy.api.mesh.Mesh.add_elements"]], "add_nodes() (esmpy.api.mesh.mesh method)": [[27, "esmpy.api.mesh.Mesh.add_nodes"]], "area (esmpy.api.mesh.mesh property)": [[27, "esmpy.api.mesh.Mesh.area"]], "coord_sys (esmpy.api.mesh.mesh property)": [[27, "esmpy.api.mesh.Mesh.coord_sys"]], "coords (esmpy.api.mesh.mesh property)": [[27, "esmpy.api.mesh.Mesh.coords"]], "copy() (esmpy.api.mesh.mesh method)": [[27, "esmpy.api.mesh.Mesh.copy"]], "destroy() (esmpy.api.mesh.mesh method)": [[27, "esmpy.api.mesh.Mesh.destroy"]], "free_memory() (esmpy.api.mesh.mesh method)": [[27, "esmpy.api.mesh.Mesh.free_memory"]], "get_coords() (esmpy.api.mesh.mesh method)": [[27, "esmpy.api.mesh.Mesh.get_coords"]], "mask (esmpy.api.mesh.mesh property)": [[27, "esmpy.api.mesh.Mesh.mask"]], "rank (esmpy.api.mesh.mesh property)": [[27, "esmpy.api.mesh.Mesh.rank"]], "size (esmpy.api.mesh.mesh property)": [[27, "esmpy.api.mesh.Mesh.size"]], "size_owned (esmpy.api.mesh.mesh property)": [[27, "esmpy.api.mesh.Mesh.size_owned"]], "regrid (class in esmpy.api.regrid)": [[28, "esmpy.api.regrid.Regrid"]], "__call__() (esmpy.api.regrid.regrid method)": [[28, "esmpy.api.regrid.Regrid.__call__"]], "copy() (esmpy.api.regrid.regrid method)": [[28, "esmpy.api.regrid.Regrid.copy"]], "destroy() (esmpy.api.regrid.regrid method)": [[28, "esmpy.api.regrid.Regrid.destroy"]], "get_factors() (esmpy.api.regrid.regrid method)": [[28, "esmpy.api.regrid.Regrid.get_factors"]], "get_weights_dict() (esmpy.api.regrid.regrid method)": [[28, "esmpy.api.regrid.Regrid.get_weights_dict"]], "regridfromfile (class in esmpy.api.regrid)": [[29, "esmpy.api.regrid.RegridFromFile"]], "__call__() (esmpy.api.regrid.regridfromfile method)": [[29, "esmpy.api.regrid.RegridFromFile.__call__"]], "copy() (esmpy.api.regrid.regridfromfile method)": [[29, "esmpy.api.regrid.RegridFromFile.copy"]], "destroy() (esmpy.api.regrid.regridfromfile method)": [[29, "esmpy.api.regrid.RegridFromFile.destroy"]]}}) \ No newline at end of file