r-raster

How to obtain Dates of annual maximum gridcell values of rasterbrick?

房东的猫 提交于 2019-12-02 17:28:13
问题 How can i get two rasters that gives the maximum value for each grid cells per year and also gives the dates on which that maximum value has occured. Below is the reproducible example with some steps i have implemented. library(raster) # Create a raster r1 <- raster(nrow=10, ncol=7) r <- stack(setValues(r1, runif(ncell(r1))), setValues(r1, runif(70 ,0.6,0.9)), setValues(r1, runif(70 ,0.2,0.4)), setValues(r1, runif(70 ,1,2)), setValues(r1, runif(70 ,0.5,1.0)), setValues(r1, runif(70 ,0.3,0.9))

How to obtain Dates of annual maximum gridcell values of rasterbrick?

随声附和 提交于 2019-12-02 11:42:07
How can i get two rasters that gives the maximum value for each grid cells per year and also gives the dates on which that maximum value has occured. Below is the reproducible example with some steps i have implemented. library(raster) # Create a raster r1 <- raster(nrow=10, ncol=7) r <- stack(setValues(r1, runif(ncell(r1))), setValues(r1, runif(70 ,0.6,0.9)), setValues(r1, runif(70 ,0.2,0.4)), setValues(r1, runif(70 ,1,2)), setValues(r1, runif(70 ,0.5,1.0)), setValues(r1, runif(70 ,0.3,0.9)), setValues(r1, runif(70 ,1,2))) r # Make Dates. This is random, i have about 24000 values. Dates<-data

R: how to write a raster to disk without auxiliary file?

家住魔仙堡 提交于 2019-12-01 20:26:17
问题 I'm writing a dataset to file in ERMapper format (.ers) using the Raster package in R, but I'm having issues with the resulting .aux.xml auxiliary file (which I'm actually not interested in). Simple example: rst <- raster(ncols=15000,nrows=10000) rst[] <- 1.234 writeRaster(rst, filename='_test.ers', overwrite=TRUE) The writeRaster() line takes some time to execute, the data file is quite large, about 1.2GB on disk. When checking what's happening while writeRaster() is executed, I find that

R: how to write a raster to disk without auxiliary file?

佐手、 提交于 2019-12-01 20:14:19
I'm writing a dataset to file in ERMapper format (.ers) using the Raster package in R, but I'm having issues with the resulting .aux.xml auxiliary file (which I'm actually not interested in). Simple example: rst <- raster(ncols=15000,nrows=10000) rst[] <- 1.234 writeRaster(rst, filename='_test.ers', overwrite=TRUE) The writeRaster() line takes some time to execute, the data file is quite large, about 1.2GB on disk. When checking what's happening while writeRaster() is executed, I find that the .ers file (header file + associated data file) is typically generated in about 20 sec. Then, it takes

How to extract data from a RasterBrick?

∥☆過路亽.° 提交于 2019-11-29 02:25:56
I have a RasterBrick consisting of monthly rainfall data over 7 years, so it has 7 layers with 12 slots each: rainfall <- brick("Rainfall.tif") > rainfall class : RasterBrick dimensions : 575, 497, 285775, 7 (nrow, ncol, ncell, nlayers) resolution : 463.3127, 463.3127 (x, y) extent : 3763026, 3993292, -402618.8, -136213.9 (xmin, xmax, ymin, ymax) coord. ref. : +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs data source : in memory names : layer.1.1, layer.2.1, layer.1.2, layer.2.2, layer.1, layer.2, layer min values : 239.6526, 499.8343, 521.0316, 617.2896,

How to extract data from a RasterBrick?

試著忘記壹切 提交于 2019-11-27 21:55:14
问题 I have a RasterBrick consisting of monthly rainfall data over 7 years, so it has 7 layers with 12 slots each: rainfall <- brick("Rainfall.tif") > rainfall class : RasterBrick dimensions : 575, 497, 285775, 7 (nrow, ncol, ncell, nlayers) resolution : 463.3127, 463.3127 (x, y) extent : 3763026, 3993292, -402618.8, -136213.9 (xmin, xmax, ymin, ymax) coord. ref. : +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs data source : in memory names : layer.1.1, layer.2.1