ESA Landcover returns 0-length tibble
Closed this issue · 5 comments
Continuing from the discussion in #211. This snippet produces a 0-length tibble for ESA landcover.
poly <- data.frame (
id = 1,
geom = "POLYGON ((46.303 38.9943, 46.3032 38.9942, 46.3035 38.9941, 46.3037 38.994, 46.304 38.9939, 46.3037 38.9941, 46.3032 38.9943, 46.303 38.9943))"
)
poly <- st_as_sf(poly, wkt = "geom", crs = 4326)
poly <- st_make_valid(poly)
pf_esa_lc <- poly %>%
init_portfolio(
2000:2023,
verbose = TRUE) %>%
get_resources("esalandcover")
dat_esa_lc <- calc_indicators(pf_esa_lc, c("landcover"))
I suspect the reason for that polygon to fail to be related to #208. Once we merge #212, a valid value should be returned. I have not merge it yet because it introduces slight changes to the numerical results for a number of indicators. We should discuss if it is ok to merge. Meanwhile, I'll improve the error handling for 0-tibble results. I would argue that the package should throw a warnig but return NA instead.
Hi, could you please check with remotes::install_github("mapme-initiative/mapme.biodiversity", ref = "improve-output-checks")
?
@goergen95 I just tried it, but I'm still getting the error.
You should get a warning instead of an error and an object is actually returned where the value is set to NA. If you now process a larger portfolio, the process no longer fails, but informs you which assets returned 0-length-tibbles and places NAs there. You see that too?
@goergen95 I must have been mistaken yesterday or made some mistake when testing your fix.
I'm now getting the warning and NA
result as expected, thanks! :)