mapme-initiative / mapme.vegetation

https://mapme-initiative.github.io/mapme.vegetation/
GNU General Public License v3.0
3 stars 2 forks source link

NDVI Calculation smooth_cube is not running properly #7

Open stpCES opened 1 year ago

stpCES commented 1 year ago

After successfully running index_cube and aquiring ndvi_raw here for 10 days. The smooth_cube function runs into a gdal_cubes error:

after = "2022-09-24" # start date
before = "2022-10-03" # end date
dx = 10 # desired outcome resolution in x direction
dy = 10 # desired outcome resolution in y direction
dt = "P10D" # desired temporal resolution - here 1 month
srs = "EPSG:32638" # desired CRS of the outcome raster - bbox must be specified in that crs
label = "NDVI-" # appended to filename
aggregation = "max" # aggregation method for scene within the same time step
resampling = "cubic" # GDAL resampling method to match the outcome grid size
fill_ndvi = smooth_cube(files = raw_ndvi$files,
+                         bands = raw_ndvi$band_order, 
+                         times = raw_ndvi$time,
+                         dx = dx, 
+                         dy = dy, 
+                         dt = dt, 
+                         srs = srs, 
+                         after = after, 
+                         before = before, 
+                         bbox = bbox, 
+                         aggregation = aggregation, 
+                         resampling = resampling, 
+                         outdir = rundir, 
+                         label = label,
+                         overwrite = TRUE,
+                         chunking = c(1,50,50),
+                         creation_options = list("COMPRESS" = "DEFLATE"))
[==================================================>] 100 %
[ERROR] worker process #0 returned 1
## Size of the cube in x direction does not align with dx, extent will be enlarged by 3.552875 at both sides.
## Size of the cube in y direction does not align with dy, extent will be enlarged by 2.559135 at both sides.
Current cube view is:
A data cube view object

Dimensions:
               low             high count pixel_size
t       2022-09-24       2022-10-03     1       P10D
y 1003861.03099573 1103951.03099573 10009         10
x 472148.818176792 584708.818176792 11256         10

SRS: "EPSG:32638"
Temporal aggregation method: "max"
Spatial resampling method: "cubic"

No smoothing function specified.
Using Linear Interpolation and Savitzkiy-Golay-Filter with standard parameters.
Error in gdalcubes:::gc_exec_worker(j$cube, j$worker_id, j$worker_count,  : 
  c++ exception (unknown reason)
Execution halted
[WORKER #0] [ERROR] Child process failed with exit code 1
[WORKER #0] [ERROR] Child process output: Loading required package: gdalcubes
[WORKER #0] Error in x[(len - n + 1):len] : 
[WORKER #0]   only 0's may be mixed with negative subscripts
[WORKER #0] Calls: write_chunk_from_array ... apply_time.array -> apply -> FUN -> lapply -> FUN -> <Anonymous>
[WORKER #0] Execution halted
Error in gc_write_tif(x, dir, prefix, overviews, COG, creation_options,  : 
  one or more worker processes failed to compute data cube chunks