expandLMquery: expand a structured lmQuery list into a Data Frame

Description Usage Arguments Details Value Examples

View source: R/expandLMquery.R

Description

expansion of structures queries into a Data Frame

Usage

1
expandLMquery(lmQuery, climf)

Arguments

lmQuery

LIST, where each element, with free name, represents a subquery

climf

name of netCDF file to which the query is addressed to

Details

Each subquery in lmQuery needs to match fields in a netCDF file, as this function is oriented to finally query netCDF variables at specific locations via ncvar_sample. The example below illustrates the use. The function cycles around each layer and positions to expand the query.

Value

An expanded LIST, where for each subquery, each row represent a specific query

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
lmQuery <- list()
lmQuery$WNA       <- list()
lmQuery$WNA$longname <- "West North Atlantic, South of Greenland, latitude of Newfoundland"
lmQuery$WNA$pos      <- c(323,52) 
lmQuery$WNA$vKIND    <- c('POP2.TEMP','POP2.HMXL')
lmQuery$WNA$z        <- c(5,15)    # [m] first 3 layers in POP
lmQuery$ENA       <- lmQuery$WNA
lmQuery$ENA$longname <- "East North Atlantic, around Faroe Islands"
lmQuery$ENA$pos      <- c(348,61) 

 if (1 > 2) { # example: NOT RUN
   climf <- "b.e12.B1850CN.f45_g37.1850_DAtest.000.001.pop.h.1890-1910-ann.b.nc"
   climf <- file.path(envrun$DOUT_S_ROOT[1],'ocn','post',climf)
   lmQueryDF <- expandLMquery(lmQuery, climf)
 }

garciapintado/rdafCESM documentation built on July 18, 2019, 4:41 p.m.