[R-sig-Geo] Subsetting Raster Time Series

Srinivas V srinivasv at feralindia.org
Tue Aug 26 11:55:38 CEST 2014


Hi,

I would like to subset the CRU dataset to a particular time period 
(1980-2013) is there an option to do this within package raster? I can 
manually specifiy the layers to drop, but I would like to drop them 
based on a time period. I'm doing this to ensure two datasets are of the 
same time period.

I would appreciate any advice on dealing with this issue. Thanks!

library(raster)
library(rgdal)
library(ncdf)
library(zoo)

temp<-brick("/media/data/data_cru/tmp/cru_ts3.22.1901.2013.tmp.dat.nc")
temp
temp at z

output
+++++
 > temp
class       : RasterBrick
dimensions  : 360, 720, 259200, 1356  (nrow, ncol, ncell, nlayers)
resolution  : 0.5, 0.5  (x, y)
extent      : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
data source : /media/data/data_cru/tmp/cru_ts3.22.1901.2013.tmp.dat.nc
names       : X1901.01.16, X1901.02.15, X1901.03.16, X1901.04.16, 
X1901.05.16, X1901.06.16, X1901.07.16, X1901.08.16, X1901.09.16, 
X1901.10.16, X1901.11.16, X1901.12.16, X1902.01.16, X1902.02.15, 
X1902.03.16, ...
Date        : 1901-01-16, 2013-12-16 (min, max)
varname     : tmp

 > temp at z
$Date
  [1] "1901-01-16" "1901-02-15" "1901-03-16" "1901-04-16" "1901-05-16" 
"1901-06-16" "1901-07-16" "1901-08-16" "1901-09-16" "1901-10-16"

[1351] "2013-07-16" "2013-08-16" "2013-09-16" "2013-10-16" "2013-11-16" 
"2013-12-16"



-- 

Srinivas Vaidyanathan
Senior Research Fellow
Foundation for Ecological Research, Advocacy & Learning
Web: www.feralindia.org


	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list