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
Bugfix #138 in write_forcing #142
Conversation
@Jaapel can you check that this solves your issue ? |
@hboisgon I do not get the datetime error anymore 👍 |
Would be nice to test hydromt_wflow (and hydromt) with cftime data maybe when cmip6 from gcs is implemented. As these two objects are quite different in functionalities I wonder if we maybe should not be more strict in hydromt and maybe always use cftime? @DirkEilander what do you think? |
What are the different methods of the numpy datetime and cftime objects? I'm not sure if forcing all to be cftime will help or create more problems. Perhaps good to raise an issue in the core and investigate the benefits and limitations of both. If can easily accommodate for both that would be my preferred option. |
I agree it's not optimal to change but still maybe worth a discussion in HydroMT so I'll open one there. In the meantime, could you review this PR? |
the workflow does not work for 360 days calendars. Maybe good to further discuss how we want to deal with this. |
Correct bug with forcing with cftime.DatetimeNoLeap
Problem was coming that if forcing timespan was shorter than intented wflow starttime and endtime (old missings flag), we would sel the forcing dataset:
hydromt_wflow/hydromt_wflow/wflow.py
Line 1982 in 04fad11
The bug was here that start and end are pd.datetime and the slice does not work if ds.time is of type cftime.datetime. It can be fixed by converting start and end to strings first with start.strftime(format).
I don't really think we need the slicing though so I deleted it.
What I also found is that the starttime and endtime can have a different timestamp than the forcing (eg 2010-01-01 08:00:00 instead of 2010-01-01 00:00:00) so I added an extra check to correct the starttime and endtime to match better what is inside the forcing file