diff --git a/debug_reading_netcdf.py b/debug_reading_netcdf.py new file mode 100644 index 0000000..5ef5b69 --- /dev/null +++ b/debug_reading_netcdf.py @@ -0,0 +1,11 @@ +import numpy as np +from rasters import Raster +from rasters import Point + +# reading URI: netcdf:"/Users/halverso/data/GEOS5FP/2021.05.29/GEOS.fp.asm.tavg3_2d_aer_Nx.20210529_1930.V01.nc4":TOTEXTTAU nodata: nan geometry: POINT (-110.0522 31.7438) resampling: nearest +URI = 'netcdf:"/Users/halverso/data/GEOS5FP/2021.05.29/GEOS.fp.asm.tavg3_2d_aer_Nx.20210529_1930.V01.nc4":TOTEXTTAU' +nodata = np.nan +geometry = Point(-110.0522, 31.7438) +resampling = 'nearest' +raster = Raster.open(URI, nodata=nodata, geometry=geometry, resampling=resampling) +print(raster) diff --git a/pyproject.toml b/pyproject.toml index 9695368..3fdee58 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "rasters" -version = "1.13.1" +version = "1.13.2" description = "raster processing toolkit" readme = "README.md" authors = [ diff --git a/rasters/CRS.py b/rasters/CRS.py index ed286c9..96b88c5 100644 --- a/rasters/CRS.py +++ b/rasters/CRS.py @@ -26,6 +26,10 @@ def __init__(self, projparams: Any = None, **kwargs) -> None: projparams (Any): Projection parameters used to initialize the CRS object. **kwargs: Additional keyword arguments passed to the pyproj.CRS constructor. """ + # Handle None, empty string, or other invalid projparams by defaulting to WGS84 + if projparams is None or projparams == '' or (isinstance(projparams, str) and projparams.strip() == ''): + projparams = "EPSG:4326" + super(CRS, self).__init__(projparams=projparams, **kwargs) self._proj4_string = None # Cache for proj4 string