e-sensing / sits

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

Cube regularization #1235

Closed Chafika24 closed 3 days ago

Chafika24 commented 1 week ago

I'm new to using the sits package and was wondering why I am receiving this warning. Does the warning still pop up even after storing the cube in the local directory? Additionally, I noticed that it takes several hours to regularize the data cube. Do you have any suggestions for improving the processing time? Thank you!

Area of interest

roi <- c(

  • lon_min = 29.54431, lat_min = -22.97027,
  • lon_max = 29.64084, lat_max = -22.90461)

Create a data cube

new_s2_cube <- sits_cube(

  • source = "AWS",
  • collection = "SENTINEL-2-L2A",
  • roi = roi,
  • start_date = as.Date("2023-01-01"),
  • end_date = as.Date("2023-12-31")
  • ) |======================================================================| 100%

Regularize the cube to 1 month intervals

local_cube <- sits_cube_copy(cube = new_s2_cube, output_dir = "SITS") |======================================================================| 100%

reg_cube <- sits_regularize(

  • cube = new_s2_cube,
  • output_dir = "SITS",
  • res = 10,
  • period = "P1M",
  • multicores = 8
  • ) Warning: regularization is faster when data is stored locally use 'sits_cube_copy()' to copy data locally before regularization |===================== | 31%
gilbertocamara commented 1 week ago

Dear @Chafika24, regularisation is required to use ML models on data cubes. The function is I/O bound, meaning it spends most of its time reading image blocks from disk, while the computation is straightforward. The function will do lots of reading from the cloud repository when the data is being regularised. That is why it is slow. To speed up your work, we recommend making a local temporary cube of the ARD data, which you will transform into a regular data cube. Thus, the message is intended as a reminder on how to speed up your work.