Skip to content

Commit 1d3a255

Browse files
Merge pull request #57 from gregory-halverson-jpl/main
fixing defualt CRS for NetCDF
2 parents f6ada15 + a854a16 commit 1d3a255

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

debug_reading_netcdf.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import numpy as np
2+
from rasters import Raster
3+
from rasters import Point
4+
5+
# 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
6+
URI = 'netcdf:"/Users/halverso/data/GEOS5FP/2021.05.29/GEOS.fp.asm.tavg3_2d_aer_Nx.20210529_1930.V01.nc4":TOTEXTTAU'
7+
nodata = np.nan
8+
geometry = Point(-110.0522, 31.7438)
9+
resampling = 'nearest'
10+
raster = Raster.open(URI, nodata=nodata, geometry=geometry, resampling=resampling)
11+
print(raster)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "rasters"
7-
version = "1.13.1"
7+
version = "1.13.2"
88
description = "raster processing toolkit"
99
readme = "README.md"
1010
authors = [

rasters/CRS.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ def __init__(self, projparams: Any = None, **kwargs) -> None:
2626
projparams (Any): Projection parameters used to initialize the CRS object.
2727
**kwargs: Additional keyword arguments passed to the pyproj.CRS constructor.
2828
"""
29+
# Handle None, empty string, or other invalid projparams by defaulting to WGS84
30+
if projparams is None or projparams == '' or (isinstance(projparams, str) and projparams.strip() == ''):
31+
projparams = "EPSG:4326"
32+
2933
super(CRS, self).__init__(projparams=projparams, **kwargs)
3034
self._proj4_string = None # Cache for proj4 string
3135

0 commit comments

Comments
 (0)