harmonica.DatasetAccessorPrismLayer#
- class harmonica.DatasetAccessorPrismLayer(xarray_obj)[source]#
Defines dataset accessor for layer of prisms
Warning
This class is not intended to be initialized. Use the prism_layer accessor for accessing the methods and attributes of this class.
See also
- Attributes:
boundaries
Boundaries of the layer
dims
Return the dims tuple of the prism layer
shape
Return the number of prisms on each direction
size
Return the total number of prisms on the layer
spacing
Spacing between center of prisms
Methods
get_prism
(indices)Return the boundaries of the chosen prism
gravity
(coordinates, field[, progressbar, ...])Computes the gravity generated by the layer of prisms
to_pyvista
([drop_null_prisms])Return a pyvista UnstructuredGrid to plot the PrismLayer
update_top_bottom
(surface, reference)Update top and bottom boundaries of the layer
- DatasetAccessorPrismLayer.gravity(coordinates, field, progressbar=False, density_name='density', thickness_threshold=None, **kwargs)[source]#
Computes the gravity generated by the layer of prisms
Uses
harmonica.prism_gravity
for computing the gravity field generated by the prisms of the layer. The density of the prisms will be assigned from thedata_var
chosen through thedensity_name
argument. Ignores the prisms whichtop
orbottom
boundaries arenp.nan``s. Prisms thinner than a given threshold can be optionally ignored through the ``thickness_threshold
argument. Allkwargs
will be passed toharmonica.prism_gravity
.- Parameters:
- coordinates
list
of
arrays
List of arrays containing the
easting
,northing
andupward
coordinates of the computation points defined on a Cartesian coordinate system. All coordinates should be in meters.- field
str
Gravitational field that wants to be computed. The available fields are: - Gravitational potential:
potential
- Eastward acceleration:g_e
- Northward acceleration:g_n
- Downward acceleration:g_z
- Diagonal tensor components:g_ee
,g_nn
,g_zz
- Non-diagonal tensor components:g_en
,g_ez
,g_nz
- progressbarbool (
optional
) If True, a progress bar of the computation will be printed to standard error (stderr). Requires
numba_progress
to be installed. Default toFalse
.- density_name
str
(optional
) Name of the property layer (or
data_var
of thexarray.Dataset
) that will be used for the density of each prism in the layer. Default to"density"
- thickness_threshold
float
orNone
Prisms thinner than this threshold will be ignored in the forward gravity calculation. If None, every prism with non-zero volume will be considered. Default to None.
- coordinates
- Returns:
- result
array
Gravitational potential is returned in :math:` ext{J}/ ext{kg}`, acceleration components in mGal, and tensor components in Eotvos.
- result
See also
- DatasetAccessorPrismLayer.to_pyvista(drop_null_prisms=True)[source]#
Return a pyvista UnstructuredGrid to plot the PrismLayer
- Parameters:
- drop_null_prismsbool (
optional
) If True, prisms with zero volume or with any
numpy.nan
as their top or bottom boundaries won’t be included in thepyvista.UnstructuredGrid
. If False, every prism in the layer will be included. Default True.
- drop_null_prismsbool (
- Returns:
- pv_grid
pyvista.UnstructuredGrid
pyvista.UnstructuredGrid
containing each prism of the layer as a hexahedron along with their properties.
- pv_grid
- DatasetAccessorPrismLayer.update_top_bottom(surface, reference)[source]#
Update top and bottom boundaries of the layer
Change the values of the
top
andbottom
coordinates based on the passedsurface
andreference
. Thetop
andbottom
boundaries of every prism will be equal to the correspondingsurface
andreference
values, respectively, ifsurface
is above thereference
on that point. Otherwise thetop
andbottom
boundaries of the prism will be equal to its correspondingreference
andsurface
, respectively.- Parameters:
- surface2d-array
Array used to create the uppermost boundary of the prisms layer. All heights should be in meters. On every point where
surface
is belowreference
, thesurface
value will be used to set thebottom
boundary of that prism, while thereference
value will be used to set thetop
boundary of the prism.- reference
float
or 2d-array Reference surface used to create the lowermost boundary of the prisms layer. It can be either a plane or an irregular surface passed as 2d array. Height(s) must be in meters.