**Steven Mosher's Blog**, and kindly contributed to R-bloggers)

Replaces 4.0, minor changes made here and there. totally replaces 4.0 as the testing move forward.

Run: DownloadAll.

Run: DataSetUp.

SSTTest reruns the SST analsyis and compares at HADSST2

Land1900Present: reruns the old version of program with a bench against CRU land figures.

Next version will integrate more of raster to the analysis, then we throw out a bunch of old code and use raster for everything.

First raster bit is working

Land<-getMask(file=LandWaterMask_File)

Inv<-getGhcnInventory()

Inv<-as.GriddedInventory(Inv,Land)

Anom<-loadAnomalies(getwd())

Data<-intersect.InvAnomalies(Inv,Anom)

Anom<-Data$Anomalies

Inv<-Data$GridInventory

CellMatrix<-as.GridCells(Anom,Inv)

#####################################################

m<-matrix(nrow=ncell(Land),ncol=ncol(CellMatrix))

b<-brick(Land)

clearValues(b)

m[as.numeric(row.names(CellMatrix)),]<-as.matrix(CellMatrix)

b<-setValues(b,m)

plot(cellStats(b,mean,na.rm=T))

Adding area weighting and land masking

m<-matrix(nrow=ncell(Land),ncol=ncol(CellMatrix))

b<-brick(Land)

clearValues(b)

m[as.numeric(row.names(CellMatrix)),]<-as.matrix(CellMatrix)

b<-setValues(b,m)

Weights <- area(b,na.rm=T,weight=T)

Temps<-Weights*b*Land

monthly<-cellStats(Temps,sum)

**leave a comment**for the author, please follow the link and comment on his blog:

**Steven Mosher's Blog**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...