-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresamplePRISM.R
25 lines (20 loc) · 1.02 KB
/
resamplePRISM.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Resample PRISM to Livneh grid resolution
# MAC 08/09/18
library(raster)
library(zoo)
library(rasterVis)
# set rasteroptions
rasterOptions(progress = 'text')
# map layers
#states <- getData('GADM', country='United States', level=1)
# dates 1895-2017 PRISM data
dates=seq(as.Date("1895-01-01"), as.Date("2017-12-31"), by="month")
# load data
#tmean<-stack("/scratch/crimmins/PRISM/monthly/processed/west/WESTmonthlyPRISM_tmean_1895_2017.grd")
#tmax<-stack("/scratch/crimmins/PRISM/monthly/processed/west/WESTmonthlyPRISM_tmax_1895_2017.grd")
tmin<-stack("/scratch/crimmins/PRISM/monthly/processed/west/WESTmonthlyPRISM_tmin_1895_2017.grd")
#prec<-prec[[which(dates=="1980-01-01"):which(dates=="2017-12-01")]]
# resample to Livneh grid
livneh<-stack("/scratch/crimmins/livneh/processed/WESTmonthlyLivneh_prec_1915_2015.grd")
livnehGrid<-livneh[[1212]]; rm(livneh); gc()
gridResample <- resample(tmin,livnehGrid,method='bilinear', filename="/scratch/crimmins/PRISM/monthly/processed/west/resampled/resampledWESTmonthlyPRISM_tmin_1895_2017.grd")