Replies: 2 comments 9 replies
-
|
Thank you for your question @AquaPore. Could you try if this works: As a bit of background info: the main difference between the hydromt function and the pyflwdir functions is that pyflwdir uses numpy arrays, and HydroMT wraps the DataArray from xarray around that using the functionality from pyflwdir |
Beta Was this translation helpful? Give feedback.
-
Harmonizing SLOPE with LDDThe question is that we now created a new The question, is there any ways of retrieving the corrected DEM? This can be performed in pyflwdir.dem.fill_depressions but would not correct for the burning of the river? Many thanks for any help you may provide, import geopandas
import os as os
Path_Input_River_Geojson = os.path.join(Input_Root, River_Input)
River_Geopandas = geopandas.read_file(Path_Input_River_Geojson)
River_GeoDataFrame = geopandas.GeoDataFrame(River_Geopandas)
import hydromt
from pyflwdir.core_conversion import d8_to_ldd
import xarray
import numpy as np
def DEM_2_LDD_HYDROMT(
Path_Input,
Path_Output,
Ldd_MaxDepth=Ldd_MaxDepth,
Ldd_RiverDepth=Ldd_RiverDepth,
NoData=NoData,
Outlets="edge",
River=[],
):
# Read elevation data using hydromt which will transform the data into xarray
Dem = hydromt.io.open_raster(Path_Input)
# Deriving the D8 from DEM
Flwdir_D8 = hydromt.flw.d8_from_dem(
da_elv=Dem,
max_depth=Ldd_MaxDepth,
gdf_riv=River,
outlets=Outlets,
idxs_pit=None,
riv_burn_method="fixed",
riv_depth=Ldd_RiverDepth,
)
# Converting D8-> Ldd as required by WFLOW model
Flwdir_Ldd_Pyflwdir = xarray.apply_ufunc(d8_to_ldd, Flwdir_D8.load())
# Save output
Flwdir_Ldd_Pyflwdir.raster.to_raster(Path_Output, nodata=NoData)
return Flwdir_Ldd_Pyflwdir
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Dear Wflow users,
I am trying to use hydromt to process D8 data by using my own DEM data abstracted from rasterio instead of using the one provided by hydromt.
I could off couse use Pyflwdir, but I believe that the advantage of using hydromt.flw.d8_from_dem is that it can use the riv_burn_method for which the pyflwdir.from_dem does not have this functionality.
Below is a code that I am attempting to develop which does not work, and any help to improve it will be welcomed.
Many thanks for any help you may provide,
Joseph
Code that does not works by using hydromt
Code that works but by using pyflwdir.from_dem
Beta Was this translation helpful? Give feedback.
All reactions