Closed calvarezgarreton closed 4 years ago
Hi Camila
Thanks for reaching out and taking the time to flag this isue. As you point out, I think that simply including the tz argument in all of the read functions is the best way to achieve this. I am currently undertaking an update of the package on the dev_RC branch, so I will make those changes there in the short term. I will make a note here and close this issue once I do so. I might suggest that you use the dev_RC branch to rebuild the package for usage once I do so, which will hopefully address that (and other) issues.
Thanks again for the feedback, and please open more issues if you find any bugs or have suggestions! I will respond on the Raven forum as well.
Thanks, Rob
Hi Camila, I have added time zone arguments to all of the read functions with the latest push to the dev_RC branch. This branch will replace the master branch by the end of the year. Let me know if you have nay further issues or comments, and thanks for starting this thread!
Hi,
I am having problems with the reading functions and the time zones of the example data from The Nith river model (Raven Tutorial #2). Context: I am in Chile (Sys.timezone() = "America/Santiago").
While the hyd.read allows specifying the time zone of the input data, the forcings.read function does not and thus uses the local time zone. When the local time is different than the time zone of the example data, the conversion with as.POSIXct may generate some NA values at specific dates/hours. forcings.read.R line 11,12: date.time <- as.POSIXct(paste(watersheds$date, watersheds$hour), format = "%Y-%m-%d %H:%M:%S"))
These NA values generate error in forcings.read.R line 46: watersheds <- xts(order.by = date.time, x = watersheds)
The same time zone problem occurs with other read functions (e.g., watershed.read, custom.read) since they don't allow time zone as input argument. I am able to avoid the error by editing the body of the function with trace("forcings.read", edit=TRUE) and manually change the time zone in as.POSIXct arguments, but ideally users should be able to change it from the arguments of the function, just as with hyd.read(ff = NA, tzone = ""). Furthermore, the edits that I can do with trace+edit function are valid only for the current R session, and changes are disregarded for new sessions.
Do you think it would be possible to add the tz argument to the *.read functions? Or do you have any suggestions on how may I permanently avoid this problem ?
Thanks, and congratulations for the great repository and modelling framework. Looking forward to implement the model in Chilean basins. Camila