openearth / hydro-engine

Hydro Engine is a service and a command-line tool to query static and dynamic hydrographic data derived from Earth Observations
MIT License
30 stars 9 forks source link

Resampling defaults different for different variables #19

Open MaartenSmoorenburg opened 6 years ago

MaartenSmoorenburg commented 6 years ago

When using get raster to download, some default resampling method is used to derive the target resolution and project. The preferred method might be different for different variables. It would be useful to set the defaults resampling methods (and document why they are chosen for this or that variable).

gena commented 6 years ago

Currently, the nearest neighbor is used by default for all raster variables. It makes sense to allow specifying resampling, e.g., 'bilinear' or 'bicubic' for continuous variables, or indeed set defaults per variable and document it.

MaartenSmoorenburg commented 6 years ago

it is not only about continuous or not continuous I am afraid. For DEM's I have come across various discussions. DEM are very important for Wflow, and we often have issues with funny catchment borders or stream locations in the downsamples DEM's with the D8 slope calculations. I don't think that we can easily decide on the most useful downsampling method (problably something cubic), but today I realized that the best practice might even depend on the thing that we want the low resolution DEM for. For example, for catchment boundaries, the focal MAX might be useful, whereas for the river network a focal MIN might be more insightful. The resulting maps could then be burned in to a 'most accurate' downsampled DEM. Just thinking.... Anyways, downloading MAX and MIN elevations per pixel can be useful for scaling subgrid processes so probably it is good to add these as default parameters?

gena commented 6 years ago

I can add this for now:

--resample nearest | bilinear | bicubic 
--scale-reducer MIN | MAX | MEAN | MODE

Resampling can be then used for some continuous rasters, while scale-reducer can be used to upsample. Maybe also PERCENTILE should be added, but that may require an additional argument.

River burning and some other specific algorithms can be added, but we may need to discuss first how to do it properly, how to provide to users, keeping arguments simple. Additional corrections to be considered are: non-linear smoothing (low-pass), fusing with OSM (https://github.com/openearth/parterra).