icesat2py / icepyx

Python tools for obtaining and working with ICESat-2 data
https://icepyx.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
207 stars 106 forks source link

accept all vector file inputs #384

Open JessicaS11 opened 1 year ago

JessicaS11 commented 1 year ago
    At L361, it says `if spatial_extent.split(".")[-1] in ["kml", "shp", "gpkg"]:` which restricts the possible file types to KMLs, shapefiles and geopackages. However at L114, the code uses `gpd.read_file(spatial_extent)`, which should mean that any other OGR supported vector file format should work (e.g. GeoJSON, FlatGeoBuf, etc).

Do you think it's possible to remove the hardcoded file extension check at L361? Maybe a try-except statement to see if the file can be read directly into a geopandas.GeoDataFrame?

_Originally posted by @weiji14 in https://github.com/icesat2py/icepyx/pull/331#discussion_r1005759533_

Theoretically, the NSIDC subsetter should accept any vector file that is also supported by OGR. We'd like to remove the file format restrictions, but need to add some more tests/confirm that this tracks. See also the brief discussion in the PR.