I need to obtain the metrics for a denoised normalized dataset. This is part of the code that I am using:
ctg_denoised <- readLAScatalog("G:/NoBackUp/denoised/")
opt_chunk_buffer(ctg_denoised) <- 10
opt_output_files(ctg_denoised) <- "G:/NoBackUp/metrics/*_metrics"
#METRICS CALCULATION
metrics <- grid_metrics(ctg_denoised, .stdmetrics_z , sqrt(250))
When I apply grid_metrics
to the catalog
of normalized als data it completes the processing but does not manage to merge all the rasters created into a single .vrt
file. The catalog
consists in 1773 files and the result of grid_metrics
is a list of 1773.
The error after running grid metrics
says the following and the warnings are repetitive, the repeat the following warnings (1-13):
CreateProcess' failed to run 'C:\PROGRA~3\ANACON~1\Library\bin\gdalbuildvrt.exe "G:/NoBackUp/grid_metrics.vrt" "G:/NoBackUp/33-1-456-133-76_gf_norm_p95_p95.tif" "G:/NoBackUp/33-1-456-133-77_gf_norm_p95_p95.tif" "G:/NoBackUp/33-1-456-133-79_gf_norm_p95_p95.tif"There were 50 or more warnings (use warnings() to see the first 50)
>Warnings()
1: In min(x, na.rm = TRUE) : no non-missing arguments to min; returning Inf
2: In max(x, na.rm = TRUE) : no non-missing arguments to max; returning -Inf
3: In min(x, na.rm = TRUE) : no non-missing arguments to min; returning Inf
4: In max(x, na.rm = TRUE) : no non-missing arguments to max; returning -Inf
5: In min(x) : no non-missing arguments to min; returning Inf
6: In max(x) : no non-missing arguments to max; returning -Inf
7: In min(x, na.rm = TRUE) : no non-missing arguments to min; returning Inf
8: In max(x, na.rm = TRUE) : no non-missing arguments to max; returning -Inf
9: In min(x, na.rm = TRUE) : no non-missing arguments to min; returning Inf
10: In max(x, na.rm = TRUE) : no non-missing arguments to max; returning -Inf
11: In min(x) : no non-missing arguments to min; returning Inf
12: In max(x) : no non-missing arguments to max; returning -Inf
13: In points2grid(points, tolerance, round) :
grid has empty column/rows in dimension 1
When I run the code with a small dataset the .vrt
file is created so I don´t know if when treating big dataset is there a specific way of doing it.
So far I have tried to apply info from this question but it didn´t work:
library(raster)
r <- stack(metrics[[1]])
for(i in 2:length(metrics)) r <- addLayer(r, metrics[[i]])
class(r)
also I have tried from this question but an error occurred:
metrics_merge <- do.call(raster::merge, metrics)
Error in as.data.frame(x) : argument "x" is missing, with no default
warnings()
like it says in the error message? If it works with a small data set and fails with a big one, where's the point where it fails? Divide your big data into chunks and see where it fails.grid_metrics(ctg_denoised[1:10,], .stdmetrics_z , sqrt(250))
should apply it to the first 10, for example. If that works, then double the "10" until you hit a problem. It could just be one rogue element in your catalog. Hunt it down.catalog
as @spacedman suggested but the building of the.vrt
file was succesful for all subsets, it only fails to create it when is applied for the wholecatalog
. When so, the result in the R environment is alist
of the.tif
files created in theopt_output_files(ctg_denoised)
. I have manage to rungdalbuildvrt
for all the.tif
s as in this question and it works so i don´t understand what is the problem is