Questions tagged [rasterstack]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
2answers
59 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 ...
0
votes
0answers
29 views

Cropping and masking rasterstack to a list of shapefiles

I have a raster stack (nlayers = 366, ncells~10 million). I am hoping to crop and mask this raster stack to a data.frame of coordinates for which I have made a series of concentric circle shapefiles ...
0
votes
1answer
49 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("...
0
votes
1answer
14 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 ...
0
votes
0answers
52 views

ERROR creating stack in R

I am cleaning my distribution data for Species Distribution Modelling but I have a problem creating a stack of the variables predictors I have selected for modelling. The environmental predictors ...
0
votes
0answers
18 views

Creating one raster with paletted categories from a raster stack

Basically, I've stacked a few rasters in R, and I want to create a climate classification map. I have a stack of rasters that have temperature and precipitation information. I want to make one raster ...
0
votes
1answer
66 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 ...
1
vote
2answers
37 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 ...
1
vote
1answer
22 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 ...
2
votes
1answer
64 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. ...
0
votes
1answer
148 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 ...
1
vote
1answer
499 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 ...
3
votes
0answers
119 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 ...
0
votes
1answer
152 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 : ...
0
votes
1answer
42 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) ...
0
votes
0answers
78 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 ...
3
votes
1answer
430 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(...
0
votes
0answers
64 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 ...
2
votes
2answers
362 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 ...
1
vote
1answer
549 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 <- ...
0
votes
1answer
166 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 ...
0
votes
1answer
100 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 ...
1
vote
1answer
120 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" &...
1
vote
0answers
48 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 ...
0
votes
1answer
98 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 ...
2
votes
1answer
518 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 ...
0
votes
1answer
331 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 ...
2
votes
1answer
429 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) ...
0
votes
1answer
90 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....
1
vote
1answer
137 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?
-1
votes
1answer
203 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 ...
1
vote
0answers
236 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 ...
1
vote
1answer
1k 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....
0
votes
1answer
468 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 ...
3
votes
1answer
2k 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 ...
2
votes
1answer
1k 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 ...
2
votes
1answer
814 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=...
3
votes
2answers
6k 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) ....
1
vote
3answers
1k 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 ...
1
vote
1answer
913 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. ...
2
votes
1answer
2k 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 ...
0
votes
2answers
705 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 ...
0
votes
1answer
2k 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 ...