mapme-initiative / mapme.biodiversity

Efficient analysis of spatial biodiversity datasets for global portfolios
https://mapme-initiative.github.io/mapme.biodiversity/
GNU General Public License v3.0
24 stars 7 forks source link

fix reading raster tiles with temporal dimensions #211

Closed goergen95 closed 7 months ago

goergen95 commented 7 months ago

Hi, I this fixes the issue, I think. Would you mind to check? I also tried to make the code more understandable. Maybe let's have a discussion about the assumptions used here?

codecov[bot] commented 7 months ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (70157bb) 73.31% compared to head (4fd992c) 74.40%. Report is 1 commits behind head on main.

Files Patch % Lines
R/calc_indicators.R 95.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #211 +/- ## ========================================== + Coverage 73.31% 74.40% +1.09% ========================================== Files 43 43 Lines 1825 1817 -8 ========================================== + Hits 1338 1352 +14 + Misses 487 465 -22 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

karpfen commented 7 months ago

Sorry, I saw your request too late. I'm testing on my data right now that caused the problem in the first place.

karpfen commented 7 months ago

@goergen95 I think the original problem is solved, but it's still failing for me because the calc_landcover function returns zero-length tibbles instead of NAs. I'm currently going through my data to identify a reproducible example

goergen95 commented 7 months ago

But shouldn't that be covered for with 87b99ba8?

karpfen commented 7 months ago

I don't have the original error anymore, because my session crashed. But I think I received the new error message from calc_indicators: https://github.com/mapme-initiative/mapme.biodiversity/blob/87b99ba8de68c05be1f5b525b5501e51515793ae/R/calc_indicators.R#L212-L215

This would mean that the landcover indicator returned a zero-length tibble. That's my guess at least. I'm still looking for the offending polygon.

goergen95 commented 7 months ago

Oh, I see what you mean now. So there is a bug in the landcover function that is not directly related to this PR.

karpfen commented 7 months ago

You're right, I'll add it as an issue, I managed to find a reprex now, too.