Deltares / hydromt_sfincs

https://deltares.github.io/hydromt_sfincs
GNU General Public License v3.0
16 stars 13 forks source link

write forcing precision #197

Open guzrf opened 1 month ago

guzrf commented 1 month ago

Kind of request

Changing existing functionality

Enhancement Description

Hi, I just wanted to make a suggestion for a modification to the write_forcing() function in sfincs.py. When saving the hydrograph data in the .bzs file I miss the possibility to specify the precision with which to save the data.

Although it is true that the write_timeseries() function of utils.py can be called separately to specify the precision, it would be nice if the write_forcing() function could handle this option.

Use case

For example, it could be an attribute of the class, so that when calling the SfincsModel.write() function, if the precision for the .bzs file has been previously specified, the file would be saved with the desired precision without the need to add arguments to the functions.

Additional Context

No response

roeldegoede commented 1 month ago

Good suggestion, I guess we can easily add a fmt argument to SfincsModel.write_forcing and parse that fmt argument to the utils.write_timeseries() function.

Am I understanding correctly that you also suggest that we "derive" the format of each forcing condition when reading in the model, to make sure it remains in the same format when writing it again?

guzrf commented 1 month ago

Thank you for taking my suggestion into account. Yes, it would be nice to be able to specify the precision so that it remains when writing it out again.