MoshTemp 4.1

[This article was first published on Steven Mosher's Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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

see 4.1

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))

bricktest

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)

landBrick2


To leave a comment for the author, please follow the link and comment on their blog: Steven Mosher's Blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)