USGS-R / lakeReport

Scripts and report generator
Other
0 stars 4 forks source link

Need to overwrite dates for depth profiles #89

Closed sbmarsh-USGS closed 6 years ago

sbmarsh-USGS commented 6 years ago

For WY 2016, several lake samplings were done in the fall on Oct. 3 and 4, 2016. Since the water year ends on Sept. 30, I need to overwrite the wy function to be able to grab those data.

lindsayplatt commented 6 years ago

Is this just for specific sites or do you want them all to consider Oct 4 the end of the WY? If it is for all of them, it should be a simple adjustment to this line https://github.com/USGS-R/lakeReport/blob/master/R/workflow-functions.R#L96

sbmarsh-USGS commented 6 years ago

It's for 6 lakes for a total of 12 station numbers for depthprofiles and qwtimeseries.

lindsayplatt commented 6 years ago

And this is also only for WY 2016?


Ok, my suggestion would be to follow the example of getGageHeightFilePath, and add a column that indicates how the end of the WY should be interpreted.

https://github.com/USGS-R/lakeReport/blob/master/R/workflow-functions.R#L100-L109

Then, you can add a siteNumber argument to the convertWYtoDate function and use an if/else statement to determine if that site should get a different ending date.

To get started, edit the plotNames_by_site.csv. Then, you can start working on having convertWYtoDate read that file and use the appropriate column and matching siteNumber. Then finally, you can use an if statement to change whether the end is "-09-30" or something else.

sbmarsh-USGS commented 6 years ago

I tried the simple adjust to the one line of code, and somehow got it to work a couple of times and then I got this error message: Error in curl::curl_fetch_memory(url, handle = handle): Operation was aborted by an application callback Request failed [ERROR]. Retrying in 1.5 seconds...

lindsayplatt commented 6 years ago

Hmm could you post your changed code?

sbmarsh-USGS commented 6 years ago

Lines 94-96 in workflow-functions.R I actually only changed the date in line 95 from -09-30 to -10-04

convertWYtoDate <- function(wy){ s <- as.POSIXct(paste0(wy-1, "-10-01"), tz = "UTC") e <- as.POSIXct(paste0(wy, "-10-04"), tz = "UTC")

sbmarsh-USGS commented 6 years ago

Now when I try and run it, I don't even get an error message. It just gets stuck part way through. Time to reinstall RStudio and Git?

sbmarsh-USGS commented 6 years ago

So, it worked for a few plots and started giving me the following error: Quitting from lines 83-140 (depthprofiles.Rmd) Error in seq.default(from = xranges$wt_low, to = xranges$wt_high, by = 10) : 'from' must be of length 1

sbmarsh-USGS commented 6 years ago

Issues listed above were connection issues not code issues. All have been resolved. Easiest fix for this issue is to change the dates (temporarily) in workflow-functions.R, lines 95 or 96 as needed and run individual plots.