Questions tagged [r-stars]

Questions about the stars R package for spatiotemporal arrays.

stars is an R package for spatiotemporal arrays and raster and vector "data cubes".

58 questions
11
votes
2 answers

What should I actually be doing in response to this warning? "Please note that rgdal will be retired by the end of 2023"

I keep noticing this message when I load the rgdal package: "Please note that rgdal will be retired by the end of 2023, plan transition to sf/stars/terra functions using GDAL and PROJ at your earliest convenience." I don't know what this means. Does…
canderson156
  • 1,045
  • 10
  • 24
4
votes
1 answer

stars package: how to define additional dimensions based on an attribute (filename)?

I have a set of raster files (in this case downloaded from http://www.paleoclim.org/) that I am reading into R using the stars package. library("tidyverse") library("fs") library("stars") data_path <- "./paleoclim" (data_files <-…
Joe Roe
  • 626
  • 3
  • 12
3
votes
1 answer

R stars error: dims do not match the length of object when evaluating proxy

I am working on a large dataset from a global climate model that can't fit into RStudio's memory, hence I've chosen to analyze it by loading it as a stars proxy object and evaluating it chunk by chunk. Taking spatial chunks over the full time period…
3
votes
1 answer

Spatial operations with curvilinear data in program stars for R

I'm new to the package stars for R and am trying to do basic spatial operations with curvilinear data. I am using netCDF climate data. I am able to read the netcdf into r along with a shapefile I would like to use to specify the area in which I want…
NorthLattitude
  • 201
  • 1
  • 12
3
votes
1 answer

How can I cast a data frame to a stars object with a time dimension?

Let's say I have a data frame with spatial columns (x,y), a time column (time), and a data column (value). How can I correctly coerce this to a stars object using st_as_stars? df <- expand_grid(time=1:10, x=1:10, …
sawari
  • 33
  • 3
3
votes
1 answer

Create polygon from large raster in R

I have a large raster file (5GB) containing only 1's and NA's. I would like to convert this into a multipolygon of the areas with 1's, with adjacent cells dissolved into one polygon. I have imported the file to R using r =…
2
votes
1 answer

Area of each cell covered by polygons

Is there a way/function to calculate the proportion of each raster cell covered by a polygon? The polygons are usually larger than single cells and the landscape I'm working on is pretty big. I'll like to do it without converting the raster into…
Guillermo.D
  • 399
  • 2
  • 14
2
votes
2 answers

using remote (vsicurl) calculations on sentinel-2 data with the {stars} package?

I'm using rstac to access Sentinel-2 data in a desired bounding box and date range and computing NDVI. This is relatively[*] clean and straight forward for me when using the {terra} package, but I'd like to use the {stars} syntax instead (more on…
cboettig
  • 12,377
  • 13
  • 70
  • 113
2
votes
1 answer

geom_stars fails to plot using curvilineargrid

I am trying to plot a heat map of gridded data on a curvilinear grid. From what I have read the stars package provides this functionality using geom_stars on a stars object created using st_as_stars with a curvilinear option. There is a nice blog…
TheDza
  • 273
  • 3
  • 15
2
votes
1 answer

R stars: st_as_stars/read_stars kills x&y raster values; how to convert to stars?

I have a raster read in & given a CRS with: x <- raster::raster("originalobject") dataCRS <- readRDS(paste0(crsloc, "CRS.Rds")) raster::crs(x) <- dataCRS It has an x extent of roughly -+29000, CRS is AEQD, 3857. Its data plot fine. I want to…
dez93_2000
  • 1,730
  • 2
  • 23
  • 34
2
votes
1 answer

How to read a stars object with over 32768 bands?

I have a very large dataset consisting of one attribute, simulated daily from 1970 to 2100, defined on a rather fine geographic grid. It has been given to me as a netCDF file, which I would like to read and analyze in an R script. The data is too…
2
votes
1 answer

Crop netcdf files in R

I'm trying to crop a netcdf file with a polygon with stars package from daily netcdf data. I think I have managed to do it and could get this plot with this script library(tidyverse) library(sf) library(stars) # Input nc file nc.file <-…
pacomet
  • 5,011
  • 12
  • 59
  • 111
2
votes
1 answer

Output of st_apply needs to be reshuffled

In the example below, I use st_apply() to scan over the space dimension of x and return a vector corresponding to the band dimension, resulting in stars object y. As x and y are in principle identical, subtracting the two should give a stars object…
Mark Payne
  • 557
  • 5
  • 12
2
votes
0 answers

st_contour - mapping should be created with aes

I know the "mapping should be created with aes" bit has been done to death, so I hope this is a sufficiently unusual case, since I've tried to work out why it's happening and come up short. Per this thread, I can plot my stars object in ggplot &…
dez93_2000
  • 1,730
  • 2
  • 23
  • 34
2
votes
1 answer

How can I extract values from one stars object using the extent of another stars object in R?

I am new-ish to using the stars package in R and I am having trouble with figuring out how to create a stars object C that has the values from object A but the extent of object B. Specifically, I have a map of average spring temperatures in Europe…
Ben Lee
  • 35
  • 5
1
2 3 4