BUG: returning 0 when predictive distance of last class is the same as class NA
The problem occurs when the last class has 0.5 as predictive distance (same as the "fake class" NA). In this case HaSa seems to return a zero (returns==0) which causes HaSa_API to interpret that there is valid result coming from HaSa. As this is not the case HaSa_API returns a cryptic error saying the "argument is of length zero".
It should be avoided that HaSa returns a zero in that case.
2024-01-23 15:14:14.362959 [INFO] classify: checking input
2024-01-23 15:14:14.363122 [INFO] Seed was set to: 1706019254
2024-01-23 15:14:14.363409 [INFO] runClassification: loading input data
2024-01-23 15:14:14.422804 [INFO] runClassification: call HaSa:sample_nb
[1] "Number of samples = 100 Number of models = 150"
GB
available : 7.15
60% : 4.29
needed : 0.01
allowed : 4.66 (if available)
[1] "It was possible to load the raster stack in_memory."
[1] "loading took 0.050469"
[1] "Matrix conversion took 0.000411"
|======================================================================| 100%[1] "sampling took 27.131906"
[1] "prediction took 0.491540"
[1] "The difference between classes:"
[1] "xeric_grass was 0.5"
[1] "NA was 0.5"
Warning in remove(points) : object 'points' not found
Warning in remove(mod_all) : object 'mod_all' not found
2024-01-23 15:14:42.244241 [INFO] classify: returned Error
2024-01-23 15:14:42.244341 [INFO] Error in if (returns == 0) {: argument is of length zero