Skip to content

Commit

Permalink
del not pop since I don't care removed items
Browse files Browse the repository at this point in the history
  • Loading branch information
jhkennedy committed Sep 7, 2023
1 parent c10044c commit 740f044
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hyp3_autorift/crop.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@


def crop_netcdf_product(netcdf_file: Path):
"""
Args:
netcdf_file:
"""
with xr.open_dataset(netcdf_file) as ds:
# this will drop X/Y coordinates, so drop non-None values just to get X/Y extends
xy_ds = ds.where(ds.v.notnull(), drop=True)
Expand Down Expand Up @@ -112,7 +117,7 @@ def crop_netcdf_product(netcdf_file: Path):
encoding = ENCODING_TEMPLATE.copy()
if not netcdf_file.name.startswith('S1'):
for radar_variable in ['M11', 'M12', 'va', 'vr']:
encoding.pop(radar_variable)
del encoding[radar_variable]

for _, attributes in encoding.items():
if attributes['_FillValue'] is not None:
Expand Down

0 comments on commit 740f044

Please sign in to comment.