Learn R Programming

eva3dm (version 0.99.1)

extract_serie: Extract time series of wrf file list of lat/lon

Description

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 extracted.

Usage

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,
  id = "id",
  verbose = TRUE
)

Value

No return value

Arguments

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, default 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 coordinate variable in the netcdf

longitude

name of longitude coordinate 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)

id

name of the column with station names, if point is a SpatVector (points) from terra package

verbose

display additional information

Examples

Run this code
cat('Example 1: METAR site list\n')
sites <- readRDS(paste0(system.file("extdata",package="eva3dm"),"/sites_METAR.Rds"))

cat('Example 2: AERONET site list\n')
sites <- readRDS(paste0(system.file("extdata",package="eva3dm"),"/sites_AERONET.Rds"))

cat('Example 3: list of INMET stations on Brazil\n')
sites <- readRDS(paste0(system.file("extdata",package="eva3dm"),"/sites_INMET.Rds"))

cat('Example 4: list of Air Quality stations on Brazil\n')
sites <- readRDS(paste0(system.file("extdata",package="eva3dm"),"/sites_AQ_BR.Rds"))

files    <- dir(path = system.file("extdata",package="eva3dm"),
                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 = sites[1:3,],prefix = paste0(folder,'/serie'))

Run the code above in your browser using DataLab