Project

General

Profile

Download (1.37 KB) Statistics
| Branch: | Revision:
1 53eb9ee3 Adam M. Wilson @ pfe
library(sp)
2
library(foreign)
3
library(reshape)
4
library(latticeExtra)
5
6
path = "/nobackupp4/aguzman4/climateLayers/output/"
7
tilelist = list.files(path,pattern="^[0-9]")
8
9
rm(dlst)
10
dlst.full=c()
11
for (t in tilelist){
12
13
  # t="30.0_-105.0"
14
15
  dbf = read.dbf (paste(path,t,"/monthly_covariates_ghcn_data_TMAX_2001_2011",t,".dbf",sep=""))
16
17
  dlst=melt(dbf,id.vars=c("station","month","TMax"),measure.vars=paste("mm",sprintf("%02d",1:12),sep="_"))
18
  dlst1=melt(dbf,id.vars=c("station","month","TMax"),measure.vars=paste("mm",sprintf("%02d",c(2:12,1)),sep="_"))
19
  dlst2=melt(dbf,id.vars=c("station","month","TMax"),measure.vars=paste("mm",sprintf("%02d",c(12,1:11)),sep="_"))
20
21
  dlst.m = cbind(dlst,dlst1,dlst2)
22
  dlst.m$lstm=as.numeric(gsub("mm_","",dlst.m$variable))
23
24
  dlst.m.sel=dlst.m[,c(1,2,3,5,10,15,16)]
25
26
  dlst.all=dlst.m.sel[dlst.m.sel$month==dlst.m.sel$lstm,c("station","month","TMax","value","value.1","value.2")]
27
28
  colnames(dlst.all)[colnames(dlst.all)=="value"]="lst"
29
  colnames(dlst.all)[colnames(dlst.all)=="value.1"]="lstp1"  # LST plus 1 month
30
  colnames(dlst.all)[colnames(dlst.all)=="value.2"]="lstm1"  # LST less 1 month
31
32
  dlst.all$tile=t
33
  dlst.full = rbind(dlst.all,dlst.full)
34
35
}
36
37
write.csv(dlst.full,file="/nobackup/awilso10/interp/lst_tmax.csv")
38
39
## copy to acrobates
40
system("scp /nobackup/awilso10/interp/lst_tmax.csv adamw@acrobates.eeb.yale.edu:/data/personal/adamw/projects/")
41