r-a-dobson / dynamicSDM

An R package for species geographical distribution and abundance modelling at high spatiotemporal resolution
https://github.com/r-a-dobson/dynamicSDM
4 stars 2 forks source link

error in extract_buffered_coords #16

Open fernandabiologia opened 1 month ago

fernandabiologia commented 1 month ago

Hi Rachel,

I'm trying to extract land cover predictors from the layer in the link below, but I'm getting an error message:

"ERROR in Earth Engine servers: Can't get band number 0. Image has no bands. ERROR :ee_monitoring was forced to stop before getting results"

I also get a warning:

"Warning message: In rgee::ee_as_raster(image = image_collection_reduced, container = "dynamicSDM_download_bucket", : ee_as_raster will be removed in version 1.2.0. Please note that you can use the ee_as_rast instead, which is compatible with terra packages.

https://developers.google.com/earth-engine/datasets/catalog/GOOGLE_DYNAMICWORLD_V1#colab-python

Total available tree cover

extract_buffered_coords(occ.data = breed_dataset, datasetname = "GOOGLE/DYNAMICWORLD/V1", bandname = "trees", spatial.res.metres = 10, GEE.math.fun = "sum", moving.window.matrix = matrix, user.email = user.email, resume = T, save.method = "split", temporal.level = "year", categories = 1, agg.factor = 50, varname = variablenames[11], save.directory = save_directory_breed_resource)

I can send you some data and code if it helps.

Thanks,

Fernanda.

r-a-dobson commented 1 month ago

Hi Fernanda

This is an error that occurs when no data are available on GEE for the date given. Would you be able to send me a small snippet of reproducible code and your occurrence data so that I can see what might be happening?

Best wishes, Rachel

fernandabiologia commented 1 month ago

Hi Rachel,

That's weird because my data is within the window of available data. Anyway, I sent code and data to your email.

Thank you very much,

Fernanda.

fernandabiologia commented 1 month ago

Hi Rachel,

I've been trying to figure out what's going on and it seems the function is not being able to handle the layer "GOOGLE/DYNAMICWORLD/V1". Looking at the layer example (https://developers.google.com/earth-engine/datasets/catalog/GOOGLE_DYNAMICWORLD_V1#code-editor-javascript) it seems the layer needs to be filtered with a start and end date.

My partner (software developer but not in R :) was helping me and he created a copy of the function to pass start and end date, and we got passed the initial error, but got a new error from ee_as_rast:

To avoid memory excess problems, ee_as_rast will not build Raster objects for large images. Error in `map()`:             
ℹ In index: 1.
Caused by error in `.f()`:
! Can't `drive_get()` a file when `id` is `NA`.

I think it might be because the layer resolution is too high (10m). I sent you some data and code and I was wondering if you could have a look at it.

Thanks,

Fernanda.