Open jacobdale211 opened 2 years ago
I also tried loading dat
with proxy = FALSE
, but received a memory exhausted error.
Morning @jacobdale211 !
So the last message first. You a receiving a memory exhausted error because these are large rasters and you are attempting to import all of it's associated data in R. A proxy circumvents that by loading only what it needs.
For the crop error, I am less clear as to why you are getting it without being able to run code on my side. Without a reproducible example, it's hard to troubleshoot on my side. I can tell you that I can crop stars_proxy
objects on my side, so it might be a problem of conversion between rasters and stars objects or functions. Earlier in the code, you are transforming the rasters contained in the list dat
as Rasters
objects. Also, you are using the crop
function, which is a rasters
package function, not a stars
package function. The function for stars
objects is st_crop
from the sf
package.
I would therefore start by checking the type of objects you are working with when you get an error message, and double check that you are using the functions from the proper packages. In that sense, I would strongly recommend that you use namespaces (package::function) when calling your functions when you are playing around with stars, sf and raster at the same time. For example, for cropping your stars object, write sf::st_crop
rather than st_crop
(or crop
as you did here).
Let me know if this helps!
Yup, this fixed that error message, thanks!
Last week, I was able to create a cumulative plot using two of the eight 2008 drivers (
inorganic
andinvasives
), as they both had the same size in order to create a summed plot.However, I am struggling with cropping the extent of the rasters to all fit each other in order to create a final, cumulative plot. This is the error I am seeming to get:
Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘crop’ for signature ‘"stars_proxy"'
I'm not sure if there is a way to transformstars_proxy
objects once they've already been loaded into a list (dat
)?Additionally, after clearing my environment, the code I ran to create the cumulative plot of
inorganic
andinvasives
no longer seems to work.From lines 87 to 99 I've tried a few different methods to address these issues. Let me know if you see any issues that might be preventing it from working.