xarray-contrib / xdggs

Xarray extension for DGGS
Apache License 2.0
51 stars 9 forks source link

'Area' (polygon?) of each grid cell in XDGGS #25

Open tinaok opened 8 months ago

tinaok commented 8 months ago

I have specific use cases: I possess an observation at a certain latitude and longitude, and I want to compare it with a model output already structured in a healpix grid using Xarray-healpix. I'd like to determine which cell_id corresponds to my observation.

Now, with XDGGS, each cell_id can contain lat/lon values, probably indicating the center of the cell. This determination should be based on whether the observation falls within the cell 'area', rather than the 'nearest center coordinate' (lat/lon).

Is it possible to obtain such information from XDGGS? Should we consider representing this area as a type of polygon, or could XDGGS have a function where each cell_id corresponds to an 'area' value specific to that cell_id index?

keewis commented 8 months ago

this is what we've been discussing in #10: construct the boundaries of the cells and use xvec to perform the point-in-polygon search.

(so in other words, I think this is a duplicate of #10)

benbovy commented 8 months ago

From the title I initially thought the suggestion was to add a function to extract the areas of the cells (which we definitely should, e.g., ds.dggs.cell_areas()), but yeah it looks more related to #10.