rchlumsk / RavenR

R package for handling Raven hydrologic modelling framework inputs, outputs, and diagnostics
36 stars 16 forks source link

Incorrect state date written by rvn_rvt_write #100

Closed nickyrong closed 2 years ago

nickyrong commented 2 years ago

I have a xts time series (SCK_flow) for observed flow. First time stamp = 2014-09-05.

After I write the rvt file with rvn_rvt_write() function, the initial time was output incorrectly:

rvn_rvt_write(x = SCK_flow, rvt_type = "ObservationData", data_type = "HYDROGRAPH", basin_ID = 1, filename = "../2_Input_files/SCK_ObservedFlows.rvt")

And this is what's in the .rvt file, the month is wrong

:ObservationData HYDROGRAPH 1 m3/s 2014-00-05 00:00:00 1 1510 0.567142 0.563274

rchlumsk commented 2 years ago

Hi Nick

Thanks for finding this bug and reporting it. The culprit was a %M instead of %m in a line that reformats the date time, resulting in the hour being written in instead of the month. This is now fixed in the last push to the dev branch.

Thanks again, Rob