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

[5pt] Misalignment between the input DEM and inundation predictions #1415

Open
AliForghani-NOAA opened this issue Jan 28, 2025 · 3 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@AliForghani-NOAA
Copy link
Collaborator

AliForghani-NOAA commented Jan 28, 2025

The DEM files are combined into a VRT to include a buffer for each HUC8. However, clipping the VRT to the extent of the buffered HUC8 results in a misaligned DEM. This misalignment propagates into the REM and inundation predictions.

The plot below shows the extent of the original DEM (black boxes) compared to the colormap of the clipped DEM. Additionally, using the GDAL argument -r bilinear causes the clipped DEM values to be inconsistent with the original DEM, further complicating debugging efforts.

Image

The following code can be used to replicate the observations for HUC8 19020302:

gdalwarp -cutline data/inputs/pre_clip_huc8/20241002/19020302/wbd_buffered.gpkg -crop_to_cutline   -ot Float32   -r bilinear  -of "GTiff"  -overwrite 
 -co "BLOCKXSIZE=512"  -co "BLOCKYSIZE=512"  -co "TILED=YES"  -co "COMPRESS=LZW"   -co "BIGTIFF=YES"  -t_srs 'EPSG:3338'  -tr 10 10 data/inputs/dems/3dep_dems/10m_South_Alaska/20240912/FIM_3dep_dem_South_Alaska_10m.vrt  
 outputs/dem_meters_19020302.tif
@RobHanna-NOAA
Copy link
Contributor

Could this be related to our system being in 10m rez? I wondered if this might popup.

Either in pre-clip or before, we need to:

  1. Ensure all incoming data inputs are either 5070 or 3338 (AK) before any pre-clips.
  2. Resolution has to be the same: ie) if we have any 3m DEM's coming in, they need to be adjusted back to 10m before clipping.

Ali: Could this be the case here? I suspected we had a mismatch in AK for the two conditions above.

@AliForghani-NOAA
Copy link
Collaborator Author

Rob, the misalignment only occurs when clipping the VRT (from a 10m DEM) into a 10m clipped buffered DEM. This issue is present for both CONUS and Alaska HUCs. Below is a plot for CONUS HUC8 02050206, where the gray-scale pixels represent the clipped DEM and the red pixel represents the original DEM. I don't see that pre-clipping is contributing to this issue.

Image

@AliForghani-NOAA
Copy link
Collaborator Author

AliForghani-NOAA commented Jan 28, 2025

This issue also happens for DEM difference raster creation. Note that both clipped rasters are misaligned compared with the original raster.

This change is significant for the example shown here . In this case, using the bilinear method would show only the middle cell as non-inundated. However, switching to the near method makes all three bridge cells non-inundated. This occurs because the bilinear interpolation reduces the elevation differences by "smoothing" them, using neighboring non-bridge cells with zero difference values.

Because of this issue, and until we fix the misalignment, I am using -r near argument in clipping the difference rasters.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants