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.

__init__(obj: DataArray, grid: Type[AbstractUgrid])[source]#

Methods

__init__(obj, grid)

assign_edge_coords()

Assign edge coordinates from the grid to the object.

assign_face_coords()

Assign face coordinates from the grid to the object.

assign_node_coords()

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.

connected_components()

Every edge or face is given a component number.

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 gaps in data (np.nan values) 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.

reverse_cuthill_mckee()

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)

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.

to_periodic()

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

bounds

Mapping from grid name to tuple containing minx, miny, maxx, maxy values of the grid's node coordinates.

crs

The Coordinate Reference System (CRS) represented as a pyproj.CRS object.

grids

The UGRID topology of this DataArry, as a list.

name

Name of the UGRID topology of this DataArray.

names

Name of the UGRID topology, as a list.

topology

Mapping from name to UGRID topology.

total_bounds

Returns a tuple containing minx, miny, maxx, maxy values of the grid's node coordinates.