UXARRAY / uxarray

Xarray extension for unstructured climate and global weather data analysis and visualization.
https://uxarray.readthedocs.io/
Apache License 2.0
149 stars 31 forks source link

Add `UxDataset.integrate()` and `UxDataArray.integrate()` over region #526

Open erogluorhan opened 10 months ago

erogluorhan commented 10 months ago

np.float64 UxDataset.integrate(self, [quadrature_rule, order, Grid region]) that integrates the dataset variables and np.float64 UxDataArray.integrate(self, [quadrature_rule, order, Grid region]) that integrates the data array over a region, if specified.

Note: Existing UxDataset.integrate() and UxDataArray.integrate() integrate over all the faces of the given mesh.

philipc2 commented 10 months ago

Essentially, much of our integrate and other functionality would remain unchanged, since we would need to implement a way of obtaining a "subset" of our grid.

For example

# global integral 
uxds['v1'].integrate()

# regional integral from a bounding box
uxds['v1'].bound(lon=(-80, 80), lat=(-20,20)).integrate()

# regional integral using nearest neighbors
uxds['v1'].nearest_neighbor(center=(0, 0), r=15).integrate()

Obtaining a subset of our grid while interfacing with our UxDataArray and UxDataset and Grid should be a top priority.

erogluorhan commented 8 months ago

Just an FYI: With this over-a-region functionality, the edge-faces may be expected to change to fit into the region in the newer Grid, so the subsetting implementation in PR #616 may not be sufficient for the ask here (cc @philipc2)

philipc2 commented 2 hours ago

Just an FYI: With this over-a-region functionality, the edge-faces may be expected to change to fit into the region in the newer Grid, so the subsetting implementation in PR #616 may not be sufficient for the ask here (cc @philipc2)

@erogluorhan

Any new thoughts on this?