NCEP.restrict: Temporally Filters Weather Data

Description Usage Arguments Details Value Author(s) References Examples

View source: R/NCEP.restrict.R

Description

This function removes unwanted datetime intervals (i.e. layers) of weather data from the NCEP/NCAR Reanalysis or NCEP/DOE Reanalysis II data array as returned by NCEP.gather. The spatial structure of the data is retained.

Usage

1
2
3
NCEP.restrict(wx.data, years2remove = NULL, months2remove = NULL,
    days2remove = NULL, hours2remove = NULL, other2remove = NULL,
    set2na = TRUE)

Arguments

wx.data

A 3-D weather dataset as returned by NCEP.gather

years2remove

Numeric. Specifies which years should be removed from the dataset.

months2remove

Numeric. Specifies which months should be removed from the dataset.

days2remove

Numeric. Specifies which days of the month should be removed from the dataset.

hours2remove

Numeric. Specifies which hours of the day should be removed from the dataset.

other2remove

Character. Specifies any specific combinations of year, month, day, and hour to remove from the dataset.

set2na

Logical. Should the data matching the year, month, day, or hour specified in the function call be set to NA (default) or should they be removed completely from the dataset.

Details

other2remove is for specific combinations of year, month, day, and hour and must be given in the format "%Y-%m-%d %H". If NCEP.aggregate has been applied, some datetime components will need to be replaced with "XX" or "XXXX" when specifying other2remove. Use dimnames to determine how to specify an aggregated datetime.

If set2na is anything other than TRUE or FALSE, the function replaces items to be removed with the value of set2na.

Value

This function returns a three dimensional array (or a 2-D matrix if all but a single timestep is removed) of weather data. The three dimensions are latitude, longitude, and datetime reflected in the dimnames of the output array.

Author(s)

Michael U. Kemp mukemp+RNCEP@gmail.com

References

Kemp, M. U., van Loon, E. E., Shamoun-Baranes, J., and Bouten, W. 2011. RNCEP:global weather and climate data at your fingertips. – Methods in Ecology and Evolution. DOI:10.1111/j.2041-210X.2011.00138.x.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
library(RNCEP)
## First query the U component of the wind from the 850mb
## pressure level
uwnd <- NCEP.gather(variable='uwnd', level=850,
    months.minmax=c(5,7), years.minmax=c(2000,2001),
    lat.southnorth=c(50,55), lon.westeast=c(0,5))

## Then remove all observations except those made at midnight from
## the first half of either May or July
uwnd.r <- NCEP.restrict(wx.data=uwnd, hours2remove=c(6,12,18),
    days2remove=seq(17,31), months2remove=6, set2na=FALSE)

## Then remove the observation from 1 May 2000 at midnight ##
uwnd.r2 <- NCEP.restrict(wx.data=uwnd.r,
    other2remove="2000-05-01 00", set2na=FALSE)

## End(Not run)

RNCEP documentation built on July 1, 2020, 7:10 p.m.