pymt.grids package¶
Submodules¶
pymt.grids.assertions module¶
pymt.grids.connectivity module¶
>>> get_connectivity((6, ))
array([0, 1, 1, 2, 2, 3, 3, 4, 4, 5])
>>> get_connectivity((6, ), ordering='ccw')
array([1, 0, 2, 1, 3, 2, 4, 3, 5, 4])
>>> get_connectivity((3, 4))
array([ 0, 1, 5, 4, 1, 2, 6, 5, 2, 3, 7, 6, 4, 5, 9, 8, 5,
6, 10, 9, 6, 7, 11, 10])
>>> get_connectivity((3, 4), ordering='ccw')
array([ 1, 0, 4, 5, 2, 1, 5, 6, 3, 2, 6, 7, 5, 4, 8, 9, 6,
5, 9, 10, 7, 6, 10, 11])
>>> shape = np.array([3, 4, 4])
>>> (c, o) = get_connectivity(shape, with_offsets=True)
>>> len(c) == (shape - 1).prod() * 8
True
>>> len(o) == (shape - 1).prod()
True
>>> np.all(np.diff(o) == 8)
True
>>> c[:o[0]]
array([ 0, 1, 5, 4, 16, 17, 21, 20])
>>> c[o[-2]:o[-1]]
array([26, 27, 31, 30, 42, 43, 47, 46])
>>> ids = get_connectivity((3, 4, 4), ordering='ccw')
>>> ids[:8]
array([ 1, 0, 4, 5, 17, 16, 20, 21])
>>> ids[-8:]
array([27, 26, 30, 31, 43, 42, 46, 47])
-
pymt.grids.connectivity.get_connectivity(shape, **kwds)[source]¶ Get the connectivity (and, optionally, offset) array for an ND structured grid. Elements will consist of two points for 1D grids, four points for 2D grids, eight points for 3D grids, etc. For a uniform rectilinear grid this would be lines, squares, and cubes.
The nodes of an element can be ordered either clockwise or counter-clockwise.
Parameters: - shape (tuple of int) – The shape of the grid.
- ordering ({'cw', 'ccw', 'none'}, optional) – Node ordering. One of ‘cw’ (clockwise), ‘ccw’ (counter-clockwise), or ‘none’ (ordering not guaranteed).
- dtype (str or numpy.dtype) – The desired data type of the returned arrays.
- with_offsets (bool) – Return offset array along with connectivity
Returns: Array of connectivities. If with_offsets keyword is True, return a tuple of (connectivity, offset).
Return type: ndarray of int
Examples
A 1D grid with three points has 2 elements.
>>> get_connectivity ((3, )) array([0, 1, 1, 2]) >>> get_connectivity ((3, ), ordering='ccw') array([1, 0, 2, 1])
A 2D grid with 3 rows and 4 columns of nodes:
( 0 ) --- ( 1 ) --- ( 2 ) --- ( 3 ) | | | | | 0 | 1 | 2 | | | | | ( 4 ) --- ( 5 ) --- ( 6 ) --- ( 7 ) | | | | | 3 | 4 | 5 | | | | | ( 8 ) --- ( 9 ) --- ( 10) --- ( 11)
>>> get_connectivity((3, 4)) array([ 0, 1, 5, 4, 1, 2, 6, 5, 2, 3, 7, 6, 4, 5, 9, 8, 5, 6, 10, 9, 6, 7, 11, 10])
>>> get_connectivity((3, 4), ordering='ccw') array([ 1, 0, 4, 5, 2, 1, 5, 6, 3, 2, 6, 7, 5, 4, 8, 9, 6, 5, 9, 10, 7, 6, 10, 11])
If ordering doesn’t matter, set ordering to ‘none’ as this could be slightly faster.
>>> (ids, offsets) = get_connectivity((3, 4), ordering='none', with_offsets=True) >>> offsets array([ 4, 8, 12, 16, 20, 24]) >>> ids array([ 0, 1, 4, 5, 1, 2, 5, 6, 2, 3, 6, 7, 4, 5, 8, 9, 5, 6, 9, 10, 6, 7, 10, 11])
Nodes connected to the first cell,
>>> ids[:offsets[0]] array([0, 1, 4, 5])
Nodes connected to the second cell,
>>> ids[offsets[0]:offsets[1]] array([1, 2, 5, 6])
Instead of using an offset array to indicate the end of each cell, you can return a list of connectivity arrays for each cell.
>>> shape = np.array((3, 4)) >>> ids = get_connectivity(shape, ordering='cw', as_cell_list=True) >>> len(ids) == (shape - 1).prod() True >>> ids # doctest: +NORMALIZE_WHITESPACE [array([0, 1, 5, 4]), array([1, 2, 6, 5]), array([2, 3, 7, 6]), array([4, 5, 9, 8]), array([ 5, 6, 10, 9]), array([ 6, 7, 11, 10])]
pymt.grids.esmp module¶
PyMT interface to ESMPy grids.
Examples
Create a grid that looks like this,
(3) --- (4) --- (5)
| | |
| 0 | 1 |
| | |
(0) --- (1) --- (2)
>>> import ESMF
>>> mngr = ESMF.Manager()
>>> mngr.local_pet
0
>>> mngr.pet_count
1
Represent this grid as an unstructured grid.
>>> g = EsmpUnstructured([0, 0, 0, 1, 1, 1], [0, 1, 2, 0, 1, 2],
... [0, 1, 4, 3, 1, 2, 5, 4], [4, 8], indexing='ij')
>>> g.get_point_count()
6
>>> g.get_cell_count()
2
As a structured grid,
>>> g = EsmpStructured([0, 0, 0, 1, 1, 1], [0, 1, 2, 0, 1, 2], (2, 3),
... indexing='ij')
>>> g.get_point_count()
6
>>> g.get_cell_count()
2
As a uniform rectilinear (raster) grid,
>>> g = EsmpUniformRectilinear([2, 3], [1., 1.], [0., 0.])
>>> g.get_point_count()
6
>>> g.get_cell_count()
2
The as_mesh method provides a view of the grid as an ESMP_Mesh.
>>> mesh = g.as_mesh()
>>> mesh.node_count
6
>>> mesh.element_count
2
ESMF elements are the same as the grids cells. Likewise with nodes and points.
>>> g = EsmpRectilinear([0, 1], [0, 1, 2], indexing='ij')
>>> g.as_mesh().element_count == g.get_cell_count()
True
>>> g.as_mesh().node_count == g.get_point_count()
True
Uniform Rectilinear Field
Create a field on a grid that looks like this,
(3) --- (4) --- (5)
| | |
| 0 | 1 |
| | |
(0) --- (1) --- (2)
Create the field,
>>> g = EsmpRasterField((2, 3), (1, 2), (0, 0), indexing='ij')
>>> g.get_cell_count()
2
>>> g.get_point_count()
6
Add some data at the points of our grid.
>>> data = np.arange(6)
>>> g.add_field('var0', data, centering='point')
>>> f = g.get_field('var0')
>>> f.data
array([ 0., 1., 2., 3., 4., 5.])
The data can be given either as a 1D array or with the same shape as the point grid. In either case, though, it will be flattened.
>>> data = np.arange(6)
>>> data.shape = (2, 3)
>>> g.add_field('var0', data, centering='point')
>>> f = g.get_field('var0')
>>> f.data
array([ 0., 1., 2., 3., 4., 5.])
If the size or shape doesn’t match, it’s an error.
>>> data = np.arange(2)
>>> g.add_field('bad var', data, centering='point') # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
DimensionError: 2 != 6
>>> data = np.ones((3, 2))
>>> g.add_field ('bad var', data, centering='point') # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
DimensionError: (3, 2) != (2, 3)
Map between two fields
>>> from pymt.grids.raster import UniformRectilinear
>>> from pymt.grids.rectilinear import Rectilinear
>>> src = EsmpRasterField((3,3), (1,1), (0, 0), indexing='ij')
>>> data = np.arange(src.get_cell_count(), dtype=np.float64)
>>> src.add_field('srcfield', data, centering='zonal')
>>> src.get_point_count()
9
>>> src.get_cell_count()
4
>>> src.get_x()
array([ 0., 1., 2., 0., 1., 2., 0., 1., 2.])
>>> src.get_y()
array([ 0., 0., 0., 1., 1., 1., 2., 2., 2.])
>>> src.get_connectivity() + 1
array([1, 2, 5, 4, 2, 3, 6, 5, 4, 5, 8, 7, 5, 6, 9, 8])
>>> dst = EsmpRectilinearField([0., .5, 1.5, 2.], [0., .5, 1.5, 2.])
>>> data = np.empty(dst.get_cell_count(), dtype=np.float64)
>>> dst.add_field('dstfield', data, centering='zonal')
>>> dst.get_point_count()
16
>>> dst.get_cell_count()
9
>>> dst.get_x()
array([ 0. , 0.5, 1.5, 2. , 0. , 0.5, 1.5, 2. , 0. , 0.5, 1.5,
2. , 0. , 0.5, 1.5, 2. ])
>>> dst.get_y()
array([ 0. , 0. , 0. , 0. , 0.5, 0.5, 0.5, 0.5, 1.5, 1.5, 1.5,
1.5, 2. , 2. , 2. , 2. ])
>>> dst.get_connectivity() + 1
array([ 1, 2, 6, 5, 2, 3, 7, 6, 3, 4, 8, 7, 5, 6, 10, 9, 6,
7, 11, 10, 7, 8, 12, 11, 9, 10, 14, 13, 10, 11, 15, 14, 11, 12,
16, 15])
>>> src_field = src.as_esmp('srcfield')
>>> dst_field = dst.as_esmp('dstfield')
>>> src.as_mesh().element_count
4
>>> src.as_mesh().node_count
9
>>> dst.as_mesh().element_count
9
>>> dst.as_mesh().node_count
16
>>> f = run_regridding(src_field, dst_field)
>>> f.data
array([ 0. , 0.5, 1. , 1. , 1.5, 2. , 2. , 2.5, 3. ])
A bigger grid
>>> (M, N) = (300, 300)
>>> src = EsmpRasterField((M, N), (1, 1), (0, 0))
Map values on cells
>>> (X, Y) = np.meshgrid(np.arange (0.5, 299.5, 1.),
... np.arange (0.5, 299.5, 1.))
>>> data = np.sin(np.sqrt(X ** 2 + Y ** 2) * np.pi / M)
>>> src.add_field('srcfield', data, centering='zonal')
>>> dst = EsmpRasterField((M * 2 - 1, N * 2 - 1), (1. / 2, 1. / 2), (0, 0))
>>> data = np.empty(dst.get_cell_count(), dtype=np.float64)
>>> dst.add_field('dstfield', data, centering='zonal')
>>> src_field = src.as_esmp('srcfield')
>>> dst_field = dst.as_esmp('dstfield')
>>> f = run_regridding(src_field, dst_field)
>>> (X, Y) = np.meshgrid(np.arange (0.5, 299.5, .5),
... np.arange (0.5, 299.5, .5))
>>> exact = np.sin(np.sqrt(X ** 2 + Y ** 2) * np.pi / M)
>>> np.sum(np.abs(exact.flat - f.data))/(M * N * 4.) < 1e-2
True
Map values on points
>>> (X, Y) = np.meshgrid(np.arange(0.5, 300.5, 1.),
... np.arange(0.5, 300.5, 1.))
>>> data = np.sin(np.sqrt(X ** 2 + Y ** 2) * np.pi / M)
>>> src.add_field('srcfield_at_points', data, centering='point')
>>> data = np.empty(dst.get_point_count(), dtype=np.float64)
>>> dst.add_field('dstfield_at_points', data, centering='point')
>>> src_field = src.as_esmp('srcfield_at_points')
>>> dst_field = dst.as_esmp('dstfield_at_points')
>>> f = run_regridding(src_field, dst_field,
... method=ESMF.RegridMethod.BILINEAR)
>>> (X, Y) = np.meshgrid(np.arange(0.5, 300., .5), np.arange(0.5, 300., .5))
>>> exact = np.sin(np.sqrt (X ** 2 + Y ** 2) * np.pi / M)
>>> np.sum(np.abs(exact.flat - f.data))/(M * N * 4.) < 1e-5
True
-
class
pymt.grids.esmp.EsmpField(*args, **kwargs)[source]¶ Bases:
pymt.grids.igrid.IField
-
class
pymt.grids.esmp.EsmpGrid[source]¶ Bases:
pymt.grids.igrid.IGrid
-
class
pymt.grids.esmp.EsmpRasterField(shape, spacing, origin, **kwds)[source]¶ Bases:
pymt.grids.esmp.EsmpUniformRectilinear,pymt.grids.esmp.EsmpRectilinearField
-
class
pymt.grids.esmp.EsmpRectilinear(*args, **kwds)[source]¶ Bases:
pymt.grids.rectilinear.Rectilinear,pymt.grids.esmp.EsmpGrid-
name= 'ESMPRectilinear'¶
-
-
class
pymt.grids.esmp.EsmpRectilinearField(*args, **kwds)[source]¶ Bases:
pymt.grids.esmp.EsmpRectilinear,pymt.grids.esmp.EsmpStructuredField
-
class
pymt.grids.esmp.EsmpStructured(*args, **kwds)[source]¶ Bases:
pymt.grids.structured.Structured,pymt.grids.esmp.EsmpGrid-
name= 'ESMPStructured'¶
-
-
class
pymt.grids.esmp.EsmpStructuredField(*args, **kwds)[source]¶ Bases:
pymt.grids.esmp.EsmpStructured,pymt.grids.esmp.EsmpField
-
class
pymt.grids.esmp.EsmpUniformRectilinear(shape, spacing, origin, **kwds)[source]¶ Bases:
pymt.grids.raster.UniformRectilinear,pymt.grids.esmp.EsmpStructured-
name= 'ESMPUniformRectilinear'¶
-
-
class
pymt.grids.esmp.EsmpUnstructured(*args, **kwds)[source]¶ Bases:
pymt.grids.unstructured.Unstructured,pymt.grids.esmp.EsmpGrid-
name= 'ESMPUnstructured'¶
-
-
class
pymt.grids.esmp.EsmpUnstructuredField(*args, **kwds)[source]¶ Bases:
pymt.grids.esmp.EsmpUnstructured,pymt.grids.esmp.EsmpField
-
pymt.grids.esmp.run_regridding(source_field, destination_field, method=ESMP_REGRIDMETHOD_CONSERVE, unmapped=ESMP_UNMAPPEDACTION_ERROR)[source]¶ - PRECONDITIONS:
- Two ESMP_Fields have been created and a regridding operation is desired from ‘srcfield’ to ‘dstfield’.
- POSTCONDITIONS:
- An ESMP regridding operation has set the data on ‘dstfield’.
pymt.grids.field module¶
-
class
pymt.grids.field.GridField(*args, **kwargs)[source]¶ Bases:
pymt.grids.unstructured.Unstructured,pymt.grids.igrid.IField
-
class
pymt.grids.field.RasterField(shape, spacing, origin, **kwds)[source]¶ Bases:
pymt.grids.raster.UniformRectilinear,pymt.grids.field.StructuredFieldCreate a field that looks like this,
(0) --- (1) --- (2) | | | | 0 | 1 | | | | (3) --- (4) --- (5)
Create the field,
>>> g = RasterField ((2,3), (1,2), (0, 0), indexing='ij') >>> g.get_cell_count () 2 >>> g.get_point_count () 6
Add some data at the points of our grid.
>>> data = np.arange (6) >>> g.add_field ('var0', data, centering='point') >>> g.get_field ('var0') array([0, 1, 2, 3, 4, 5])
The data can be given either as a 1D array or with the same shape as the point grid. In either case, though, it will be flattened.
>>> data = np.arange (6) >>> data.shape = (2, 3) >>> g.add_field ('var0', data, centering='point') >>> g.get_field ('var0') array([0, 1, 2, 3, 4, 5])
If the size or shape doesn’t match, it’s an error.
>>> data = np.arange (2) >>> g.add_field ('bad var', data, centering='point') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... DimensionError: 2 != 6
>>> data = np.ones ((3, 2)) >>> g.add_field ('bad var', data, centering='point') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... DimensionError: (3, 2) != (2, 3)
Add data to the cells of the grid. Again, the data can be given as a 1D array or with the same shape as the cell grid and if the size or shape doesn’t match raise an exception.
>>> data = np.arange (2) >>> g.add_field('var1', data, centering='zonal') >>> g.get_field('var1') array([0, 1])
>>> data = np.ones((2, 1)) >>> g.add_field('bad var', data, centering='zonal') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... DimensionError: (2, 1) != (1, 2)
>>> data = np.arange(3) >>> g.add_field('bad var', data, centering='zonal') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... DimensionError: 3 != 2
>>> data = np.array(3) >>> g.add_field('bad var', data, centering='zonal') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... DimensionError: 1 != 2
A 1D-Field,
>>> g = RasterField ((6, ), (1.5, ), (0.5, ), indexing='ij') >>> g.get_point_count () 6 >>> g.get_cell_count () 5
>>> point_data = np.arange (6.) >>> g.add_field ('Point Data', point_data, centering='point')
>>> cell_data = np.arange (5.)*10. >>> g.add_field ('Cell Data', cell_data, centering='zonal')
>>> g.get_field ('Cell Data') array([ 0., 10., 20., 30., 40.])
>>> g.get_field ('Point Data') array([ 0., 1., 2., 3., 4., 5.])
A 3D-Field,
>>> g = RasterField ((4, 3, 2), (1.5, 1., 3), (0.5, 0, -.5 ), indexing='ij') >>> g.get_point_count () 24 >>> g.get_cell_count () 6
>>> g.add_field ('Point Data', g.get_x (), centering='point')
>>> cell_data = np.arange (6.)*10. >>> g.add_field ('Cell Data', cell_data, centering='zonal')
>>> g.get_field ('Cell Data') array([ 0., 10., 20., 30., 40., 50.])
>>> g.get_field('Point Data') array([-0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5])
>>> g.get_shape() array([4, 3, 2])
>>> g.get_x().size == g.get_field('Point Data').size True >>> x = g.get_x() >>> x.shape (24,) >>> x.shape = g.get_shape() >>> x.shape (4, 3, 2)
-
class
pymt.grids.field.RectilinearField(*args, **kwds)[source]¶ Bases:
pymt.grids.rectilinear.Rectilinear,pymt.grids.field.StructuredField
-
class
pymt.grids.field.StructuredField(*args, **kwds)[source]¶ Bases:
pymt.grids.structured.Structured,pymt.grids.field.GridField
-
class
pymt.grids.field.UnstructuredField(*args, **kwargs)[source]¶ Bases:
pymt.grids.field.GridField
pymt.grids.grid_type module¶
pymt.grids.igrid module¶
-
exception
pymt.grids.igrid.CenteringValueError(val)[source]¶ Bases:
pymt.grids.igrid.ErrorError to indicate an invalid value for value centering.
-
exception
pymt.grids.igrid.DimensionError(dim0, dim1)[source]¶ Bases:
pymt.grids.igrid.ErrorError to indicate a dimension mismatch when adding a value field to a grid.
-
exception
pymt.grids.igrid.GridTypeError[source]¶ Bases:
pymt.grids.igrid.Error
-
class
pymt.grids.igrid.IField[source]¶ Bases:
pymt.grids.igrid.IGrid
-
class
pymt.grids.igrid.IGrid[source]¶ Bases:
objectAn interface for a grid object that represents a structured or unstructured grid of nodes and elements.
-
exception
pymt.grids.igrid.NonStructuredGridError[source]¶ Bases:
pymt.grids.igrid.GridTypeErrorError to indicate a grid is not a structured grid
-
type= 'structured'¶
-
-
exception
pymt.grids.igrid.NonUniformGridError[source]¶ Bases:
pymt.grids.igrid.GridTypeErrorError to indicate a grid is not a uniform rectilinear grid
-
type= 'uniform rectilinear'¶
-
pymt.grids.map module¶
Examples
Rectilinear
Create a rectilinear grid that is 2x3:
(0) --- (1) --- (2)
| | |
| | |
| [0] | [1] |
| | |
| | |
(3) --- (4) --- (5)
Numbers in parens are node IDs, and numbers in square brackets are cell IDs.
>>> g = RectilinearMap ([0, 2], [0, 1, 2])
>>> g.get_x ()
array([ 0., 1., 2., 0., 1., 2.])
>>> g.get_y ()
array([ 0., 0., 0., 2., 2., 2.])
Node 1 is shared by both cell 0, and 1; node 5 only is part of cell 1.
>>> g.get_shared_cells (1)
[0, 1]
>>> g.get_shared_cells (5)
[1]
Point (.5, 1.) is contained only within cell 0.
>>> g.is_in_cell (.5, 1., 0)
True
>>> g.is_in_cell (.5, 1., 1)
False
Point (1., 1.) is on a border and so is contained by both cells.
>>> g.is_in_cell (1, 1., 0)
True
>>> g.is_in_cell (1, 1., 1)
True
-
class
pymt.grids.map.RectilinearMap(*args, **kwds)[source]¶ Bases:
pymt.grids.rectilinear.Rectilinear,pymt.grids.map.UnstructuredMap-
name= 'Rectilinear'¶
-
-
class
pymt.grids.map.StructuredMap(*args, **kwds)[source]¶ Bases:
pymt.grids.structured.Structured,pymt.grids.map.UnstructuredMap-
name= 'Structured'¶
-
-
class
pymt.grids.map.UniformRectilinearMap(shape, spacing, origin, **kwds)[source]¶ Bases:
pymt.grids.raster.UniformRectilinear,pymt.grids.map.UnstructuredMap-
name= 'UniformRectilinear'¶
-
-
class
pymt.grids.map.UnstructuredMap(*args, **kwargs)[source]¶ Bases:
pymt.grids.unstructured.UnstructuredParameters: point_id (int) – ID of a point in the grid. Returns: Indices to cells that share a given node. Return type: ndarray of int
-
is_in_cell(x, y, cell_id)[source]¶ Check if a point is in a cell.
Parameters: - x (float) – x-coordinate of point to check.
- y (float) – y-coordinate of point to check.
- cell_id (int) – ID of the cell in the grid.
Returns: True if the point (x, y) is contained in the cell.
Return type: bool
-
name= 'Unstructured'¶
pymt.grids.meshgrid module¶
Notes
This function supports both indexing conventions through the indexing keyword argument. Giving the string ‘ij’ returns a meshgrid with matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. In the 2-D case with inputs of length M and N, the outputs are of shape (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case with inputs of length M, N and P, outputs are of shape (N, M, P) for ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is illustrated by the following code snippet:
xv, yv = meshgrid(x, y, sparse=False, indexing='ij')
for i in range(nx):
for j in range(ny):
# treat xv[i,j], yv[i,j]
xv, yv = meshgrid(x, y, sparse=False, indexing='xy')
for i in range(nx):
for j in range(ny):
# treat xv[j,i], yv[j,i]
See also
index_tricks.mgrid- Construct a multi-dimensional “meshgrid” using indexing notation.
index_tricks.ogrid- Construct an open multi-dimensional “meshgrid” using indexing notation.
Examples
>>> nx, ny = (3, 2)
>>> x = np.linspace(0, 1, nx)
>>> y = np.linspace(0, 1, ny)
>>> xv, yv = meshgrid(x, y)
>>> xv
array([[ 0. , 0.5, 1. ],
[ 0. , 0.5, 1. ]])
>>> yv
array([[ 0., 0., 0.],
[ 1., 1., 1.]])
>>> xv, yv = meshgrid(x, y, sparse=True) # make sparse output arrays
>>> xv
array([[ 0. , 0.5, 1. ]])
>>> yv
array([[ 0.],
[ 1.]])
meshgrid is very useful to evaluate functions on a grid.
>>> x = np.arange(-5, 5, 0.1)
>>> y = np.arange(-5, 5, 0.1)
>>> xx, yy = meshgrid(x, y, sparse=True)
>>> z = np.sin(xx**2 + yy**2) / (xx**2 + yy**2)
-
pymt.grids.meshgrid.meshgrid(*xi, **kwargs)[source]¶ Coordinate matrices from two or more coordinate vectors.
Make N-D coordinate arrays for vectorized evaluations of N-D scalar/vector fields over N-D grids, given one-dimensional coordinate arrays x1, x2,…, xn.
Parameters: - xi (array_like) – 1-D arrays representing the coordinates of a grid.
- indexing ({'xy', 'ij'}, optional) – Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. See Notes for more details.
- sparse (bool, optional) – If True a sparse grid is returned in order to conserve memory. Default is False.
- copy (bool, optional) – If False, a view into the original arrays are returned in
order to conserve memory. Default is True. Please note that
sparse=False, copy=Falsewill likely return non-contiguous arrays. Furthermore, more than one element of a broadcast array may refer to a single memory location. If you need to write to the arrays, make copies first.
Returns: For vectors x1, x2,…, ‘xn’ with lengths
Ni=len(xi), return(N1, N2, N3,...Nn)shaped arrays if indexing=’ij’ or(N2, N1, N3,...Nn)shaped arrays if indexing=’xy’ with the elements of xi repeated to fill the matrix along the first dimension for x1, the second for x2 and so on.Return type: ndarray
pymt.grids.raster module¶
Examples
Create a grid that consists of 2x3 nodes using ‘xy’ and ‘ij’ indexing.
ij-indexing
Create a grid of length 2 in the i direction, and 3 in the j direction.
>>> g = UniformRectilinear ((2,3), (1,2), (.5, 0), indexing='ij', units=('m', 'km'))
>>> g.get_x()
array([ 0., 2., 4., 0., 2., 4.])
>>> g.get_y()
array([ 0.5, 0.5, 0.5, 1.5, 1.5, 1.5])
>>> [g.get_x_units(), g.get_y_units()]
['km', 'm']
>>> g.get_z_units()
Traceback (most recent call last):
...
IndexError: Dimension out of bounds
>>> [g.get_coordinate_units(i) for i in [0, 1]]
['m', 'km']
>>> g.get_coordinate_units(2)
Traceback (most recent call last):
...
IndexError: Dimension out of bounds
>>> g.get_shape()
array([2, 3])
>>> g.get_spacing()
array([ 1., 2.])
>>> g.get_origin()
array([ 0.5, 0. ])
>>> g.get_offset()
array([4, 8])
>>> g.get_connectivity()
array([0, 1, 4, 3, 1, 2, 5, 4])
Uniform rectilinear grid of points
Create a grid of length 2 in the i direction, and 3 in the j direction.
>>> g = UniformRectilinearPoints ((2,3), (1,2), (.5, 0), indexing='ij', set_connectivity=True)
>>> g.get_x()
array([ 0., 2., 4., 0., 2., 4.])
>>> g.get_y()
array([ 0.5, 0.5, 0.5, 1.5, 1.5, 1.5])
>>> g.get_shape()
array([2, 3])
>>> g.get_spacing()
array([ 1., 2.])
>>> g.get_origin()
array([ 0.5, 0. ])
>>> g.get_point_count()
6
>>> g.get_cell_count()
0
The offset runs from 1 up to (and including) the number of points.
>>> all (g.get_offset ()==np.arange (1, g.get_point_count ()+1))
True
The connectivity runs from 0 to one less than the number of points.
>>> all (g.get_connectivity ()==np.arange (g.get_point_count ()))
True
1D-grid of points
>>> g = UniformRectilinearPoints ((5, ), (1., ), (.5,), indexing='ij', set_connectivity=True)
>>> g.get_x()
array([ 0.5, 1.5, 2.5, 3.5, 4.5])
3D-grid of cells
>>> g = UniformRectilinear ((4, 3, 2), (1, 2, 3), (-1, 0, 1), indexing='ij')
>>> g.get_x()
array([ 1., 4., 1., 4., 1., 4., 1., 4., 1., 4., 1., 4., 1.,
4., 1., 4., 1., 4., 1., 4., 1., 4., 1., 4.])
>>> g.get_y()
array([ 0., 0., 2., 2., 4., 4., 0., 0., 2., 2., 4., 4., 0.,
0., 2., 2., 4., 4., 0., 0., 2., 2., 4., 4.])
>>> g.get_z()
array([-1., -1., -1., -1., -1., -1., 0., 0., 0., 0., 0., 0., 1.,
1., 1., 1., 1., 1., 2., 2., 2., 2., 2., 2.])
-
class
pymt.grids.raster.UniformRectilinear(shape, spacing, origin, **kwds)[source]¶ Bases:
pymt.grids.raster.UniformRectilinearPoints,pymt.grids.rectilinear.RectilinearCreate a rectilinear grid with uniform spacing in the x and y directions.
Parameters: - shape (tuple of int) – Grid shape measured in number of nodes.
- spacing (tuple of int) – Spacing between nodes in each direction of a rectilinear grid.
- origin (tuple of int) – Coordinates of the lower-left corner of the grid.
- indexing ({'xy', 'ij'}, optional) – Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. See Notes for more details.
Returns: An instance of a UniformRectilinear grid.
Return type: UniformRectilinear
pymt.grids.rectilinear module¶
Examples
Create a grid of length 2 in the x direction, and 3 in the y direction.
>>> g = Rectilinear([1., 2., 3.], [1., 2., 4., 8.])
>>> g.get_point_count()
12
>>> g.get_cell_count()
6
>>> g.get_x()
array([ 1., 2., 4., 8., 1., 2., 4., 8., 1., 2., 4., 8.])
>>> g.get_y()
array([ 1., 1., 1., 1., 2., 2., 2., 2., 3., 3., 3., 3.])
>>> g.get_shape()
array([3, 4])
Create a grid of length 2 in the i direction, and 3 in the j direction.
>>> g = Rectilinear([1., 2., 4., 8.], [1., 2., 3.], indexing='ij')
>>> g.get_x()
array([ 1., 2., 3., 1., 2., 3., 1., 2., 3., 1., 2., 3.])
>>> g.get_y()
array([ 1., 1., 1., 2., 2., 2., 4., 4., 4., 8., 8., 8.])
>>> g.get_shape()
array([4, 3])
>>> g.get_offset()
array([ 4, 8, 12, 16, 20, 24])
>>> g.get_connectivity()
array([ 0, 1, 4, 3, 1, 2, 5, 4, 3, 4, 7, 6, 4, 5, 8, 7, 6,
7, 10, 9, 7, 8, 11, 10])
Rectilinear grid of points
Create a grid of length 2 in the i direction, and 3 in the j direction.
>>> g = RectilinearPoints ([1., 2., 4., 8.], [1., 2., 3.], indexing='ij', set_connectivity=True)
>>> g.get_x()
array([ 1., 2., 3., 1., 2., 3., 1., 2., 3., 1., 2., 3.])
>>> g.get_y()
array([ 1., 1., 1., 2., 2., 2., 4., 4., 4., 8., 8., 8.])
>>> g.get_shape ()
array([4, 3])
>>> g.get_point_count()
12
>>> g.get_cell_count()
0
The offset runs from 1 up to (and including) the number of points.
>>> all (g.get_offset ()==np.arange (1, g.get_point_count ()+1))
True
The connectivity runs from 0 to one less than the number of points.
>>> all (g.get_connectivity ()==np.arange (g.get_point_count ()))
True
1D Rectilinear grid
>>> g = Rectilinear([1,3,4,5,6], set_connectivity=True)
>>> g.get_x()
array([ 1., 3., 4., 5., 6.])
>>> g.get_point_count()
5
>>> g.get_cell_count()
4
>>> g.get_connectivity()
array([0, 1, 1, 2, 2, 3, 3, 4])
>>> g.get_offset()
array([2, 4, 6, 8])
3D Rectilinear grid
>>> g = Rectilinear ([0, 1], [2, 3], set_connectivity=True, indexing='ij')
>>> g.get_x()
array([ 2., 3., 2., 3.])
>>> g.get_y()
array([ 0., 0., 1., 1.])
>>> g = Rectilinear ([0, 1], [2, 3], [4, 5], set_connectivity=True, indexing='ij')
>>> g.get_x()
array([ 4., 5., 4., 5., 4., 5., 4., 5.])
>>> g.get_y()
array([ 2., 2., 3., 3., 2., 2., 3., 3.])
>>> g.get_z()
array([ 0., 0., 0., 0., 1., 1., 1., 1.])
>>> g.get_point_count()
8
>>> g.get_cell_count()
1
>>> g = Rectilinear([0, 1, 2, 3], [4, 5, 6], [7, 8], set_connectivity=True, indexing='ij')
>>> g.get_x()
array([ 7., 8., 7., 8., 7., 8., 7., 8., 7., 8., 7., 8., 7.,
8., 7., 8., 7., 8., 7., 8., 7., 8., 7., 8.])
>>> g.get_shape()
array([4, 3, 2])
>>> x = g.get_x()
>>> x.shape = g.get_shape()
-
class
pymt.grids.rectilinear.Rectilinear(*args, **kwds)[source]¶ Bases:
pymt.grids.rectilinear.RectilinearPoints,pymt.grids.structured.StructuredCreate a rectilinear grid.
Parameters: - x (ndarray) – 1-D array of x-coordinates of nodes.
- y (ndarray) – 1-D array of y-coordinates of nodes.
- shape (tuple of int) – Grid shape measured in number of nodes
- indexing ({'xy', 'ij'}, optional) – Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output.
Returns: An instance of a Rectilinear grid.
Return type: Rectilinear
-
class
pymt.grids.rectilinear.RectilinearPoints(*args, **kwds)[source]¶ Bases:
pymt.grids.structured.StructuredPoints-
get_x_coordinates()[source]¶ Examples
>>> g = Rectilinear([0, 1], [2, 3], [4, 5], set_connectivity=True, indexing='ij') >>> g.get_x_coordinates() array([ 4., 5.])
-
pymt.grids.structured module¶
Examples
Create a grid of length 2 in the x direction, and 3 in the y direction.
>>> (x, y) = np.meshgrid ([1., 2., 4., 8.], [1., 2., 3.])
>>> g = Structured(y.flatten(), x.flatten(), [3, 4])
>>> g.get_point_count()
12
>>> g.get_cell_count()
6
>>> g.get_x()
array([ 1., 2., 4., 8., 1., 2., 4., 8., 1., 2., 4., 8.])
>>> g.get_y()
array([ 1., 1., 1., 1., 2., 2., 2., 2., 3., 3., 3., 3.])
>>> g.get_shape()
array([3, 4])
Create a grid of length 2 in the i direction, and 3 in the j direction.
>>> (x, y) = np.meshgrid ([1., 2., 4., 8.], [1., 2., 3.])
>>> g = Structured (y.flatten (), x.flatten (), (3, 4), indexing='ij')
>>> g.get_x()
array([ 1., 2., 4., 8., 1., 2., 4., 8., 1., 2., 4., 8.])
>>> g.get_y()
array([ 1., 1., 1., 1., 2., 2., 2., 2., 3., 3., 3., 3.])
>>> g.get_shape()
array([3, 4])
>>> g.get_offset()
array([ 4, 8, 12, 16, 20, 24])
>>> g.get_connectivity()
array([ 0, 1, 5, 4, 1, 2, 6, 5, 2, 3, 7, 6, 4, 5, 9, 8, 5,
6, 10, 9, 6, 7, 11, 10])
Structured grid of points
The same grid as the previous example but without any cells - just points.
>>> (x, y) = np.meshgrid ([1., 2., 4., 8.], [1., 2., 3.])
>>> g = StructuredPoints (y.flatten (), x.flatten (), (3, 4), indexing='ij', set_connectivity=True)
>>> g.get_x()
array([ 1., 2., 4., 8., 1., 2., 4., 8., 1., 2., 4., 8.])
>>> g.get_y()
array([ 1., 1., 1., 1., 2., 2., 2., 2., 3., 3., 3., 3.])
>>> g.get_shape()
array([3, 4])
The number of points are the same, but the number of cells is now 0.
>>> g.get_point_count()
12
>>> g.get_cell_count()
0
The offset runs from 1 up to (and including) the number of points.
>>> all (g.get_offset ()==np.arange (1, g.get_point_count ()+1))
True
The connectivity runs from 0 to one less than the number of points.
>>> all (g.get_connectivity ()==np.arange (g.get_point_count ()))
True
1D Grid of line segments
>>> g = Structured([-1, 2, 3, 6], (4, ))
>>> g.get_x()
array([-1., 2., 3., 6.])
>>> g.get_y()
Traceback (most recent call last):
...
IndexError: Dimension out of bounds
>>> g.get_shape()
array([4])
>>> g.get_offset()
array([2, 4, 6])
>>> g.get_connectivity()
array([0, 1, 1, 2, 2, 3])
3D Grid of cubes
>>> x = [0, 1, 0, 1, 0, 1, 0, 1]
>>> y = [0, 0, 1, 1, 0, 0, 1, 1]
>>> z = [0, 0, 0, 0, 1, 1, 1, 1]
>>> g = Structured(z, y, x, (2, 2, 2))
>>> g.get_x()
array([ 0., 1., 0., 1., 0., 1., 0., 1.])
>>> g.get_y()
array([ 0., 0., 1., 1., 0., 0., 1., 1.])
>>> g.get_z()
array([ 0., 0., 0., 0., 1., 1., 1., 1.])
>>> g.get_connectivity()
array([0, 1, 3, 2, 4, 5, 7, 6])
>>> g.get_offset()
array([8])
>>> g = Structured(x, y, z, (2, 2, 2), ordering='ccw')
>>> g.get_connectivity()
array([1, 0, 2, 3, 5, 4, 6, 7])
-
class
pymt.grids.structured.Structured(*args, **kwds)[source]¶ Bases:
pymt.grids.structured.StructuredPoints,pymt.grids.unstructured.UnstructuredCreate a structured rectilinear grid.
Parameters: - x (ndarray) – 1-D array of x-coordinates of nodes.
- y (ndarray) – 1-D array of y-coordinates of nodes.
- shape (tuple of int) – Shape of the grid.
- indexing ({'xy', 'ij'}, optional) – Cartesian(‘xy’, default) or matrix(‘ij’) indexing of output.
Returns: An instance of a Structured grid.
Return type: Structured
pymt.grids.unstructured module¶
-
class
pymt.grids.unstructured.Unstructured(*args, **kwds)[source]¶ Bases:
pymt.grids.unstructured.UnstructuredPointsDefine a grid that consists of two trianges that share two points:
(2) - (3) / \ / (0) - (1)
Create the grid,
>>> g = Unstructured([0, 0, 1, 1], [0, 2, 1, 3], ... connectivity=[0, 2, 1, 2, 3, 1], offset=[3, 6]) >>> g.get_point_count() 4 >>> g.get_cell_count() 2 >>> g.get_dim_count() 2
>>> g.get_x() array([ 0., 2., 1., 3.])
>>> g.get_y() array([ 0., 0., 1., 1.])
>>> g.get_connectivity() array([0, 2, 1, 2, 3, 1])
>>> g.get_offset() array([3, 6])
Define a grid that consists of points in a line:
(0) ----- (1) -- (2) - (3)
Create the grid,
>>> g = Unstructured ([0., 6., 9., 11.], connectivity=[0, 1, 2, 3], offset=[1, 2, 3, 4]) >>> g.get_point_count () 4 >>> g.get_cell_count () 4
Eight point that form a unit cube.
>>> x = [0, 1, 0, 1, 0, 1, 0, 1] >>> y = [0, 0, 1, 1, 0, 0, 1, 1] >>> z = [0, 0, 0, 0, 1, 1, 1, 1] >>> g = Unstructured(z, y, x, connectivity=[0, 1, 2, 3, 4, 5, 6, 7], offset=[8]) >>> g.get_point_count() 8 >>> g.get_cell_count() 1 >>> g.get_x() array([ 0., 1., 0., 1., 0., 1., 0., 1.]) >>> g.get_y() array([ 0., 0., 1., 1., 0., 0., 1., 1.]) >>> g.get_z() array([ 0., 0., 0., 0., 1., 1., 1., 1.])
-
class
pymt.grids.unstructured.UnstructuredPoints(*args, **kwds)[source]¶ Bases:
pymt.grids.igrid.IGrid
pymt.grids.utils module¶
Module contents¶
-
class
pymt.grids.UniformRectilinear(shape, spacing, origin, **kwds)[source]¶ Bases:
pymt.grids.raster.UniformRectilinearPoints,pymt.grids.rectilinear.RectilinearCreate a rectilinear grid with uniform spacing in the x and y directions.
Parameters: - shape (tuple of int) – Grid shape measured in number of nodes.
- spacing (tuple of int) – Spacing between nodes in each direction of a rectilinear grid.
- origin (tuple of int) – Coordinates of the lower-left corner of the grid.
- indexing ({'xy', 'ij'}, optional) – Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. See Notes for more details.
Returns: An instance of a UniformRectilinear grid.
Return type: UniformRectilinear
-
class
pymt.grids.Rectilinear(*args, **kwds)[source]¶ Bases:
pymt.grids.rectilinear.RectilinearPoints,pymt.grids.structured.StructuredCreate a rectilinear grid.
Parameters: - x (ndarray) – 1-D array of x-coordinates of nodes.
- y (ndarray) – 1-D array of y-coordinates of nodes.
- shape (tuple of int) – Grid shape measured in number of nodes
- indexing ({'xy', 'ij'}, optional) – Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output.
Returns: An instance of a Rectilinear grid.
Return type: Rectilinear
-
class
pymt.grids.RectilinearPoints(*args, **kwds)[source]¶ Bases:
pymt.grids.structured.StructuredPoints-
get_x_coordinates()[source]¶ Examples
>>> g = Rectilinear([0, 1], [2, 3], [4, 5], set_connectivity=True, indexing='ij') >>> g.get_x_coordinates() array([ 4., 5.])
-
-
class
pymt.grids.Structured(*args, **kwds)[source]¶ Bases:
pymt.grids.structured.StructuredPoints,pymt.grids.unstructured.UnstructuredCreate a structured rectilinear grid.
Parameters: - x (ndarray) – 1-D array of x-coordinates of nodes.
- y (ndarray) – 1-D array of y-coordinates of nodes.
- shape (tuple of int) – Shape of the grid.
- indexing ({'xy', 'ij'}, optional) – Cartesian(‘xy’, default) or matrix(‘ij’) indexing of output.
Returns: An instance of a Structured grid.
Return type: Structured
-
class
pymt.grids.Unstructured(*args, **kwds)[source]¶ Bases:
pymt.grids.unstructured.UnstructuredPointsDefine a grid that consists of two trianges that share two points:
(2) - (3) / \ / (0) - (1)
Create the grid,
>>> g = Unstructured([0, 0, 1, 1], [0, 2, 1, 3], ... connectivity=[0, 2, 1, 2, 3, 1], offset=[3, 6]) >>> g.get_point_count() 4 >>> g.get_cell_count() 2 >>> g.get_dim_count() 2
>>> g.get_x() array([ 0., 2., 1., 3.])
>>> g.get_y() array([ 0., 0., 1., 1.])
>>> g.get_connectivity() array([0, 2, 1, 2, 3, 1])
>>> g.get_offset() array([3, 6])
Define a grid that consists of points in a line:
(0) ----- (1) -- (2) - (3)
Create the grid,
>>> g = Unstructured ([0., 6., 9., 11.], connectivity=[0, 1, 2, 3], offset=[1, 2, 3, 4]) >>> g.get_point_count () 4 >>> g.get_cell_count () 4
Eight point that form a unit cube.
>>> x = [0, 1, 0, 1, 0, 1, 0, 1] >>> y = [0, 0, 1, 1, 0, 0, 1, 1] >>> z = [0, 0, 0, 0, 1, 1, 1, 1] >>> g = Unstructured(z, y, x, connectivity=[0, 1, 2, 3, 4, 5, 6, 7], offset=[8]) >>> g.get_point_count() 8 >>> g.get_cell_count() 1 >>> g.get_x() array([ 0., 1., 0., 1., 0., 1., 0., 1.]) >>> g.get_y() array([ 0., 0., 1., 1., 0., 0., 1., 1.]) >>> g.get_z() array([ 0., 0., 0., 0., 1., 1., 1., 1.])
-
class
pymt.grids.UnstructuredPoints(*args, **kwds)[source]¶ Bases:
pymt.grids.igrid.IGrid
-
class
pymt.grids.RasterField(shape, spacing, origin, **kwds)[source]¶ Bases:
pymt.grids.raster.UniformRectilinear,pymt.grids.field.StructuredFieldCreate a field that looks like this,
(0) --- (1) --- (2) | | | | 0 | 1 | | | | (3) --- (4) --- (5)
Create the field,
>>> g = RasterField ((2,3), (1,2), (0, 0), indexing='ij') >>> g.get_cell_count () 2 >>> g.get_point_count () 6
Add some data at the points of our grid.
>>> data = np.arange (6) >>> g.add_field ('var0', data, centering='point') >>> g.get_field ('var0') array([0, 1, 2, 3, 4, 5])
The data can be given either as a 1D array or with the same shape as the point grid. In either case, though, it will be flattened.
>>> data = np.arange (6) >>> data.shape = (2, 3) >>> g.add_field ('var0', data, centering='point') >>> g.get_field ('var0') array([0, 1, 2, 3, 4, 5])
If the size or shape doesn’t match, it’s an error.
>>> data = np.arange (2) >>> g.add_field ('bad var', data, centering='point') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... DimensionError: 2 != 6
>>> data = np.ones ((3, 2)) >>> g.add_field ('bad var', data, centering='point') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... DimensionError: (3, 2) != (2, 3)
Add data to the cells of the grid. Again, the data can be given as a 1D array or with the same shape as the cell grid and if the size or shape doesn’t match raise an exception.
>>> data = np.arange (2) >>> g.add_field('var1', data, centering='zonal') >>> g.get_field('var1') array([0, 1])
>>> data = np.ones((2, 1)) >>> g.add_field('bad var', data, centering='zonal') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... DimensionError: (2, 1) != (1, 2)
>>> data = np.arange(3) >>> g.add_field('bad var', data, centering='zonal') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... DimensionError: 3 != 2
>>> data = np.array(3) >>> g.add_field('bad var', data, centering='zonal') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... DimensionError: 1 != 2
A 1D-Field,
>>> g = RasterField ((6, ), (1.5, ), (0.5, ), indexing='ij') >>> g.get_point_count () 6 >>> g.get_cell_count () 5
>>> point_data = np.arange (6.) >>> g.add_field ('Point Data', point_data, centering='point')
>>> cell_data = np.arange (5.)*10. >>> g.add_field ('Cell Data', cell_data, centering='zonal')
>>> g.get_field ('Cell Data') array([ 0., 10., 20., 30., 40.])
>>> g.get_field ('Point Data') array([ 0., 1., 2., 3., 4., 5.])
A 3D-Field,
>>> g = RasterField ((4, 3, 2), (1.5, 1., 3), (0.5, 0, -.5 ), indexing='ij') >>> g.get_point_count () 24 >>> g.get_cell_count () 6
>>> g.add_field ('Point Data', g.get_x (), centering='point')
>>> cell_data = np.arange (6.)*10. >>> g.add_field ('Cell Data', cell_data, centering='zonal')
>>> g.get_field ('Cell Data') array([ 0., 10., 20., 30., 40., 50.])
>>> g.get_field('Point Data') array([-0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5, -0.5, 2.5])
>>> g.get_shape() array([4, 3, 2])
>>> g.get_x().size == g.get_field('Point Data').size True >>> x = g.get_x() >>> x.shape (24,) >>> x.shape = g.get_shape() >>> x.shape (4, 3, 2)
-
class
pymt.grids.RectilinearField(*args, **kwds)[source]¶ Bases:
pymt.grids.rectilinear.Rectilinear,pymt.grids.field.StructuredField
-
class
pymt.grids.StructuredField(*args, **kwds)[source]¶ Bases:
pymt.grids.structured.Structured,pymt.grids.field.GridField
-
class
pymt.grids.UnstructuredField(*args, **kwargs)[source]¶ Bases:
pymt.grids.field.GridField
-
exception
pymt.grids.DimensionError(dim0, dim1)[source]¶ Bases:
pymt.grids.igrid.ErrorError to indicate a dimension mismatch when adding a value field to a grid.