UXARRAY / uxarray

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

Implement `Grid.open_file` method support non xarray formats including Shapefile/Geojson #808

Closed rajeeja closed 2 weeks ago

rajeeja commented 4 months ago

Closes #635

Support Polygon and Multipolygon

philipc2 commented 2 months ago

I'm wondering if this implementation can be generalized as a Grid.from_geopandas() or similar method as discussed in https://github.com/UXARRAY/uxarray/issues/635#issuecomment-1907005496

rajeeja commented 2 months ago

I'm wondering if this implementation can be generalized as a Grid.from_geopandas() or similar method as discussed in https://github.com/UXARRAY/uxarray/issues/635#issuecomment-1907005496

This makes sense, I will try to generalize it and at least add a test case for geojson also. It would have to be seen how the reader object is different when reading different kinds of format that are supported by geopandas: We may support a limited subset and we can specify what we support in test cases.

Thanks so much for the review. I will push the changes shortly

philipc2 commented 2 months ago

will

I'm wondering if this implementation can be generalized as a Grid.from_geopandas() or similar method as discussed in #635 (comment)

This makes sense, I will try to generalize it and at least add a test case for geojson also. It would have to be seen how the reader object is different when reading different kinds of format that are supported by geopandas: We may support a limited subset and we can specify what we support in test cases.

Thanks so much for the review. I will push the changes shortly

Maybe for our Grid, it would make the most sense to have a Grid.from_geodataframe() method, where the user can provide a GeoDataFrame that contains the geometry we will read in.

The workflow would require the user to use the geopandas.read_file() or similar methods to first obtain a GeoDataFrame and then pass it into a Grid

import geopandas as gp
import uxarray as ux

# load in a shape (or other) file
gdf = gp.read_file(...)

# create a Grid from the GeoDataFrame
uxgrid = ux.Grid.from_geodataframe(gdf)

Pinging @kmsampson for any thoughts.

rajeeja commented 3 weeks ago

We should consider a basic User Guide notebook for this too. I can provide the quad-hexagon grid in multiple different formats (i.e. shape, geoparquet, etc.) to showcase this functionality.

I have some mesh files as a part of this, we want to be careful with how many we bundle as a part of the repo.

erogluorhan commented 3 weeks ago

We should consider a basic User Guide notebook for this too. I can provide the quad-hexagon grid in multiple different formats (i.e. shape, geoparquet, etc.) to showcase this functionality.

I have some mesh files as a part of this, we want to be careful with how many we bundle as a part of the repo.

Maybe using online files rather than having them all hosted in the repo?

philipc2 commented 3 weeks ago

We should consider a basic User Guide notebook for this too. I can provide the quad-hexagon grid in multiple different formats (i.e. shape, geoparquet, etc.) to showcase this functionality.

I have some mesh files as a part of this, we want to be careful with how many we bundle as a part of the repo.

Maybe using online files rather than having them all hosted in the repo?

Do we have an issue open for this topic in general?

rajeeja commented 2 weeks ago

We should consider a basic User Guide notebook for this too. I can provide the quad-hexagon grid in multiple different formats (i.e. shape, geoparquet, etc.) to showcase this functionality.

I have some mesh files as a part of this, we want to be careful with how many we bundle as a part of the repo.

Maybe using online files rather than having them all hosted in the repo?

Do we have an issue open for this topic in general?

946 would cover this also, not a explicit issue for this.