View source: R/extract_serie.R
extract_serie | R Documentation |
Read and extract data from a list of wrf output files and a table of lat/lon points based on the distance of the points and the center of model grid points, points outside the domain (and points on domain boundary) are not extracteds.
extract_serie(
filelist,
point,
variable = "o3",
field = "4d",
prefix = "serie",
new = "check",
return.nearest = FALSE,
fast = FALSE,
use_ij = FALSE,
latitude = "XLAT",
longitude = "XLONG",
use_TFLAG = FALSE,
use_datesec = FALSE,
verbose = TRUE
)
filelist |
list of files to be read |
point |
data.frame with lat/lon |
variable |
variable name |
field |
'4d' (defoult), '3d', '2d' or '2dz' see notes |
prefix |
to output file, defolt is serie |
new |
TRUE, FALSE of 'check' see notes |
return.nearest |
return the data.frame of nearest points instead of extract the serie |
fast |
faster calculation of grid distances but less precise |
use_ij |
logical, use i and j from input instead of calculate |
latitude |
name of latitude coordinade variable in the netcdf |
longitude |
name of longitude coordinade variable in the netcdf |
use_TFLAG |
use the variable TFLAG (CMAQ / smoke) instead of Times (WRF) |
use_datesec |
use the variable date and datesec (WACCM / CAM-Chem) instead of Times (WRF) |
verbose |
display additional information |
The field argument '4d' or '2dz' is used to read a 4d/3d variable droping the 3rd dimention (z).
new = TRUE create a new file, new = FALSE append the data in a old file, and new = 'check' check if the file exist and append if the file exist and create if the file doesnt exist
FOR CAMx time-series, use the options: use_TFLAG=T, latitude='latitude', longitude='longitude', new=T
FOR WACCM time-series, use the options: use_datesec=T, latitude='lat', longitude='lon', new=T
cat('Example 1: INMET stations for 2015\n')
stations <- readRDS(paste0(system.file("extdata",package="hackWRF"),"/inmet_2015.Rds"))
cat('Example 2: METAR stations of Brazil\n')
stations <- readRDS(paste0(system.file("extdata",package="hackWRF"),"/metar-br.Rds"))
cat('Example 3: METAR soundings over Brazil\n')
stations <- readRDS(paste0(system.file("extdata",package="hackWRF"),"/soundings.Rds"))
cat('Example 4: Brazilian Air Quality: CETESB (SP), RAMQAr (ES) and SMAC (RJ)\n')
stations <- readRDS(paste0(system.file("extdata",package="hackWRF"),"/stations.Rds"))
cat('Example 5: AIRNET sites\n')
stations <- readRDS(paste0(system.file("extdata",package="hackWRF"),"/aeronet.Rds"))
files <- dir(path = system.file("extdata",package="hackWRF"),
pattern = 'wrf.day',
full.names = TRUE)
dir.create(file.path(tempdir(),"SERIE"))
folder <- file.path(tempdir(),"SERIE")
# extract data for 3 locations
extract_serie(filelist = files, point = stations[1:3,],prefix = paste0(folder,'/serie'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.