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

Re-sampling strategy #21

Closed
lillythomas opened this issue Nov 3, 2023 · 4 comments
Closed

Re-sampling strategy #21

lillythomas opened this issue Nov 3, 2023 · 4 comments
Labels
data-pipeline Pull Requests about the data pipeline
Milestone

Comments

@lillythomas
Copy link
Contributor

Our 3 data products scoped for v0 training (#19, #18, #20) have a median spatial resolution of 20 meters. We'll assume a single resolution model for v0, using 20m resolution to standardize inputs. We'll need to select an appropriate interpolation method for specifically the DEM and S1 inputs.

@weiji14 weiji14 added this to the v0 Release milestone Nov 14, 2023
@weiji14
Copy link
Contributor

weiji14 commented Nov 16, 2023

Just a note that in #27, we've went with resampling to a pixel resolution of 10m for Sentinel-2 and the DEM (Sentinel-1 RTC already has a pixel resolution of 10m, though see #19 (comment)). The resampling is using stackstac.stack's default resampling which is Nearest Neighbour (rasterio.enums.Resampling.nearest).

For Sentinel-2 optical imagery, nearest neighbor resampling is fine, but for the Copernicus DEM, we might want to consider bilinear resampling which compromises between pixel value preservation (nearest neighbor) and smoothing (cubic resampling), see e.g. answers like https://gis.stackexchange.com/questions/102868/best-resampling-method-for-dem-reprojection-in-qgis.

@weiji14
Copy link
Contributor

weiji14 commented Mar 27, 2024

Originally posted by @MaxLenormand in #200

2. Copernicus DEM nearest neighbour resampling (?)

I followed the basic tutorial to get MGRS tiles over Puri India and checked the tiles in QGIS, and noticed the Copernicus DEM, band 13, seems to be interpolated to nearest neighbour, i.e. that pixels are resampled from 30m to identical values of 3x3 pixels of 10x10 meters, with all the same value. Here using QGIS's Value Tool plugin I can see there are 3 pixels, with the DEM raster not changing value on a 3x3 grid

CleanShot 2024-03-27 at 20 19 54

I was wondering if there was a reason for not interpolating using something like a bilinear that might smooth the DEM more? I feel like this might weight the edges of these 3x3 grids more heavily in changes compared to the central pixel, when that's not really how the terrain is? I didn't find the code that resamples all datasets to the 10m, so may have gotten that wrong, this is only based on my visual interpretation in QGIS.

@yellowcap, can you make sure for the v1 data pipeline (#178) that we use bilinear interpolation for Copernicus DEM? We'll need to override stackstac's default Nearest Neighbour interpolation. Thanks!

@yellowcap
Copy link
Member

Thanks for the hint! Definitively something to integrate - and wish we had caught that for v0.2 😄 V1 might not get the DEM anymore at first, but this is good to keep the resampling method at top of mind in the future.

@yellowcap
Copy link
Member

Closing as out of date, feel free to reopen if appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data-pipeline Pull Requests about the data pipeline
Projects
None yet
Development

No branches or pull requests

3 participants