Deltares / hydromt

HydroMT: Automated and reproducible model building and analysis
https://deltares.github.io/hydromt/
MIT License
74 stars 30 forks source link

Allow passing override parameters in hydromt.raster.full_like #519

Open jensdebruijn opened 1 year ago

jensdebruijn commented 1 year ago

Kind of request

Changing existing functionality

Enhancement Description

It would be great if in hydromt.raster.full_like you can pass alternative parameters, similar to np.full_like: https://numpy.org/doc/stable/reference/generated/numpy.full_like.html

Use case

Freqently, I want to make a new hydromt raster similar to another, but with for example another data type. I am now doing this using hydromt.raster.full, but it would be more efficient and clean when I could use hydromt.raster.full_like.

> old.dtype
np.float32
> new = hydromt.raster.full_like(old, dtype=np.int32)
> new.dtype
np.int32

Additional Context

No response

DirkEilander commented 1 year ago

Thanks for the suggestion @jensdebruijn! This is very well doable I think. Feel free to open a PR for this yourself. Otherwise we are also happy to pick this up ourselves, but likely not before the end of the year.

I suggest to improve the raster.full_like method with two new arguments