Description Usage Arguments Details Value Author(s) Examples
View source: R/CF_date_range.R
This function takes units and values to describe a NetCDF time coordinate variable and a start/end year. It returns.
1 | CF_date_range(time_units, time_dim, start, end)
|
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. |
This function is only meant to work for full calendar years.
A named list containing the following variables
't_ind1'Index position for the first value in the start year.
't_ind2'Index position for the last value of the end year.
'time'Values of the time coordinate variable for the requested period.
'origin'The calendar origin for use as the 'origin' input to chron.
David Blodgett dblodgett@usgs.gov
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.