Skip to content

Commit

Permalink
added another missing reserved name
Browse files Browse the repository at this point in the history
  • Loading branch information
rosepearson committed Oct 9, 2024
1 parent 3b352ec commit 4fdc9d6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/geofabrics/dem.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,17 +437,21 @@ def _write_netcdf_conventions_in_place(
crs_dict
A dict with horizontal and vertical CRS information.
"""

reserved_names = ["_NCProperties", "_Netcdf4Coordinates"]

dem.rio.write_crs(crs_dict["horizontal"], inplace=True)
dem.rio.write_transform(inplace=True)
if "_NCProperties" in dem.attrs.keys():
del dem.attrs["_NCProperties"]
for reserved_name in reserved_names:
if reserved_name in dem.attrs.keys():
del dem.attrs[reserved_name]
for layer in ["z", "data_source", "lidar_source", "zo"]:
if layer in dem:
dem[layer].rio.write_crs(crs_dict["horizontal"], inplace=True)
dem[layer].rio.write_nodata(numpy.nan, encoded=True, inplace=True)
if "_NCProperties" in dem[layer].attrs.keys():
del dem[layer].attrs["_NCProperties"]
for reserved_name in reserved_names:
if reserved_name in dem[layer].attrs.keys():
del dem[layer].attrs[reserved_name]

def _extents_from_mask(self, mask: numpy.ndarray, transform: dict):
"""Define the spatial extents of the pixels in the DEM as defined by the mask
Expand Down

0 comments on commit 4fdc9d6

Please sign in to comment.