xugrid.UgridDataArrayAccessor#
- class xugrid.UgridDataArrayAccessor(obj: DataArray, grid: Type[AbstractUgrid])[source]#
This “accessor” makes operations using the UGRID topology available via the
.ugrid
attribute for UgridDataArrays and UgridDatasets.Methods
__init__
(obj, grid)Assign edge coordinates from the grid to the object.
Assign face coordinates from the grid to the object.
Assign node coordinates from the grid to the object.
binary_dilation
([iterations, mask, border_value])Binary dilation can be used on a boolean array to expand the "shape" of features.
binary_erosion
([iterations, mask, border_value])Binary erosion can be used on a boolean array to shrink the "shape" of features.
clip_box
(xmin, ymin, xmax, ymax)Clip the DataArray or Dataset by a bounding box.
Every edge or face is given a component number.
interpolate_na
([method, max_distance])Fill in NaNs by interpolating.
intersect_line
(start, end)Intersect a line with the grid of this data, and fetch the values of the intersected faces.
intersect_linestring
(linestring)Intersect the grid along a collection of linestrings.
laplace_interpolate
([xy_weights, ...])Fill in NaNs by using Laplace interpolation.
partition
(n_part)Partition a grid into a given number of parts.
partition_by_label
(labels)Partition a grid by labels.
rasterize
(resolution)Rasterize unstructured grid by sampling.
rasterize_like
(other)Rasterize unstructured grid by sampling on the x and y coordinates of
other
.reindex_like
(other[, tolerance])Conform this object to match the topology of another object.
rename
(name)Give a new name to the UGRID topology and update the associated coordinate and dimension names in the DataArray.
Reduces bandwith of the connectivity matrix.
sel
([x, y])Return a new object, a subselection in the UGRID x and y coordinates.
sel_points
(x, y[, out_of_bounds, fill_value])Select points in the unstructured grid.
set_crs
([crs, epsg, allow_override])Set the Coordinate Reference System (CRS) of a UGRID topology.
set_node_coords
(node_x, node_y)Given names of x and y coordinates of the nodes of an object, set them as the coordinates in the grid.
to_crs
([crs, epsg])Transform geometries to a new coordinate reference system.
to_dataset
([optional_attributes])Convert this UgridDataArray or UgridDataset into a standard xarray.Dataset.
to_geodataframe
([name, dim_order])Convert data and topology of one facet (node, edge, face) of the grid to a geopandas GeoDataFrame.
to_netcdf
(*args, **kwargs)Write dataset contents to a UGRID compliant netCDF file.
to_nonperiodic
(xmax)Convert this grid from a periodic grid (where the rightmost boundary shares its nodes with the leftmost boundary) to an aperiodic grid, where the leftmost nodes are separate from the rightmost nodes.
Convert this grid to a periodic grid, where the rightmost boundary shares its nodes with the leftmost boundary.
to_zarr
(*args, **kwargs)Write dataset contents to a UGRID compliant Zarr file.
Attributes
Mapping from grid name to tuple containing
minx, miny, maxx, maxy
values of the grid's node coordinates.The Coordinate Reference System (CRS) represented as a
pyproj.CRS
object.The UGRID topology of this DataArry, as a list.
Name of the UGRID topology of this DataArray.
Name of the UGRID topology, as a list.
Mapping from name to UGRID topology.
Returns a tuple containing
minx, miny, maxx, maxy
values of the grid's node coordinates.