Skip to content

Commit afe2d7c

Browse files
Merge pull request #96 from EOPF-Explorer/perf/avoid-writing-crs
perf: avoid writing CRS to dataarray
2 parents d183560 + 4fe2b5e commit afe2d7c

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

titiler/eopf/reader.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,12 @@ def _arrange_dims(da: xarray.DataArray) -> xarray.DataArray:
263263
da.attrs.update({"valid_min": valid_range[0], "valid_max": valid_range[1]})
264264

265265
# Make sure we have a valid CRS
266-
crs = da.rio.crs or "epsg:4326"
267-
da = da.rio.write_crs(crs)
266+
crs = da.rio.crs
267+
if not crs:
268+
crs = WGS84_CRS
269+
da = da.rio.write_crs(WGS84_CRS)
268270

269-
if crs == "epsg:4326" and (da.x > 180).any():
271+
if crs == WGS84_CRS and (da.x > 180).any():
270272
# Adjust the longitude coordinates to the -180 to 180 range
271273
da = da.assign_coords(x=(da.x + 180) % 360 - 180)
272274

0 commit comments

Comments
 (0)