CF_date_range {climates}R Documentation

NetCDF-CF Date Intersection

Description

This function takes units and values to describe a NetCDF time coordinate variable and a start/end year. It returns.

Usage

CF_date_range(time_units, time_dim, start, end)

Arguments

time_units

A time units string from a netCDF time coordinate variable.

time_dim

The values of a netCDF time coordinate variable.

start

A four digit year to get the starting index for.

end

A four digit year to get the ending index for.

Details

This function is only meant to work for full calendar years.

Value

A named list containing the following variables

  1. 't_ind1'Index position for the first value in the start year.

  2. 't_ind2'Index position for the last value of the end year.

  3. 'time'Values of the time coordinate variable for the requested period.

  4. 'origin'The calendar origin for use as the 'origin' input to chron.

Author(s)

David Blodgett dblodgett@usgs.gov

Examples

## Not run: 
\dontrun{
Using ncdf4 and remote data:

library("ncdf4")
start<-1950
end<-1951
OPeNDAP_URI<-"http://cida.usgs.gov/thredds/dodsC/prism"
ncdf4_handle <- nc_open(OPeNDAP_URI)
time_units<-strsplit(ncdf4_handle$dim$time$units, " ")[[1]]
time_dim<-ncdf4_handle$dim$time$vals
CF_date_range(time_units, time_dim, start, end)

Using sample data:

data(CF_date_range_example, package='climates')
CF_date_range(time_units, time_dim, start, end)
}

## End(Not run)

[Package climates version 0.1-1.6 Index]