##NOAA - 5 deg cells #readme: ftp://ftp.ncdc.noaa.gov/pub/data/er-ghcn-sst/er-ghcn-sst.readme.txt #http://www.ncdc.noaa.gov/gcag/gcagmerged.jsp #The ERSST version 2 (ERSST.v2) is used for the merged analysis. That SST analysis is monthly on a 2-degree spatial grid, beginning January 1854 and updated monthly using the available in situ data updates. The ERSST.v2 anomalies are averaged to a 5-degree spatial grid to match the grid of the land data. Because of sparse observations before 1880, the ERSST analysis is heavily damped towards climatology in those years. #The merged analysis is not formed before 1880. #NOtes: May 28, 2009: tried to load ftp://ftp.cdc.noaa.gov/Datasets/noaamergedtemp/air.mon.anom.nc # and found that this now ended in Feb 2007, while previously ended in 2009 #ftp://ftp.ncdc.noaa.gov/pub/data/er-ghcn-sst/temp5d6c.v2.adj.1880.last.dat.gz 6/9/2009 #from E to W and N to S #72 longitudes per lat line #2013: ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/blended/ncdc-merged-sfc-mntp.dat.gz make.noaa.trp =function() { instr=get.noaa() #tropics instr=aperm(instr[,15:22,],c(3,1,2)) #the tropics (gridcell centers 17.5S to 17.5N) have j-indices from 15-22 dim0=dim(instr);dim0 #1539 72 8 instr= array(instr,dim=c(dim0[1],72*8)) noaa.trp=ts(apply(instr,1,mean,na.rm=T),start=c(1880,1),freq=12) return(noaa.trp) } get.noaa=function() { require(ncdf) loc="ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/blended/ncdc-merged-sfc-mntp.dat.gz" ### WAS loc="ftp://ftp.cdc.noaa.gov/Datasets/noaamergedtemp/air.mon.anom.merge.nc" ### url="ftp://ftp.cdc.noaa.gov/Datasets/noaamergedtemp/old/unadj/air.mon.anom.nc" #starts 1880 download.file(loc,"d:/temp/temp.dat",mode="wb") handle=gzfile("d:/temp/temp.dat") x=scan(handle); N=length(x) close(handle) x=array(x,dim=c(2594,N/2594) ) start0=1880# x=x[3:2594,] x=array(x,dim=c(72,36,N/2594)); dim(x) #72 36 1608 # 72 36 1561 #this is organized in 72 longitudes from -177.5 to 177.5 and 36 latitudes from +87.5 to -87.5 #lat=53;long=2 #j<- 18 - floor(lat/5 +.001); #i<- 37+ floor(long/5 +.001); #gridcell3<-instr[i,j,] # tsp( ts(1:dim(instr)[3],start=1880,freq=12)) # 1880 2010 12 x[x== -9999]=NA x=x/100 return(x) } make.noaa.trp.old =function() { url="ftp://ftp.ncdc.noaa.gov/pub/data/er-ghcn-sst/temp5d6c.v2.adj.1880.last.dat.gz" download.file(url,"temp.dat",mode="wb") handle=gzfile("temp.dat") x=scan(handle) N=length(x); N # 4028482 item diff( (1:N)[x==1880]) # [1] 2594 2594 2594 2594 2594 2594 2594 2594 2594 2594 2594 N/2594 #1553 x=array(x,dim=c(2594,N/2594) ) noaa=ts( t( x[3:2594,]),start=1880,freq=12) #eliminate month year #start at 1880 1 tsp(noaa) #1880.000 2009.333 12.000 temp= noaa== -999.9 noaa[temp]=NA #image.plot( seq(-177.5,177.5,5),seq(-87.5,87.5,5),array(noaa[1553,],dim=c(72,36))[,36:1] ) #world(add=TRUE) grid.noaa= data.frame(long= rep( seq(-177.5,177.5,5),36),lat= gl(36,72,labels= seq(87.5,-87.5,-5)) ) grid.noaa$lat=as.numeric(as.character(grid.noaa$lat) ) temp= abs(grid.noaa$lat)<20 ;sum(temp) #576 noaa.trp = ts(apply(noaa[,temp],1,mean,na.rm=T),start=c(1880,1),freq=12) return(noaa.trp) } #this is an obsolete source # also ftp://ftp.ncdc.noaa.gov/pub/data/er-ghcn-sst/temp5d6c.v2.adj.1880.last.dat.gz 6/9/2009 #url="ftp://ftp.cdc.noaa.gov/Datasets/noaamergedtemp/air.mon.anom.nc" # l14548 MKB 5/14/2009 # original source: ftp.ncdc.noaa.gov/pub/data/er-ghcn-sst/. #readme!! ftp://ftp.cdc.noaa.gov/Datasets/noaamergedtemp/README #url="ftp://ftp.cdc.noaa.gov/Datasets/noaamergedtemp/air.mon.anom.adj.nc" #starts 1880 to 2008 current #download.file(url,"temp.dat",mode="wb") #v<-open.ncdf("temp.dat") #instr <- get.var.ncdf( v, v$var[[1]]) # 1880 2008 #instr=get.var.ncdf( v, v$var[[2]]) ; #dim(instr) # [1] 72 36 1539 #-177 to 177 #87 to -87 #ts.union(ts(instr[37,8,],start=c(1880,1),freq=12), ts(test[,541],start=c(1880,1),freq=12)) # #instr=aperm(instr[,15:22,],c(3,1,2)) #the tropics (gridcell centers 17.5S to 17.5N) have j-indices from 15-22 #dim0=dim(instr);dim0 #1539 72 8 #instr= array(instr,dim=c(dim0[1],72*8)) #noaa.trp=ts(apply(instr,1,mean,na.rm=T),start=c(1880,1),freq=12) #tsp(noaa.trp) #rm(v);rm(instr) #plot.ts(noaa.trp) #NOtes: May 28, 2009: tried to load ftp://ftp.cdc.noaa.gov/Datasets/noaamergedtemp/air.mon.anom.nc # and found that this now ended in Feb 2007, while previously ended in 2009 # ftp://ftp.cdc.noaa.gov/Datasets/noaamergedtemp/unadj/air.mon.anom.nc dated 5/14/09 # ftp://ftp.cdc.noaa.gov/Datasets/noaamergedtemp/air.mon.anom.nc 15489 KB dated 5/14 # ftp://ftp.cdc.noaa.gov/Datasets/noaamergedtemp/air.mon.anom.adj.nc #save(noaa.trp,file="d:/climate/data/gridcell/noaa.trp.tab") #save(noaa.trp,file="d:/climate/data/gridcell/cru.trp.tab") #save(noaa.trp,file="d:/climate/data/gridcell/giss.trp.tab")