Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: winfapReader
Type: Package
Title: Interact with Peak Flow Data in the United Kingdom
Version: 0.1-5.1
Version: 0.1-5.2
Authors@R: c(person("Ilaria", "Prosdocimi",
email = "prosdocimi.ilaria@gmail.com",
role = c("aut", "cre"),
Expand All @@ -27,7 +27,7 @@ Suggests:
rmarkdown,
zoo
LazyData: true
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
VignetteBuilder: knitr
Encoding: UTF-8
Language: en-GB
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ importFrom(lubridate,leap_year)
importFrom(lubridate,month)
importFrom(lubridate,year)
importFrom(lubridate,ymd)
importFrom(lubridate,ymd_hms)
importFrom(utils,read.csv)
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# winfapReader 0.1-5.2
- changes in get_amax and get_pot (and in the internal read functions): this was needed to adjust to the changes in what the API outputs now

# winfapReader 0.1-5.1
- changes in known_Oct1 to include new events which occurred on Oct 1st which have been identified in version 12 of the winfap files
- changes in test functions: realized I needed them after the API broke for some days
Expand Down
2 changes: 2 additions & 0 deletions R/dateManupulations.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
#' @importFrom lubridate leap_year
#' @importFrom lubridate dmy
#' @importFrom lubridate ymd
#' @importFrom lubridate ymd_hms
#' @importFrom lubridate date
#' @importFrom lubridate int_overlaps
#' @importFrom lubridate interval
#'
water_year <- function(date, start_month = 10){
# Given a date in ymd lubridate form, returns the WY that date is in.
# The XXXX Water year starts 01st start_month XXXX and ends on the last day of the month before the start_month (XXXX+1)
Expand Down
7 changes: 5 additions & 2 deletions R/readerFuncs.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ read_pot_int <- function(filetext, getAmax){
names(WY_table) <- c("WaterYear","potPercComplete","potThreshold")
tablePOT <- POTtable[seq(match('[POT Values]',POTtable[,1])+1,nrow(POTtable)-1),]
names(tablePOT) <- c("Date","Flow","Stage")
tablePOT$Date <- dmy(tablePOT$Date)
if(grepl("-", tablePOT$Date[1])) tablePOT$Date <- ymd_hms(tablePOT$Date)
else tablePOT$Date <- dmy(tablePOT$Date)
tablePOT$Flow <- as.numeric(tablePOT$Flow)
tablePOT$Stage <- as.numeric(tablePOT$Stage)
tablePOT$Station <- as.numeric(statno)
Expand Down Expand Up @@ -197,7 +198,9 @@ read_amax_int <- function(filetext){
aa <- rr[(which(rr == "[AM Values]")+1):(length(rr)-1)]
out <- cbind(station, utils::read.csv(textConnection(aa),header=FALSE, stringsAsFactors = FALSE))
names(out) <- c("Station","Date","Flow","Stage")
out$Date <- lubridate::dmy(out$Date)
if(grepl("-", out$Date[1])) out$Date <- ymd_hms(out$Date)
else out$Date <- dmy(out$Date)
# out$Date <- lubridate::dmy(out$Date)
out$WaterYear <- water_year(out$Date)
#### Check if any amax should be rejected
rejStart <- grep("[AM Rejected]",rr,fixed = TRUE)
Expand Down
16 changes: 8 additions & 8 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading