Skip to content

Commit

Permalink
add n to get flows
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejohnson51 committed Feb 15, 2019
1 parent 95e8c13 commit 4bd0844
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Binary file modified .DS_Store
Binary file not shown.
8 changes: 5 additions & 3 deletions R/getFlows.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@
#' @param name.dir the directory with processed geospatial data
#' @param config the model configureation (default is 'medium_range')
#' @param date the date of interest given as "YYYYMMDD" defaults to current date
#' @param f the number of time period into the future (eg how many flood raster to make)
#' @param t time of forecast
#' @param f hours foward from t
#' @param n if f is null n can be used to limit the number of files returned
#' @return a path to the processed data directory
#' @export
#' @author Mike Johnson

getFlows = function(name.dir, config = 'medium_range', date = NULL, f = 3){
getFlows = function(name.dir, config = 'medium_range', startDate = NULL, t = NULL, f = NULL, n = NULL){

`%+%` = crayon::`%+%`

AOI = sf::read_sf(paste(name.dir, 'geo', 'AOI.shp', sep = "/")) %>% sf::as_Spatial()

f = as.numeric(gsub("f", "", eval(parse(text = paste0("nwm::nwm$", config, "$meta$flist")))))[1:f]

filelist = nwm::getFilelist(config, type = 'channel', date, f = f)
filelist = nwm::getFilelist(config, type = 'channel', startDate, t = t, f = f, n = n)

cat(crayon::white(paste0("Downloading flow data for ", length(filelist), " timesteps\n")))

Expand Down

0 comments on commit 4bd0844

Please sign in to comment.