R: extract latitude from raster -



R: extract latitude from raster -

how extract or subset raster object 1 row of data? have raster of global temperature info , want calculate mean monthly value per year each longitude/column.

library(ncdf4) library(raster) download.file("http://www.cru.uea.ac.uk/cru/data/temperature/crutem.4.3.0.0.anomalies.nc" , destfile="crutem.4.3.0.0.anomalies.nc", mode="wb") cru.tmp <- stack("crutem.4.3.0.0.anomalies.nc") # inspect elements cru.tmp # list years names(cru.tmp) # plot single year plot(cru.tmp$x2008.01.16) # find nrow 67.5deg north mylat <- rowfromy(cru.tmp, 67.5) # extract row cru.tmp.67.5n <- getvaluesblock(test, row=mylat, nrows=1)

so want each of 72 remaining grid cells 12 monthly means.

you can utilize basic indexing single row or column.

library(raster) b <- brick(system.file("external/rlogo.grd", package="raster")) x4 <- b[,4]

r r-raster

Comments

Popular posts from this blog

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -