Skip to content

Update rubbersheeting upsampling method#212

Open
xhuang-jpl wants to merge 26 commits intoisce-framework:developfrom
xhuang-jpl:update_rubbersheet_sampling
Open

Update rubbersheeting upsampling method#212
xhuang-jpl wants to merge 26 commits intoisce-framework:developfrom
xhuang-jpl:update_rubbersheet_sampling

Conversation

@xhuang-jpl
Copy link
Contributor

@xhuang-jpl xhuang-jpl commented Feb 3, 2026

This PR is to replace the default Nearest Neighbor upsampling method in the rubbersheeting with the bilinear method as suggested by the Science team members.

Xiaodong Huang added 26 commits September 19, 2023 20:40
Copy link
Contributor

@seongsujeong seongsujeong left a comment

Choose a reason for hiding this comment

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

LGTM, but please be advised that saving intermediate file in ENVI format may cause issue that GDAL reader misinterprets the raster's format. See here for detail.

@xhuang-jpl
Copy link
Contributor Author

here

Thank you @seongsujeong, it seems strange that GDAL misinterprets the ENVI format.

@seongsujeong
Copy link
Contributor

That's related to how GDAL recognizes the file format of raster. It makes use of first few bits of the file (i.e. magic bytes. So, the first few bytes of the ENVI file coincides with magic bytes of certain file format, GDAL will treat the raster file as such. For example, the first few bytes of ENVI raster starts with ff d8 ff e0 then GDAL will try to load ENVI file as JPG.

This issue has been found from COMPASS, which caused very few processes to fail. More information is documented in the issue below:
opera-adt/COMPASS#206

@xhuang-jpl
Copy link
Contributor Author

xhuang-jpl commented Feb 3, 2026

That's related to how GDAL recognizes the file format of raster. It makes use of first few bits of the file (i.e. magic bytes. So, the first few bytes of the ENVI file coincides with magic bytes of certain file format, GDAL will treat the raster file as such. For example, the first few bytes of ENVI raster starts with ff d8 ff e0 then GDAL will try to load ENVI file as JPG.

This issue has been found from COMPASS, which caused very few processes to fail. More information is documented in the issue below: opera-adt/COMPASS#206

Interesting, thank you @seongsujeong for the classification. From the code, it seems that GDAL tries to recognize ENVI format via reading ENVI's header file (.HDR .hdr etc.) which starts with ENVI string. You are right that it is because the first few bytes of ENVI file coincides with the magic bytes.

https://github.com/OSGeo/gdal/blob/7041600447d878dee35b64f5510c1c232de3616c/frmts/raw/envidataset.cpp#L1899

@seongsujeong
Copy link
Contributor

This happens even when .hdr file exists. I'll send you a separate message to test it by yourself.

@xhuang-jpl
Copy link
Contributor Author

This happens even when .hdr file exists. I'll send you a separate message to test it by yourself.

Thank you @seongsujeong, I get your point and no need the test anymore.

@xhuang-jpl
Copy link
Contributor Author

xhuang-jpl commented Feb 3, 2026

In addition, I checked the resampling steps, the resampling reader uses the plain binary file so there will be no issue for this change, but we should keep track of this issue for other steps.

az_off_reader = np.memmap(

@seongsujeong
Copy link
Contributor

Sounds good. Thanks for checking the code's behavior @xhuang-jpl

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