Skip to content

Commit

Permalink
added feature to extract time series from diff model levels
Browse files Browse the repository at this point in the history
  • Loading branch information
Schuch666 committed Feb 20, 2025
1 parent 8e7abd3 commit 1e14f34
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
19 changes: 10 additions & 9 deletions R/extract_serie.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#' @param filelist list of files to be read
#' @param point data.frame with lat/lon
#' @param variable variable name
#' @param field '4d' (defoult), '3d', '2d' or '2dz' see notes
#' @param field '4d' (default), '3d', '2d' or '2dz' see notes
#' @param level model level to be extracted
#' @param prefix to output file, default is serie
#' @param new TRUE, FALSE of 'check' see notes
#' @param return.nearest return the data.frame of nearest points instead of extract the serie
Expand Down Expand Up @@ -57,7 +58,7 @@
#' extract_serie(filelist = files, point = sites[1:3,],prefix = paste0(folder,'/serie'))
#'

extract_serie <- function(filelist, point, variable = 'o3',field = '4d',
extract_serie <- function(filelist, point, variable = 'o3',field = '4d',level = 1,
prefix = 'serie',new = 'check', return.nearest = FALSE,
fast = FALSE, use_ij = FALSE,
latitude = 'XLAT',longitude = 'XLONG',
Expand Down Expand Up @@ -217,14 +218,14 @@ extract_serie <- function(filelist, point, variable = 'o3',field = '4d',
times <- as.POSIXlt(TIME, tz = "UTC", format="%Y-%m-%d_%H:%M:%OS", optional=FALSE)
}

if(field == '2d') # 2d Field (x,y)
contagem = NA # nocov
if(field == '2dz') # 3d Field (x,y,z)
contagem = c(-1,-1,1) # nocov
if(field == '3d') # 3d Field (x,y,t)
contagem = NA # nocov
if(field == '2d') # 2d Field (x,y)
contagem = NA # nocov
if(field == '2dz') # 3d Field (x,y,z)
contagem = c(-1,-1,level) # nocov
if(field == '3d') # 3d Field (x,y,t)
contagem = NA # nocov
if(field == '4d')
contagem = c(-1,-1,1,-1) # 4d Field (x,y,z,t)
contagem = c(-1,-1,1,-level) # 4d Field (x,y,z,t)
var <- ncvar_get(wrf,variable,count = contagem)
nc_close(wrf)

Expand Down
5 changes: 4 additions & 1 deletion man/extract_serie.Rd

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

0 comments on commit 1e14f34

Please sign in to comment.