Questions tagged [rasterstack]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
18 views

How to add attributes to a raster stack

I have a dataframe ("DataGroup"), which holds tracking data from individual birds. Each bird has a unique id ("ID"), and belongs to one of 10 study groups ("DGroup"). In ...
AMK's user avatar
  • 1
0 votes
0 answers
81 views

Partial correlation of more than two raster stacks

Is there a way to compute partial correlation between three raster stacks? I have 3 rasters namely SIF, SM and VPD. > SIF_stack class : RasterBrick dimensions : 360, 720, 259200, 10 (nrow, ...
Shunrei's user avatar
  • 41
1 vote
0 answers
68 views

SPI function on a dataframe versus on a raster stack?

I have a raster stack representing monthly precipitation values from 2007 to 2016. class : RasterStack dimensions : 360, 720, 259200, 120 (nrow, ncol, ncell, nlayers) resolution : 0.5, 0.5 (x, ...
Shunrei's user avatar
  • 41
1 vote
2 answers
248 views

Writeraster: How to mantain layer names when writing raster data to a file

After I change the extension of my different raster layers in R, I want to save them in the same folder to, later on, binarize them all (with a for in loop I have in my code). Because I want all these ...
Andrea Vidal's user avatar
0 votes
1 answer
141 views

How to create a annual raster stack from MODIS-8 day LST product?

This is a working code for generating a monthly raster stack from the MODIS 8-Day LST product. How to transform this code to create a similar annual raster stack for the same time period. var interval ...
Purnendu's user avatar
0 votes
1 answer
180 views

I am using BFAST to do a time series analysis of LST and I am getting NaN errors

This is the blog post I refer to, https://philippgaertner.github.io/2018/04/bfast-preparation/, and the author's code is as follows: # NDVI data data(tura) selected_pixel <- 90 represents a ...
angrybob's user avatar
0 votes
0 answers
41 views

Error in Rbindlist from a rasterstack and shapefile extraction file

I have multiple rasters files and a grid shapefile. I load the shapefile: grid = st_read('/grid.shp') I load the raster and create a raster stack `path <- "/VI_tif"` #folder where I ...
Shunrei's user avatar
  • 41
0 votes
2 answers
748 views

How to stack list of Xarrays

I have a folder with 4 .tiff (GeoTiff) files. Each of these contains two layers (the spectral band and a mask). I'm able to create a list containig each image using xarray.open_rasterio. Now I need to ...
sermomon's user avatar
  • 1,104
1 vote
1 answer
464 views

Raster Stack with Sentinel-2 data

I need to do a rasterstack of Sentinel-2 data in R. I've done it before with Landsat data by using the library RStoolbox, raster and rgdal. These are the script lines: meta2009<-readMeta(C:/.../MTL....
Paula's user avatar
  • 11
1 vote
2 answers
527 views

Making new categorical raster selected from stack having maximum values for each pixels in R

I have a raster stack having different raster layers with band names (e.g. B1, B2, B3, ….…. Bn). I need to prepare a new categorical raster with band name (for each pixels) having maximum pixel values ...
Shiva Pariyar's user avatar
0 votes
1 answer
324 views

How can I merge the bands for each ID to create two multi-band TIFFs in R?

I have 16 separate raster files, named by ID and band, for 8 bands and 2 IDs. How can I merge the bands for each ID to create two multi-band TIFFs? Here are my data: dput(rastlist) c("...
Nikos's user avatar
  • 934
0 votes
1 answer
23 views

Get extent error in for loop but not individiually

I am masking and cropping a rasterstack to a shapefile I made. I have done this previously with another shapefile, this is no problems. However, when I do this with this specific shapefile I get the ...
johnnyg's user avatar
  • 33
0 votes
1 answer
280 views

Loop Issue: Extracting mean temps for each layer of RasterStack (NetCDF File)

I am running into a little bit of a problem with a RasterStack loop. I am trying to extract the mean temperature for each county in North Carolina for each hour over the last 10 years. I am able to ...
m1994's user avatar
  • 1
1 vote
2 answers
207 views

How to subset temporal range of CRU TS 3.0 rasterstack in R?

I have downloaded open data of CRU TS 3.0 from the website https://data.ceda.ac.uk/badc/cru/data/cru_ts/cru_ts_3.00/data in which cru_ts_3_00.1901.2006.tmp.nc.gz was downloaded. I open this data in R ...
Hallie Sheikh's user avatar
1 vote
1 answer
85 views

What is a "single grid stack", relating to raster data?

I created a boosted regression tree model using data points from a DEM, TPI, and land cover raster. However, I'm having problems finding resources that describe how to fit my trained model over those ...
prime90's user avatar
  • 157
2 votes
1 answer
344 views

Indexing RasterStack in for loop

I am trying to calculate canopy height. I have a RasterStack which has 8 rasters in it. The first 7 are DSM; the 8th is DTM. As you see in the function, I need to subtract every DSM with the same DTM. ...
RS_girl's user avatar
  • 139
0 votes
1 answer
689 views

Finding index of max value in stack of rasters and reordering another raster stack based on index

I have two distinct tasks to complete- find the index of the maximum value in each cell of a stack of 12 rasters. There are 12 rasters because each raster is the mean monthly precipitation over 30 ...
tg110's user avatar
  • 810
0 votes
1 answer
2k views

Convert a large RasterStack to Array in R

I am trying to transform a large RasterStack to an array in order to compute some extraction. The classical approach raster::as.array() is not working since the files are very large and it's taking ...
LFG's user avatar
  • 49
3 votes
0 answers
618 views

Extract values from rasterstack TIFF for point data locations in Python

I am working on machine learning algorithms for predicting wildfire sites on state level. I have a CSV of wildfire instances, that has 37 columns including a geometry column, a lat column and a lon ...
marie Lenihan-Clarke's user avatar
0 votes
1 answer
660 views

Run function over different raster layers depending on the grid cell values

I have a Rasterstack X of 92 layers (all days of June, July, August). Which maps the difference between the maximum temperature on that day and a threshold which I have defined. class : ...
Charlotte's user avatar
0 votes
1 answer
648 views

How to keep same extent for my 10 raster files?

I am not able to keep same extent for my raster files and stack them together. library(raster) # for reproducible example r1 <- raster(xmn=72.23081, xmx=77.79537, ymn=34.26277, ymx=37.35659,res=1) ...
Ali Rawail's user avatar
0 votes
0 answers
145 views

Plotting irregular raster object with tmap

I would like to use tmap R package to plot a RasterStack object. The problem is that the coordinates are not real coordinates, but rather climate variables, so I can not specify a valid reference ...
JerryTheForester's user avatar
3 votes
1 answer
1k views

RasterBrick from large rasterStack takes long to process in R

I have a list of 420 rasterLayer .tif files that I need to create a rasterBrick from. I first create a stack: library(raster) rList <- list.files(pattern = ".tif") rasterStack <- stack(...
Joanne Bentley's user avatar
0 votes
0 answers
283 views

Raster stack different extent for same site?

I have rasters for the same area (same polygon) but I am not sure why they have different extent. I had an supervised classified layer of the initial DEM and secondary variables that do not match the ...
rspatialqs's user avatar
2 votes
2 answers
1k views

Sorting raster stack by dates in R

I need suggestion on how to sort a raster stack by dates. A reproducible example is in the following: library(raster) Create a reproducible rasterstack; set.seed(123) r1 <- raster(nrows = 6, ncols ...
SA Khan's user avatar
  • 197
1 vote
1 answer
725 views

"invalid 'times' value" error in stack function [closed]

I would like to stack multiple GeoTIFF file. My code looks like this: var1 <- list.files(path="D:/#This is the access path", pattern=".tif$", full.names=TRUE) var1 var2 <- ...
Nirevezs's user avatar
0 votes
1 answer
485 views

Calculating monthly averages from daily precipitation data

I have a raster brick for daily precipitation data and I need to convert it to monthly data, how would I go about doing this? Each layer is a day and there are 34698 days (i.e. too many to go through ...
Teya Hutchison's user avatar
0 votes
1 answer
162 views

Why do the results of the diverse test for normal distribution of different temperature raster stacks have the same values (2.2e-16?)

I want to test my dataset for normal distribution. I get the same results with every dataset. What is wrong? why do the results of the diverse test for normal distribution of different temperature ...
catherine 's user avatar
1 vote
1 answer
370 views

Group raster stack layers by year

I have about 468 layers in my raster stack (new layer every 16 days between 2000 and 2020). Is there a way to group the layers by year and instead have just 21 layers? [1] "X2000.02.18" &...
Laura Mills's user avatar
1 vote
0 answers
125 views

Extract paleoclimate variables from wordclim

I1m relative new in to RStudio and I'm trying to download the paleoclimate variables (http://ww.worldclim.com/paleo-climate1) from worldclim, but I can't, the unique solution that I found was to ...
Laura Rosado's user avatar
0 votes
1 answer
333 views

Catching problematic grib2 files using R

I am trying to process a large number of HRRR files, about six months' worth of them, which is close to 4059 files. I am working in R, and this is the function I have, that I am trying to vectorize ...
KVemuri's user avatar
  • 41
2 votes
1 answer
1k views

Colour code points over raster stack in R

I am very new to R and spatial analysis. I have a column with different categories and I want to colour code my points according to category type. I have seen posts on working with continuous or ...
rspatialqs's user avatar
0 votes
1 answer
782 views

RasterLayer vs RasterStack

I have a few hundreds of .tiff files that I converted as a raster stack. However, when I tried reading the file, it is classified as a RasterLayer. I was expecting it to be a RasterStack. The ...
mand3rd's user avatar
  • 161
2 votes
1 answer
855 views

modifiedmk Mann-Kendall Test Over NC /Raster stack

I am working with NetCDF file for analysis of trend. I am using the following codes for analysis of trend.. library(modifiedmk) library(raster) I <- brick("I.nc") d <- stack(I) ...
S.H's user avatar
  • 21
0 votes
1 answer
116 views

Creating CRU CL gridded data using R?

I'm trying to replicate the following example from package getCRUCLdata: # Create a raster stack of temperature from tmp # files in the tempdir() directory. download.file( url = "https://crudata....
perep1972's user avatar
  • 115
1 vote
1 answer
206 views

Calculating skewness and kurtosis with command line GDAL?

I have calculated histogram bins with the -hist option in gdalinfo. Is there an option to calculate skewness and kurtosis, using this or any other GDAL tool?
setophaga's user avatar
  • 209
-1 votes
1 answer
339 views

Converting Kelvin to Fahrenheit in raster stack using R?

I have a raster stack with 372 layers with Kelvin temperature. I want to convert Kelvin to Fahrenheit. I know the function, but do not know how to adjust the code so it can be applied to all layer in ...
lola's user avatar
  • 5
1 vote
0 answers
366 views

Subsetting rasterstack for subtraction between elements using R?

I want ro calculate the differences between rasters within a raster stack with a certain step, and I am unsure how to do so. What I want is to subtract every element from its 5th next one, something ...
foo's user avatar
  • 186
1 vote
1 answer
2k views

Reclassifying rasterstack in R?

I have a very large raster stack of 6253 raster layers and I want to reclassify it. For the reclass, I have tried the following but with no success: my_rules <- c(-0.500, -0.251, 1, -0.251, -0....
foo's user avatar
  • 186
0 votes
1 answer
849 views

Setting pixels of a all raster layers in a raster stack to NA based on the pixel values of corresponding raster layers of another raster stack

I have MODIS NDVI product (MOD13A2) for 10 years in HDF file format. Here i have 230 of such HDFs. For a single HDF, I want to set NDVI pixel values to NA with respect to Quality values in another ...
BetterCallMe's user avatar
5 votes
1 answer
3k views

Add Date to raster layers in raster stack in R

I have a raster stack and I want to add to it a Date field which will include the year-month-day for every rasterlayer. I have my dates in a one column data.frame. I tried to do this with addLayer ...
geo_dd's user avatar
  • 604
2 votes
1 answer
2k views

Layer names changed after reclassification of rasterstack, R

Following one of my previous questions about looping through a rasterstack (here), I now face a different issue. My initial rasterstack had dates as names (e.g. X2000_05_08.1) and I reclassified it in ...
foo's user avatar
  • 186
2 votes
1 answer
1k views

Get wind direction from raster stack U and V in R

I have this NetCDF file (about 130 kb size). I want to get for each day (layer) the wind direction (in meteorological or geographical directions) at every cell. https://drive.google.com/open?id=...
Andrei Niță's user avatar
3 votes
2 answers
8k views

Making stack from many images in Google Earth Engine?

Using the code below, I've computed 20 ndvi images for modis data. How can I stack and save them in a single file? var mod13 = ee.ImageCollection("MODIS/006/MOD13Q1") .filterBounds(geometry) ....
AmirHossein Ahrari's user avatar
1 vote
3 answers
2k views

R: Reclassify a raster stack through the range of the quantiles of each layer. Generic quantiles function ; layer by layer

I have a raster stack that contains terrain bends extracted with different neighborhood windows "crosc_nxn" (e.g. 3x3, 5x5, etc ...). crosc_nxn <- raster::stack(path.files.list) > crosc_nxn ...
viniciovcl's user avatar
1 vote
1 answer
1k views

Calculating Median/Quantile of Rasterstack and converting Results to Data Frame in R

I have a Raster Stack with 32 Raster Layers. What I want to do is to calculate the median for each Raster and also the 0.25 and 0.75 quantiles. Then I want to convert the results into a dataframe. ...
Felix Tischer's user avatar
2 votes
1 answer
3k views

Write RasterLayer by loop preserving the layer names and grouping models

I have a RasterStack object from witch I need to take some layers into a new RasterStack. To to that I've created a loop. My problem in that I am losing my original layers names in the process. As you ...
Milton Alves's user avatar
0 votes
2 answers
1k views

R: Writing individual variables from a RasterStack in loop

I have a RasterStack with 3 layers each one of them containing 19 variables. Using writeRaster I need to save specific variables into my directory while naming the saved files with the actual variable ...
Milton Alves's user avatar
0 votes
1 answer
3k views

Extract values from large rasterstack, R

I have a large rasterstack of about 500 objects. I want to sample easch object with the use of a SpatialPointDataframe and then export the results as file.csv. I have tried the following but within ...
geo_dd's user avatar
  • 604