Home > Uncategorized > More Brick tests

More Brick tests

Sorry if this bores you, but I’m testing out new capability in the raster package as it becomes available.

But  we also get some insight into the data.

here we test.  as.logical() when it is applied to a brick. Now I had thought that as logical made a map of true and false. But if your underlying map has temperature and NA, then applying as.logical gets you TRUE and NA. which is very handy.

MASK<-as.logical(SST)
cellCount<-cellStats(MASK,sum)

That counts the cells that report every month.

or I could write cellCount<-cellStats(as.logical(SST),sum)

plot that:

cellCountzoo<-zoo(cellCount,order.by=timeline)

png(“CellCount.png”,width=650,height=380)
plot(cellCountzoo,col=”black”)

Maybe I should do an example of using the layer names to hold the time variable.

timeline<-as.yearmon(1850+seq(0,length=1927)/12)

layerNames(SST)<-as.character(timeline)

layerNames(SST)
[1] “Jan 1850” “Feb 1850” “Mar 1850” “Apr 1850” “May 1850” “Jun 1850” “Jul 1850” “Aug 1850” “Sep 1850” “Oct 1850” “Nov 1850” “Dec 1850”

And I’ve assigned each layer in my brick a name

cellStats(raster(SST,layer=”Jun 1850″),mean)
[1] -0.3817604

enough playing around: the graph

War and SST data collection dont mix

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: