Changelog#
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased#
Changed#
xugrid.UgridDataArrayAccessor.from_structured()
previously required the literal dimensions("y", "x")
. This requirement has been relaxed, it will now infer the dimensions from the provided coordinates.xugrid.Ugrid2d.from_structured()
previously only supported 1D coordinates; it now detects whether coordinates are 1D or 2D automatically. Accordingly,xugrid.Ugrid2d.from_structured_multicoord()
should no longer be used, and calling it will give a FutureWarning.The first argument of the
.regrid
methods ofxugrid.CentroidLocatorRegridder
,xugrid.OverlapRegridder
,xugrid.RelativeOverlapRegridder
, andxugrid.BarycentricInterpolator
has been renamed. The method now takes adata
argument instead ofobject
.
Added#
xugrid.UgridDataset.from_structured()
has been added to create UgriDatasets from xarray Datasets.
Fixed#
The
.regrid
methods ofxugrid.CentroidLocatorRegridder
,xugrid.OverlapRegridder
,xugrid.RelativeOverlapRegridder
, andxugrid.BarycentricInterpolator
now raise a TypeError if an inappropriate type is provided.
[0.12.1] 2024-09-09#
Fixed#
Release 0.12.0 changed the return type of the face node connectivity of
xugrid.Ugrid2d.voronoi_topology
from a scipy.sparse.coo_matrix to an ordinary np.array of integers (and similarly for internal voronoi tesselations); this dense array had fill (hard-coded) values of -1, potentially differing from the grid’s fill value. This lead to a number of errors for methods relying on voronoi tesselations (such as contour plots) if the fill value of the grid was not -1. Internally, aFILL_VALUE = -1
is now used everywhere in connectivity arrays, and fill values are no longer passed for internal methods; a value of -1 is always assumed. When converting the grid (back) to a dataset withxugrid.Ugrid1d.to_dataset()
orxugrid.Ugrid2d.to_dataset()
, the fill value is set back to its original value; the fill value is also set when callingxugrid.UgridDataArrayAccessor.to_netcdf()
orxugrid.UgridDatasetAccessor.to_netcdf()
.
Added#
xugrid.Ugrid1d
andxugrid.Ugrid2d
now take an optionalstart_index
which controls the start index for the UGRID connectivity arrays.xugrid.Ugrid1d.fill_value
,xugrid.Ugrid1d.start_index
,xugrid.Ugrid2d.fill_value
, andxugrid.Ugrid2d.start_index
, have been added to get and set the fill value and start index for the UGRID connectivity arrays. (Internally, every array is 0-based, and has a fill value of -1.)
Changed#
xugrid.Ugrid1d
andxugrid.Ugrid2d
will generally preserve the fill value and start index of grids when roundtripping from and to xarray Dataset. An exception is when the start index or fill value varies per connectivity:xugrid
will enforce a single start index and a single fill value per grid. In case of inconsistent values across connectivity arrays, the values associated with the core connectivity are used: for Ugrid2d, this is the face node connectivity.
[0.12.0] 2024-09-03#
Fixed#
The
xugrid.BarycentricInterpolator
now interpolates according to linear weights within the full bounds of the source grid, rather than only within the centroids of the source grid. Previously, it would give no results beyond the centroids for structured to structured regridding, and it would give nearest results (equal toxugrid.CentroidLocatorRegridder
) otherwise.
Added#
xugrid.UgridDataArrayAccessor.interpolate_na()
has been added to fill missing data. Currently, the only supported method is"nearest"
.xugrid.Ugrid1.dims
andxugrid.Ugrid2.dims
have been added to return a set of the UGRID dimensions.xugrid.UgridDataArrayAccessor.laplace_interpolate()
now uses broadcasts over non-UGRID dimensions and support lazy evaluation.
Changed#
Selection operations such as
UgridDataArrayAccessor.sel_points()
will now also return points that are located on the edges of 2D topologies.xugrid.Ugrid1d.dimensions
andxugrid.Ugrid2d.dimensions
now give a FutureWarning; use.dims
or.sizes
instead.Improved performance of
xugrid.open_dataset()
andxugrid.merge_partitions()
when handling datasets with a large number of variables (>100).
[0.11.2] 2024-08-16#
Fixed#
The regridders will no longer flip around data along an axis when regridding from data from structured to unstructured form when the coordinates along the dimensions is decreasing. (Decreasing y-axis is a common occurence in geospatial rasters.)
The regridders will no longer error on
.regrid()
if a structured target grid is non-equidistant, and contains an array delta (d
) coordinate rather than a single delta to denote cell sizes along a dimension (i.e.dy
alongy
midpoints, anddx
alongx
.)
Added#
xugrid.snap_nodes()
to snap neighboring vertices together that are located within a maximum snapping distance from each other. If vertices are located within a maximum distance, some of them are snapped to their neighbors (“targets”), thereby guaranteeing a minimum distance between nodes in the result. The determination of whether a point becomes a target itself or gets snapped to another point is primarily based on the order in which points are processed and their spatial relationships.
[0.11.1] 2024-08-13#
Fixed#
The reduction methods for the overlap regridders now behave consistently when all values are NaN or when all weights (overlaps) are zero, and all methods give the same answer irrespective of the order in which the values are encountered.
xugrid.merge_partitions()
will now raise a ValueError if zero partitions are provided.xugrid.merge_partitions()
will no longer error when chunks are inconsistent across variables in a dataset, but now returns a merged dataset while keeping the chunking per variable. (Note that if chunks are inconstent for a variable across partitions that they are still and always unified for the variable.)
Added#
Percentiles (5, 10, 25, 50, 75, 90, 95) have been added to the
xugrid.OverlapRegridder
as standard available reduction methods (available as"p5", "p10"
, etc.). Custom percentile values (e.g. 2.5, 42) can be setup usingxugrid.OverlapRegridder.create_percentile_method()
.
Changed#
Custom reduction functions provide to the overlap regridders no longer require an
indices
argument.xugrid.Ugrid2d.sel_points()
,xugrid.UgridDataArrayAccessor.sel_points()
andxugrid.UgridDatasetAccessor.sel_points()
now take anout_of_bounds
andfill_value
argument to determine what to with points that do not fall inside of any grid feature. Previously, the method silently dropped these points. The method now takes afill_value
argument to assign to out-of-bounds points. It gives a warning return usesfill_value=np.nan
by default. To enable the old behavior, setout_of_bounds="drop"
.
[0.11.0] 2024-08-05#
Fixed#
xugrid.merge_partitions()
now automatically merges chunks (if defined in the partition datasets). This removes the commonly seenPerformanceWarning: Slicing with an out-of-order index is generating ... times more chunks
warning in subsequent operations, and also greatly improves the performance of subsequent operations (roughly scaling linearly with the number of partitions). The previous behavior can be maintained by settingmerge_ugrid_chunks=False
. This keyword will likely be deprecated in the future as merging the UGRID dimension chunks should be superior for (almost all?) subsquent operations.xugrid.snap_to_grid()
now returns proper line indexes when multiple linestrings are snapped. Snapping previously could result in correct linestring locations, but wrong line indexes.
Added#
Included
edge_node_connectivity
inxugrid.Ugrid2d.from_meshkernel()
, so the ordering of edges is consistent withmeshkernel
.Added
xugrid.Ugrid1d.create_data_array()
,xugrid.Ugrid2d.create_data_array()
, andxugrid.UgridDataArray.from_data()
to more easily instantiate a UgridDataArray from a grid topology and an array of values.Added
xugrid.create_snap_to_grid_dataframe()
to provide more versatile snapping, e.g. with custom reductions to assign_edge_coords aggregated properties to grid edges.
Changed#
xugrid.UgridDataArrayAccessor.laplace_interpolate()
now usesrtol
andatol
keywords instead oftol
, to match changes inscipy.linalg.sparse.cg
.
[0.10.0] 2024-05-01#
Fixed#
Fixed indexing bug in the
"mode"
method inxugrid.CentroidLocatorRegridder
,xugrid.OverlapRegridder
,xugrid.RelativeOverlapRegridder
, which gave the method the tendency to repeat the first value in the source grid across the target grid.
Added#
xugrid.earcut_triangulate_polygons()
andxugrid.Ugrid2d.earcut_triangulate_polygons()
have been added to break down polygon geodataframes into a triangular mesh for further processing.xugrid.OverlapRegridder.weights_as_dataframe()
has been added to extract regridding weights (overlaps) from the regridders. This method is also available forBarycentricInterpolator
,CentroidLocatorRegridder
, andRelativeOverlapRegridder
.
[0.9.0] 2024-02-15#
Fixed#
xugrid.Ugrid2d.equals()
andxugrid.Ugrid1d.equals()
test if dataset is equal instead of testing type.Fixed bug in
xugrid.concat()
andxugrid.merge()
where multiple grids were returned if grids did not point to the same object id (i.e. copies).Fixed bug in
xugrid.Ugrid1d.merge_partitions()
, which causedValueError: indexes must be provided for attrs
.Fixed
from_structured
methods: the generated faces are now always in counterclockwise direction, also for increasing y-coordinates or decreasing x-coordinates.
Added#
xugrid.Ugrid2d.from_structured_multicoord()
has been added to generate UGRID topologies from rotated or approximated curvilinear grids.xugrid.Ugrid2d.from_structured_intervals1d()
has been added to generate UGRID topologies from “intervals”: the N + 1 vertex coordinates for N faces.xugrid.Ugrid2d.from_structured_intervals2d()
has been added to generate UGRID topologies from “intervals”: the (M + 1, N + 1) vertex coordinates for N faces.xugrid.UgridDataArrayAccessor.from_structured()
now takesx
andy
arguments to specify which coordinates to use as the UGRID x and y coordinates.xugrid.UgridDataset.sizes
as an alternative toxugrid.UgridDataset.dimensions
xugrid.Ugrid2d.max_face_node_dimension
which returns the dimension name designating nodes per face.xugrid.AbstractUgrid.max_connectivity_sizes
which returns all maximum connectivity dimensions and their corresponding size.xugrid.AbstractUgrid.max_connectivity_dimensions
which returns all maximum connectivity dimensions.
Changed#
xugrid.Ugrid2d.from_structured()
now takesx
andy
arguments instead ofx_bounds
andy_bounds
arguments.xugrid.merge_partitions()
now also merges datasets with grids that are only contained in some of the partition datasets.
[0.8.1] 2024-01-19#
Fixed#
xugrid.UgridDataArrayAccessor.reindex_like()
will now take the tolerance argument into account before sorting. In the past, near ties could be resolved differently between otherwise similar grid topologies due to roundoff.
Added#
xugrid.UgridDataArrayAccessor.laplace_interpolate()
now also supports interpolation of node associated data, and Ugrid1d topologies.xugrid.Ugrid1d.from_shapely()
andxugrid.Ugrid2d.from_shapely()
have been added to directly instantiate UGRID topologies from arrays of shapely geometries.
Changed#
xugrid.UgridDataArrayAccessor.laplace_interpolate()
no longer uses scipy’s ILU decomposition as a preconditioner. A simpler and more effective preconditioner is automatically used instead. The arguments have changed accordingly.direct_solve
is now by defaultFalse
.xugrid.Ugrid1d.from_geodataframe()
andxugrid.Ugrid2d.from_geodataframe()
now check whether the geodataframe argument is a geopandas GeoDataFrame, and whether the geometry types are appropriate (LineStrings for Ugrid1d, Polygons for Ugrid2d).
[0.8.0] 2023-12-11#
Changed#
Initialize Meshkernel with a spherical projection if the coordinate reference system (crs) is geographic.
Minimum Python version increased to 3.9.
[0.7.1] 2023-11-17#
Fixed#
Support for Meshkernel 3 (#171). Initialize Meshkernel with defaults, setting it to cartesian projection.
[0.7.0] 2023-10-19#
Added#
xugrid.Ugrid2d.to_nonperiodic()
,xugrid.UgridDataArrayAccessor.to_nonperiodic()
andxugrid.UgridDatasetAccessor.to_nonperiodic()
have been added to convert a “periodid grid” (where the leftmost nodes are the same as the rightmost nodes, e.g. a mesh for the globe) to an “ordinary” grid.Conversely,
xugrid.Ugrid2d.to_periodic()
,xugrid.UgridDataArrayAccessor.to_periodic()
andxugrid.UgridDatasetAccessor.to_periodic()
have been added to convert an ordinary grid to a periodic grid.xugrid.Ugrid2d.perimeter
has been added the compute the length of the face perimeters.xugrid.Ugrid1d.reindex_like()
,xugrid.Ugrid2d.reindex_like()
,xugrid.UgridDataArrayAccessor.reindex_like()
andxugrid.UgridDatasetAccessor.reindex_like()
have been added to deal with equivalent but differently ordered topologies and data.
Changed#
UGRID 2D topologies are no longer automatically forced in counterclockwise orientation during initialization.
Fixed#
Using an index which only reorders but does not change the size in
xugrid.Ugrid1d.topology_subset()
orxugrid.Ugrid2d.topology_subset()
would erroneously result in the original grid being returned, rather than a new grid with the faces or edges shuffled. This breaks the link the between topology and data when using.isel
on a UgridDataset or UgridDataArray. This has been fixed: both data and the topology are now shuffled accordingly.
[0.6.5] 2023-09-30#
Added#
xugrid.Ugrid2d.intersect_line()
,xugrid.Ugrid2d.intersect_linestring()
xugrid.UgridDataArrayAccessor.intersect_line()
,xugrid.UgridDataArrayAccessor.intersect_linestring()
,xugrid.UgridDatasetAccessor.intersect_line()
, andxugrid.UgridDatasetAccessor.intersect_linestring()
have been added to intersect line and linestrings and extract the associated face data.
Changed#
Selection operations along a line, or at point locations, will now prefix the name of the grid in the x and y coordinates. This avoids name collisions when multiple topologies are present in a dataset.
Xugrid now contains a partial copy of the xarray plot utils module, and its tests. The latest xarray release broke xugrid (on import), since (private) parts of xarray were used which no longer existed.
Fixed#
xugrid.UgridDatasetAccessor.sel()
would return only a single grid topology even when the selection subject contains more than one grid. It now correctly returns subsets of all topologies.
[0.6.4] 2023-08-22#
Fixed#
Bug in
xugrid.snap_to_grid()
, which caused anIndexError
. See #122.
[0.6.3] 2023-08-12#
Added#
Added
xugrid.burn_vector_geometries()
to burn vector geometries in the form of geopandas GeoDataFrames into a Ugrid2d topology.Added
xugrid.polygonize()
to create vector polygons for all connected regions of a Ugrid2d topology sharing a common value. The result is a geopandas GeoDataFrame.xugrid.Ugrid2d.validate_edge_node_connectivity()
has been added to validate edge_node_connectivity by comparing with the face_node_connectivity. The result can be used to define a valid subselection.xugrid.Ugrid2d.from_structured_bounds()
can be used to generate a Ugrid2d topology from x and y bounds arrays.xugrid.UgridDatasetAccessor.name
,xugrid.UgridDatasetAccessor.names
,xugrid.UgridDatasetAccessor.topology
; andxugrid.UgridDataArrayAccessor.name
,xugrid.UgridDataArrayAccessor.names
,xugrid.UgridDataArrayAccessor.topology
have been added to provide easier access to the names of the UGRID topologies.xugrid.UgridDatasetAccessor.rename()
andxugrid.UgridDataArrayAccessor.rename()
to rename both topology and the associated dimensions.xugrid.Ugrid2d.bounding_polygon()
has been added to get a polygon describing the bounds of the grid.
Fixed#
xugrid.CentroidLocatorRegridder
,xugrid.OverlapRegridder
, andxugrid.BarycentricInterpolator
will now also regrid structured to unstructured grid topologies.xugrid.Ugrid1d.to_dataset()
andxugrid.Ugrid2d.to_dataset()
no longer write unused connectivity variables into the attributes of the UGRID dummy variable.Conversion from and to GeoDataFrame will now conserve the CRS (coordinate reference system).
xugrid.UgridDatasetAccessor.to_geodataframe()
will no longer error when converting a UgridDataset that does not contain any variables.xugrid.OverlapRegridder.regrid()
will no longer give incorrect results on repeated calls with the “mode” method.
Changed#
Initializing a Ugrid2d topology with an invalid edge_node_connectivity will no longer raise an error.
xugrid.Ugrid1d.node_node_connectivity
,xugrid.Ugrid1d.directed_node_node_connectivity
,xugrid.Ugrid2d.node_node_connectivity
,xugrid.Ugrid2d.directed_node_node_connectivity
, andxugrid.Ugrid2d.face_face_connectivity
now contain the associated edge index in the.data
attribute of the resulting CSR matrix.
[0.6.2] 2023-07-26#
Fixed#
[0.6.1] 2023-07-07#
Fixed#
Fillvalue was not properly replaced in cast. See #113.
[0.6.0] 2023-07-05#
Added#
xugrid.Ugrid2d.label_partitions()
,xugrid.Ugrid2d.partition()
,xugrid.Ugrid2d.merge_partitions()
have been added to partition and merge a grid.xugrid.UgridDataArrayAccessor.partition()
,xugrid.UgridDataArrayAccessor.partition_by_label()
,xugrid.UgridDatasetAccessor.partition()
, andxugrid.UgridDatasetAccessor.partition_by_label()
have been added to part a grid and its associated data.xugrid.Ugrid1d.rename()
andxugrid.Ugrid2d.rename()
have been added to rename a grid, including the attributes that are created when the grid is converted into an xarray dataset.xugrid.Ugrid1d.node_node_connectivity()
andxugrid.Ugrid2.node_node_connectivity()
properties have been added.xugrid.Ugrid1d.topological_sort_by_dfs()
has been added.xugrid.Ugrid1d.contract_vertices()
has been added.
Fixed#
Regridding is possible again with regridders initiated
from_weights
. See #90. This was a broken feature in the 0.5.0 release.Computed weights for structured grids regridders now decrease with distance instead of increase.
Fixed edge case for regridding structured grids, where midpoints of the source and target grid are equal.
Fixed numba typing error for regridders.
Changed#
Regridding structured grids now throws error if computed weights < 0.0 or > 1.0, before these weights were clipped to 0.0 and 1.0 respectively.
[0.5.0] 2023-05-25#
Added#
xugrid.BarycentricInterpolator
,xugrid.CentroidLocatorRegridder
,xugrid.OverlapRegridder
, andRelativeOverlapRegridder
, now accept structured grids, in the form of axr.DataArray
with a"x"
and a"y"
coordinate.
[0.4.0] 2023-05-05#
Fixed#
xugrid.Ugrid2d.tesselate_centroidal_voronoi()
andxugrid.Ugrid2d.tesselate_circumcenter_voronoi()
will only include relevant centroids, rather than all the original centroids whenadd_exterior=False
. Previously, a scrambled voronoi grid could result from the tesselation when the original grid contained cells with only one neighbor.import xugrid
now does not throwImportError
anymore when the optional packagegeopandas
was missing in the environment.
Changed#
xugrid.Ugrid2d.sel_points()
andxugrid.UgridDataArrayAccessor.sel_points()
now return a result with an “index” coordinate, containing the (integer) index of the points.xugrid.Ugrid2d
will now error during initialization if the node_edge_connectivity is invalid (i.e. contains nodes that are not used in any face).xugrid.UgridDataArrayAccessor.plot.pcolormesh()
now defaults toedgecolors="face"
to avoid white lines (which can be become relatively dominant in when plotting large grids).
Added#
xugrid.Ugrid2d.tesselate_circumcenter_voronoi()
has been added to provide orthogonal voronoi cells for triangular grids.xugrid.Ugrid1d.to_dataset()
,xugrid.Ugrid2d.to_dataset()
,xugrid.UgridDataArrayAccessor.to_dataset()
, andxugrid.UgridDatasetAccessor.to_dataset()
now take anoptional_attributes
keyword argument to generate the optional UGRID attributes.xugrid.Ugrid1d
andxugrid.Ugrid2d
now have anattrs
property.xugrid.UgridDatasetAccessor.rasterize()
andxugrid.UgridDatasetAccessor.rasterize_like()
have been added to rasterize all face variables in a UgridDataset.
[0.3.0] 2023-03-14#
Fixed#
Changed#
pygeos
has been replaced byshapely >= 2.0
.xugrid.snap_to_grid()
will now return a UgridDataset and a geopandas GeoDataFrame. The UgridDataset contains the snapped data on the edges of the the UGRID topology.xugrid.RelativeOverlapRegridder
has been created to separate the relative overlap logic fromxugrid.OverlapRegridder
.xugrid.BarycentricInterpolator
,xugrid.CentroidLocatorRegridder
,xugrid.OverlapRegridder
, andRelativeOverlapRegridder
can now be instantiated from weights (.from_weights
) or from a dataset (.from_dataset
) containing pre-computed weights.Regridder classes initiated with method geometric_mean now return NaNs for negative data.
Added#
xugrid.Ugrid2d.tesselate_circumcenter_voronoi()
has been added to provide orthogonal voronoi cells for triangular grids.
[0.2.1] 2023-02-06#
Fixed#
xugrid.open_dataarray()
will now returnxugrid.UgridDataArray
instead of only an xarray DataArray without topology.Setting wrapped properties of the xarray object (such as
name
) now works.Creating new (subset) topologies via e.g. selection will no longer error when datasets contains multiple coordinates systems (such as both longitude and latitude next to projected x and y coordinates).
Changed#
Added#
Several regridding methods have been added for face associated data:
xugrid.BarycentricInterpolator
have been added to interpolate smoothly,xugrid.CentroidLocatorRegridder
has been added to simply sample based on face centroid, andxugrid.OverlapRegridder
supports may aggregation methods (e.g. area weighted mean).Added
xugrid.Ugrid1d.edge_node_coordinates
.Added
xugrid.Ugrid2d.edge_node_coordinates
andxugrid.Ugrid2d.face_node_coordinates
.
[0.2.0] 2023-01-19#
Fixed#
xugrid.Ugrid1d.topology_subset()
,xugrid.Ugrid2d.topology_subset()
, and therefore alsoxugrid.UgridDataArrayAccessor.sel()
andxugrid.UgridDatasetAccessor.sel()
now propagate UGRID attributes. Before this fix, dimension of the UGRID topology would go out of sync with the DataArray, as a subset would return a new UGRID topology with default UGRID names.xugrid.Ugrid2d.topology_subset()
,xugrid.UgridDataArrayAccessor.sel()
xugrid.UgridDatasetAccessor.sel()
will now return a correct UGRID 2D topology when fill values are present in the face node connectivity.xugrid.plot.contour()
andxugrid.plot.contourf()
will no longer plot erratic contours when “island” faces are present (no connections to other faces) or when “slivers” are present (where cells have a only a left or right neighbor).xugrid.plot.pcolormesh()
will draw all edges around faces now when edgecolor is defined, rather than skipping some edges.Do not mutate edge_node_connectivity in UGRID2D when the face_node_connectivity property is accessed.
Changed#
Forwarding to the internal xarray object is now setup at class definition of
UgridDataArray
andUgridDataset
rather than at runtime. This means tab completion and docstrings for the xarray methods should work.The UGRID dimensions in
UgridDataArray
andUgridDataset
are labelled at initialization. This allows us to track necessary changes to the UGRID topology for general xarray operations. Forwarded methods (such asUgridDataArray.isel()
) will now create a subset topology if possible, or error if an invalid topology is created by the selection.This also means that selection on one facet of the grid (e.g. the face dimension) will also result in a valid selection of the data on another facet (such as the edge dimension).
xugrid.Ugrid1d.sel()
andxugrid.Ugrid2d.sel()
now take anobj
argument and return a DataArray or Dataset.Consequently, xugrid.UgridDataArrayAccessor.isel and xugrid.UgridDatasetAccessor.isel have been removed.
xugrid.Ugrid1d.dimensions
andxugrid.Ugrid2d.dimensions
will now return a dictionary with the keys the dimension names and as the values the sizes of the dimensions.xugrid.Ugrid2d.voronoi_topology
will now include exterior vertices to also generate a valid 2D topology when when “island” faces are present (no connections to other faces) or when “slivers” are present (where cells have a only a left or right neighbor).
Added#
xugrid.Ugrid1d
andxugrid.Ugrid2d
can now be initialized with anattrs
argument to setup non-default UGRID attributes such as alternative node, edge, or face dimensions.xugrid.Ugrid1d.topology_subset()
,xugrid.Ugrid2d.topology_subset()
,xugrid.Ugrid1d.isel()
, andxugrid.Ugrid2d.isel()
now take areturn_index
argument and will to return UGRID dimension indexes if set to True.xugrid.UgridDataArrayAccessor.clip_box()
andxugrid.UgridDatasetAccessor.clip_box()
have been added to more easily select data in a bounding box.For convenience,
.grid
,.grids
,.obj
properties are now available on all these classes:UgridDataArray
,UgridDataset
,UgridDataArrayAccessor
, andUgridDatasetAccessor
.Added
xugrid.merge_partitions()
to merge topology and data that have been partitioned along UGRID dimensions.
[0.1.10] 2022-12-13#
Fixed#
Move matplotlib import into a function body so matplotlib remains an optional dependency.
[0.1.9] 2022-12-13#
Changed#
Warn instead of error when the UGRID attributes indicate a set of coordinate that are not present in the dataset.
Use pyproject.toml for setuptools instead of setup.cfg.
Added#
xugrid.Ugrid1d.edge_bounds
has been added to get the bounds for every edge contained in the grid.xugrid.Ugrid2d.edge_bounds
has been added to get the bounds for every edge contained in the grid.xugrid.Ugrid2d.face_bounds
has been added to get the bounds for face edge contained in the grid.xugrid.Ugrid1d.from_meshkernel()
andxugrid.Ugrid2d.from_meshkernel()
have been added to initialize Ugrid topology from a meshkernel object.xugrid.Ugrid1d.plot()
andxugrid.Ugrid2d.plot()
have been added to plot the edges of the grid.
Fixed#
xugrid.UgridDataArray.from_structured()
will no longer result in a flipped grid when the structured coordintes are not ascending.
[0.1.7] 2022-09-06#
Fixed#
The setitem method of
xugrid.UgridDataset
has been updated to check the dimensions of grids rather than the dimensions of objects to decide whether a new grids should be appended.xugrid.UgridDataArrayAccessor.assign_edge_coords()
andxugrid.UgridDatasetAccessor.assign_edge_coords()
have been added to add the UGRID edge coordinates to the xarray object.xugrid.UgridDataArrayAccessor.assign_face_coords()
andxugrid.UgridDatasetAccessor.assign_face_coords()
have been added to add the UGRID face coordinates to the xarray object.Fixed mixups in
xugrid.UgridRolesAccessor
for inferring UGRID dimensions, which would result incorrectly in aUgridDimensionError
complaining about conflicting dimension names.
[0.1.5] 2022-08-22#
Fixed#
list
anddict
type annotations have been replaced withList
andDict
from the typing module to support older versions of Python (<3.9).
Changed#
The
inplace
argument has been removed fromxugrid.Ugrid1d.to_crs()
andxugrid.Ugrid2d.to_crs()
; A copy is returned when the CRS is already as requested.
Added#
xugrid.UgridDataArrayAccessor.set_crs()
has been added to set the CRS.xugrid.UgridDataArrayAccessor.to_crs()
has been added to reproject the grid of the DataArray.xugrid.UgridDatasetAccessor.set_crs()
has been added to set the CRS ofxugrid.UgridDatasetAccessor.to_crs()
has been added to reproject a grid or all grids of a dataset.xugrid.UgridDataArrayAccessor.bounds
has been added to get the bounds of the grid coordinates.xugrid.UgridDataArrayAccessor.total_bounds
has been added to get the bounds of the grid coordinates.xugrid.UgridDatasetAccessor.bounds
has been added to get the bounds for every grid contained in the dataset.xugrid.UgridDatasetAccessor.total_bounds
has been added to get the total bounds of all grids contained in the dataset.
[0.1.4] 2022-08-16#
Fixed#
A
start_index
of 1 in connectivity arrays is handled and will no longer result in indexing errors.levels
argument is now respected in line and pcolormesh plotting methods.
Changed#
UGRID variables are now extracted via
xugrid.UgridRolesAccessor
to allow for multiple UGRID topologies in a single dataset.Extraction of the UGRID dimensions now proceeds via the dummy variable attributes, the connetivity arrays, and finally the coordinates.
Multiple coordinates can be supported. The UgridRolesAccessor attempts to infer valid node coordinates based on their standard names (one of``projection_x_coordinate, projection_y_coordinate, longitude, latitude``); a warning is raised when these are not found.
xugrid.UgridDataset
now supports multiple Ugrid topologies. Consequently, its.grid
attribute has been replaced by.grids
.The xarray object is no longer automatically wrapped when accessing the
.obj
attribute of a UgridDataArray or UgridDataset.Separate UgridAccessors have been created for UgridDataArray and UgridDataset as many methods are specific to one but not the other.
The Ugrid classes have been subtly changed to support multiple topologies in a dataset. The
.dataset
attribute has been renamed to._dataset
, as access to the dataset should occur via the.to_dataset()
method instead, which can check for consistency with the xarray object.
Added#
xugrid.UgridRolesAccessor
has been added to extract UGRID variables from xarray Datasets.xugrid.merge()
andxugrid.concat()
have been added, since the xarray functions raise a TypeError on non-xarray objects.xugrid.UgridDataArrayAccessor.assign_node_coords()
andxugrid.UgridDatasetAccessor.assign_node_coords()
have been added to add the UGRID node coordinates to the xarray object.xugrid.UgridDataArrayAccessor.set_node_coords()
andxugrid.UgridDatasetAccessor.set_node_coords()
have been added to set other coordinates (e.g. latitude-longitude instead of projected coordinates) as the active coordinates of the Ugrid topology.