e-sensing / sits

Satellite image time series in R
https://e-sensing.github.io/sitsbook/
GNU General Public License v2.0
467 stars 76 forks source link

Error using sits_get_data - extents do not overlap #1076

Closed julioesquerdo closed 6 months ago

julioesquerdo commented 7 months ago

Hello,

I'm not sure if it is a bug, but when using sits_get_data to retrieve data from a MODIS local data cube and a CSV sample file, I'm getting this warning message:

Error: [crop] extents do not overlap

The CSV file is the same provided by sits package (extdata/samples/samples_sinop_crop.csv) and my MODIS images are stored in a local folder covering the State of Mato Grosso. I have 7 bands (NDVI, EVI, BLUE, RED, NIR, MIR and CLOUD) and 920 dates from 2003 and 2022 for each band.

sits_bbox(my_modis_cube) function returns this:

A tibble: 1 × 5 xmin xmax ymin ymax crs

1 -61.7 -50.2 -18.1 -7.33 "GEOGCRS[\"WGS 84\",\n DATUM[\"World Geodetic System 1984\",\n E…

Some additional info: SO Ubuntu 22.04 LTS. R version is 4.1.2 and sits version is 1.4.2-1. Attached file: output from gdalinfo command run using one of my MODIS images as input. gdalinfo.txt

Could you please help me with this? Please let me know if you need further information.

Thanks. Júlio

OldLipe commented 6 months ago

Hi @julioesquerdo, sorry for the long delay.

I tried to reproduce the issue and got an error saying that the cube was not regular. I used the MODIS cube provided by the BDC. I checked that for tile 013009 there is an additional image (2021-09-14), which is not present in the other tiles. I will contact the BDC team to report this missing image in the other tiles.

To extract the time series, I removed this tile and succeeded in extracting it, see the code below:

# Get samples file
csv_file <- system.file("extdata/samples/samples_sinop_crop.csv", package = "sits")

# Create MODIS data cube for Mato Grosso
modis_cube <- sits_cube(
    source = "BDC",
    collection = "MOD13Q1-6",
    roi = c(lon_min = -62.2312,
            lat_min = -18.4496,
            lon_max = -50.1704,
            lat_max = -8.3204),
    start_date = "2003-01-01",
    end_date = "2022-12-31",
    progress = FALSE
)

# Remove 013009 tile
modis_filtered <- dplyr::filter(modis_cube, tile != "013009")

# Extract time series
samples <- sits_get_data(
    modis_filtered,
    samples = csv_file,
    multicores = 8
)
julioesquerdo commented 6 months ago

Hi @OldLipe,

I'm using a local and regular cube built form MODIS TIFF files generated using MRTools package and GDAL library. In order do reproduce this issue, can I share some of my MODIS TIFF images with you?

Thanks

OldLipe commented 6 months ago

Hi @julioesquerdo, sure. Here is my email: lipecaso@gmail.com

OldLipe commented 6 months ago

Hi @julioesquerdo. The issue is fixed in dev branch.