Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gsw #354

Merged
merged 6 commits into from
Aug 23, 2024
Merged

Add gsw #354

merged 6 commits into from
Aug 23, 2024

Conversation

karpfen
Copy link
Collaborator

@karpfen karpfen commented Aug 22, 2024

No description provided.

@goergen95
Copy link
Member

Hi! Why removing the years parameters? It might also be a good idea to include it in the get function. Currently one would always download and calculate the complete time series?

Copy link

codecov bot commented Aug 23, 2024

Codecov Report

Attention: Patch coverage is 98.82353% with 1 line in your changes missing coverage. Please review.

Project coverage is 86.76%. Comparing base (1f4e16f) to head (a1343db).
Report is 1 commits behind head on main.

Files Patch % Lines
R/calc_gsw_time_series.R 97.36% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #354      +/-   ##
==========================================
+ Coverage   86.39%   86.76%   +0.37%     
==========================================
  Files          64       66       +2     
  Lines        2756     2841      +85     
==========================================
+ Hits         2381     2465      +84     
- Misses        375      376       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@karpfen
Copy link
Collaborator Author

karpfen commented Aug 23, 2024

@goergen95 I removed them only from the calc function. The user can still select which years to process while setting up the portfolio.

@goergen95
Copy link
Member

Ah, yep! Sorry, did not catch that. 👍

@karpfen
Copy link
Collaborator Author

karpfen commented Aug 23, 2024

Now that I looked into it, I noticed that we're not really consistent within the package with that logic, though.
For example, in human footprint you also set the year during get_, but for GFW you do it during calc_.

@karpfen karpfen requested a review from goergen95 August 23, 2024 10:08
@goergen95
Copy link
Member

GFW are single layers with no temporal dimension. The temporal information is in the pixel's value, not the layers. However, I would like to see it consistent with other resources/indicators, aka in relation to humanfootprint. One could argue that one might be downloading all available layers in one sweep, but for certain analysis one might only calculate these indicators for a temporal subset. That would mean to expose the years argument in both functions.

@karpfen
Copy link
Collaborator Author

karpfen commented Aug 23, 2024

Ah, true. That makes sense then.

library(terra)

years <- 2000:2001
outdir <- system.file("resources", package = "mapme.indicators")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs changing to reference mapme.biodiversity

gsw_time_series <- prep_resources(x)
gsw_time_series <- gsw_time_series [[1]]

outdir <- "inst/resources/gsw_time_series"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should reference 'res' instead of 'resources'

@@ -0,0 +1,34 @@
test_that("get_gsw_time_series works", {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this include a test to see that a footprints object is returned if successful?

@karpfen karpfen merged commit 184199f into main Aug 23, 2024
10 checks passed
@karpfen karpfen deleted the add-gsw branch August 23, 2024 12:04
@goergen95
Copy link
Member

@karpfen: the code in the example fails

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants