All Questions
36 questions
2
votes
3
answers
368
views
R raster stack mathematical conditioning operation
I am new to R and currently I am trying to create a drought frequency map using a stack of VHI rasters but, I still can't figure out a way. My attempt is as follows.
The stack of rasters contains data ...
1
vote
2
answers
578
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 ...
3
votes
0
answers
541
views
Merge single- and multi-band rasters with stars
I can easily use c() to merge two single band rasters or two multi-band rasters using the R package stars, however, when I try merging a single band raster with a multi band raster, I get the error ...
0
votes
1
answer
397
views
Remove the pixel completely in stack if one layer contains NA values in R
I have a raster stack of soil temperatures from the year 2000 to 2020. I have previously cleaned out the individual layers if they exceeded the overall mean +/- 2 std.dev. by
stacked <- stack("...
0
votes
0
answers
674
views
Extracting all levels of a NetCDF file and exporting as multiband raster
I am trying to convert this .nc file with land cover data from ESA CCI (http://maps.elie.ucl.ac.be/CCI/viewer/download.php). There is a separate .nc file for each year, and each file contains the ...
1
vote
1
answer
4k
views
How to calculate mean for multiple raster files and multiple variables using R
I have a folder with multiple raster files (.asc) which contains the biomass of different fish species (e.g., Anglerfish, Bathydemersal etc) for different years (e.g., 00012, 00024, 00036 etc)
I want ...
0
votes
1
answer
257
views
Raster image error when entering stack layers using Rstudio
I am a beginning user of Rstudio, and
I want to run Random Forest by using a couple of "raster layers" which were stacked in ENVI.
Before doing stacking I checked the cell size and the ...
4
votes
1
answer
6k
views
Calculation of mean and standard deviation of raster images in R
I have a set of raster images (GeoTIFF, Landsat 1984-2018) which I cropped with my AOI using a shapefile.
Now I want to stack them and calculate the mean and standard deviation of every pixel of the ...
0
votes
1
answer
917
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 ...
5
votes
1
answer
2k
views
stars package in R. How to add time dimension in a stars object?
I have a raster stack (my_stack) and I converted it into a stars object:
mystar <- st_as_stars(my_stack)
That results in:
stars object with 3 dimensions and 1 attribute
attribute(s), summary of ...
0
votes
1
answer
682
views
Subset raster stack in R by a vector of number sequences?
I have a large raster stack that I need to subset by somewhat irregular time spans. I'd like to do something like this:
rstack[[c(1:3, 4:8, 9:15)]]
But there are 30 sequences like the ones above ...
1
vote
1
answer
915
views
Determining which layer in raster stack is first to meet condition using R?
I want to analyze a raster stack and determine the first layer in the stack that meets a condition for every pixel.
Here's a reproducible code example generating rasters and making a stack.
# ...
2
votes
1
answer
407
views
Biweekly time series for raster stack in r
I have a netcdf file with daily data and I calculate for each week some statistics, using the "apply.weekly" command in the "xts" library. However, I would like to calculate bi-weekly statistics, ...
1
vote
2
answers
3k
views
Looping a raster stack with a step, R
I have a large raster stack of about 500 rasterlayers.
What I want to do is to extract specific layers and store them in a different strack.
The layers for which I am interested in, have a step of 8 ...
0
votes
2
answers
351
views
Why does the Extent of NIR Band 8 Landsat image not match other bands, even when cropping to a specified extent?
I'm trying to load and then stack four bands 2,3,4 and 8 RGB and NIR from Landsat images. I have downloaded and extracted them and they are in .tif format.
# loading the bands
B2 <- raster("./...
0
votes
2
answers
1k
views
Raster operations in a raster list in R
I have a raster list (21 in total) S1 that have the same projection, resolution but not exactly the same extent.
Due to this difference, I cannot stack them without solving the extent/dimensions ...
4
votes
1
answer
9k
views
Import multi-band TIFF in R
I am trying to import a TIFF file that contains 2 bands. When using the following code in R, it seems only the first band is being recognised.
S1<-"my/path/"
S1<-list.files(S1, full.names = ...
1
vote
0
answers
209
views
How to save statistical parameters of a raster stack in a csv using R
I have a reference raster and a stack of other rasters. I wanted to perform Mean, Std Dev and Bias of the reference with respect to the remaining. So I calculated the Cell Stats of all but when I try ...
3
votes
1
answer
3k
views
Raster calculation loop - R
I have a raster stack of 108 elements
The stack 'images' is created using 4 bands (RGB+NIR) of 27 satellite images. The sequence of the rasters in the stack is:
Position [[1]]: blue band image 1
...
8
votes
3
answers
14k
views
Stack rasters with different origin, dimensions and resolution in R
I have three raster files with the same extent and CRS, but with different origin, dimensions and resolution.
r1
class : RasterLayer
dimensions : 3020, 3043, 9189860 (nrow, ncol, ncell)
...
4
votes
1
answer
1k
views
How to create raster stack from names on R
I have a dataframe containing the best predictors by their contribution to a model:
bestpredictors
var contrib
2 Pfallwinter 8.1141
15 Tofall 58.0000
23 ai 5.3573
26 ...
6
votes
2
answers
8k
views
Mean by month on R stacked raster
I work with MODIS NDVI rasters in 2016. I have 23 rasters stacked in one object. I have 2 raster by month. I would like the average by months and conserve a raster for each month.
ndvi.stack <- ...
1
vote
1
answer
3k
views
R Stack. Extent and CRS
I'm new on R.
I was listing .tif files from a folder to R. My final product is going to be a value mean of all the files in only one image. So I start stacking all of them, then brick the stack, and ...
6
votes
2
answers
15k
views
Handling multiple-extent-problem to create raster stack in R?
I am storing ~ 30 raster files in a folder and want to create a raster stack. I know that not all of these rasters have completely the same extent. They do have the same resolution and CRS.
Thus I ...
5
votes
1
answer
2k
views
R package gapfill: How to convert R raster stack to 4-dimensional array and then back to raster stack?
I'm currently analyzing MODIS EVI time series (MOD13Q1) for a small region between 2000 and 2015. Now, I would like to fill missing values using the new R package gapfill.
What I have done so far:
...
0
votes
1
answer
88
views
Receiving higher values than should be possible in stackApply SUM for Frequency calculation in R
I am currently working on creating a frequency raster for a country based on multiple Rasters of the same day through following years and where the previous values are reclassified to 1's and 0's. The ...
3
votes
2
answers
7k
views
How to remove the Na values from a stack of rasters?
In R I have a stack (nsw.stack) which contains 6 variables. I have clipped the extent. However, When I look at the summary it appears that there is a lot of NA values (see below). I think this is ...
1
vote
0
answers
280
views
Raster package limitations
I am very new to R and to raster package and I was hoping that someone could provide some guidance. I am trying to run a function that averages a series of rasters, 300 to be exact, they are in geotif ...
1
vote
1
answer
228
views
Matching Decedal Average NDVI and Worldclim Data
Ive never used NDVI (or EVI) datasets in R. Does anyone have any resource I could use to access a decadal average NDVI dataset for the globe. It would be preferable if this dataset was also comparable ...
3
votes
2
answers
5k
views
Extract raster layer data by attributes in RasterStacks R
I have a RasterStack with 2 raster layers of the same area, one from a SpatialPolygonsDataFrame (layer1) and another NDVI satellite image (NDVI). layer1 has a series of polygons, each with various ...
2
votes
1
answer
5k
views
Extracting values from raster stack and aggregating results using R
I'd like to extract values from a rasterstack, cell by cell, and create a list of the values:
ext <- extent(0,100,0,100)
r1 <- raster(nrows=100, ncols=100,ext)
r1[] <- sample(seq(from = 1, ...
1
vote
1
answer
5k
views
stack rasters with different extent and resolution in a loop with R package raster
I would like to stack rasters with the R package "raster". Layers are in ascii format. I want to crop them to have the same extent and project them to have the same resolution. My code gives raster ...
4
votes
1
answer
896
views
Where are the "band names" of an ENVI file once it is imported in R?
I have a .dat file (ENVI format) with specific band names, as you can see in the snapshot.
I've imported this file in R, but I cannot find the band names in the R object.
The command
names(...
3
votes
0
answers
667
views
R raster stack 4 dimensions
I am trying to create a raster stack / brick from a list of ncdf files with the dimensions 160x160x24x1).
r = stack(files)
This gives me a raster stack but without the 4th dimensions which is ...
3
votes
0
answers
781
views
How to calculate 90% confidence interval in a raster stack
I have a stack of grid files (23) in ASC format from a MODIS sensor and I need to calculate a 90% confidence interval, mean, min, etc, for each one in R, how can I do that? specially the interval.
#...
0
votes
2
answers
3k
views
R -plot 12 images per plot or save 12 images per image file in R
Here is R script and my question is
How can I plot 12 images per plot or save 12 images per image file because I have total 864 images.
RAD1998 <- raster(paste(getwd(), "/1998bil /...