Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure all encoding attributes are carried over when cropping #282

Merged
merged 2 commits into from
Jul 3, 2024

Conversation

jhkennedy
Copy link
Contributor

@jhkennedy jhkennedy commented Jul 3, 2024

For Sentinel-1 granules, the M11/M12 variables lost their scale_factor and add_offset attributes when cropping, leading to corrupted data. This ensures those attributes are preserved.

Refs:

To test you can download this uncropped S1 product:

aws s3 ls --no-sign-request s3://jhk-shenanigans/ITS_LIVE/crop/S1A_IW_SLC__1SDV_20170203T162106_20170203T162132_015121_018B9A_1380_X_S1A_IW_SLC__1SDV_20170215T162105_20170215T162133_015296_019127_6E1E_G0120V02_P099_IL_ASF_OD.nc

and then run:

from pathlib import Path

from hyp3_autorift.crop import crop_netcdf_product

netcdf_file = Path('S1A_IW_SLC__1SDV_20170203T162106_20170203T162132_015121_018B9A_1380_X_S1A_IW_SLC__1SDV_20170215T162105_20170215T162133_015296_019127_6E1E_G0120V02_P099_IL_ASF_OD.nc')

cropped_file = crop_netcdf_product(netcdf_file)

You should see a scale_factor and add_offset attribute for the M11/M12 variables (easiest to check with ncdump -h) using this branch, and not using the develop branch.

Copy link
Contributor

@mfangaritav mfangaritav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The attributes scale_factor and add_offset are preserved after the cropping is done.

@jhkennedy jhkennedy merged commit 95a884d into develop Jul 3, 2024
6 checks passed
@jhkennedy jhkennedy deleted the s1-crop-fix branch July 3, 2024 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants