-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests and examples for geomarker functions
- Loading branch information
1 parent
731fca6
commit 7311201
Showing
6 changed files
with
175 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# getting daily merra from GES DISC works | ||
|
||
Code | ||
create_daily_merra_data("2023-05-23") | ||
Output | ||
# A tibble: 4,800 x 7 | ||
merra_dust merra_oc merra_bc merra_ss merra_so4 merra_pm25 s2 | ||
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <s2cell> | ||
1 1.46 0.308 0.0468 3.89 0.446 6.31 81a3f339877d0c5f | ||
2 1.38 0.328 0.0503 4.57 0.497 7.02 81a43f437c7a310d | ||
3 1.34 0.338 0.0524 4.92 0.534 7.39 81a5c74e7884f30b | ||
4 1.31 0.347 0.0546 5.44 0.580 7.95 81af5de48e848ceb | ||
5 1.34 0.356 0.0565 5.97 0.623 8.58 81af21e856572593 | ||
6 1.48 0.367 0.0582 6.33 0.658 9.14 81aebd9a839ae4f3 | ||
7 1.68 0.387 0.0616 7.10 0.686 10.2 81ac157723ad238b | ||
8 1.89 0.417 0.0667 8.11 0.717 11.5 81ac8d385d99a58d | ||
9 2.00 0.458 0.0729 9.27 0.741 12.8 81acb54e797c8449 | ||
10 2.03 0.500 0.0791 10.3 0.747 13.9 805372bafbb0d335 | ||
# i 4,790 more rows | ||
|
||
--- | ||
|
||
Code | ||
create_daily_merra_data(merra_date = "2020-09-02") | ||
Output | ||
# A tibble: 4,800 x 7 | ||
merra_dust merra_oc merra_bc merra_ss merra_so4 merra_pm25 s2 | ||
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <s2cell> | ||
1 0.334 2.30 0.136 0.346 0.317 3.56 81a3f339877d0c5f | ||
2 0.269 2.10 0.127 0.251 0.268 3.12 81a43f437c7a310d | ||
3 0.224 1.75 0.109 0.344 0.217 2.72 81a5c74e7884f30b | ||
4 0.212 1.25 0.0853 0.661 0.190 2.47 81af5de48e848ceb | ||
5 0.258 1.00 0.0710 0.665 0.175 2.24 81af21e856572593 | ||
6 0.252 0.791 0.0561 0.543 0.148 1.85 81aebd9a839ae4f3 | ||
7 0.171 0.503 0.0392 0.582 0.109 1.45 81ac157723ad238b | ||
8 0.105 0.605 0.0453 0.844 0.143 1.80 81ac8d385d99a58d | ||
9 0.110 0.737 0.0519 1.11 0.209 2.30 81acb54e797c8449 | ||
10 0.168 0.706 0.0508 1.42 0.315 2.77 805372bafbb0d335 | ||
# i 4,790 more rows | ||
|
||
--- | ||
|
||
Code | ||
create_daily_merra_data(merra_date = "2021-06-16") | ||
Output | ||
# A tibble: 4,800 x 7 | ||
merra_dust merra_oc merra_bc merra_ss merra_so4 merra_pm25 s2 | ||
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <s2cell> | ||
1 0.197 0.135 0.0428 11.5 0.418 12.4 81a3f339877d0c5f | ||
2 0.206 0.156 0.0462 11.6 0.443 12.6 81a43f437c7a310d | ||
3 0.212 0.176 0.0490 11.7 0.462 12.8 81a5c74e7884f30b | ||
4 0.218 0.195 0.0515 11.8 0.479 13.0 81af5de48e848ceb | ||
5 0.228 0.211 0.0536 12.0 0.492 13.1 81af21e856572593 | ||
6 0.237 0.223 0.0552 12.1 0.500 13.3 81aebd9a839ae4f3 | ||
7 0.242 0.231 0.0564 12.1 0.504 13.3 81ac157723ad238b | ||
8 0.238 0.231 0.0569 12.0 0.506 13.2 81ac8d385d99a58d | ||
9 0.226 0.228 0.0570 11.7 0.508 12.9 81acb54e797c8449 | ||
10 0.215 0.224 0.0571 11.4 0.508 12.6 805372bafbb0d335 | ||
# i 4,790 more rows | ||
|
||
--- | ||
|
||
Code | ||
create_daily_merra_data(merra_date = "2021-05-21") | ||
Output | ||
# A tibble: 4,800 x 7 | ||
merra_dust merra_oc merra_bc merra_ss merra_so4 merra_pm25 s2 | ||
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <s2cell> | ||
1 1.16 0.226 0.0491 9.67 0.388 11.6 81a3f339877d0c5f | ||
2 1.26 0.218 0.0486 9.50 0.376 11.5 81a43f437c7a310d | ||
3 1.35 0.222 0.0495 9.43 0.360 11.6 81a5c74e7884f30b | ||
4 1.37 0.224 0.0503 9.43 0.339 11.5 81af5de48e848ceb | ||
5 1.34 0.221 0.0504 9.27 0.316 11.3 81af21e856572593 | ||
6 1.33 0.224 0.0512 9.06 0.316 11.1 81aebd9a839ae4f3 | ||
7 1.33 0.227 0.0519 8.77 0.321 10.8 81ac157723ad238b | ||
8 1.34 0.224 0.0516 8.41 0.323 10.5 81ac8d385d99a58d | ||
9 1.34 0.219 0.0508 7.96 0.326 10.0 81acb54e797c8449 | ||
10 1.34 0.217 0.0504 7.50 0.328 9.55 805372bafbb0d335 | ||
# i 4,790 more rows | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# get_merra_data works | ||
|
||
Code | ||
get_merra_data(x = s2::as_s2_cell(names(d)), dates = d) | ||
Output | ||
$`8841b39a7c46e25f` | ||
# A tibble: 2 x 6 | ||
merra_dust merra_oc merra_bc merra_ss merra_so4 merra_pm25 | ||
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> | ||
1 1.77 6.84 0.532 0.994 2.43 13.5 | ||
2 0.842 2.65 0.392 0.244 2.21 7.17 | ||
$`8841a45555555555` | ||
# A tibble: 2 x 6 | ||
merra_dust merra_oc merra_bc merra_ss merra_so4 merra_pm25 | ||
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> | ||
1 1.34 2.52 0.327 0.356 3.71 9.64 | ||
2 1.18 2.80 0.441 0.722 5.78 13.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
if (file.exists(".env")) dotenv::load_dot_env() | ||
earthdata_secrets <- Sys.getenv(c("EARTHDATA_USERNAME", "EARTHDATA_PASSWORD"), unset = NA) | ||
skip_if(any(is.na(earthdata_secrets)), message = "no earthdata credentials found") | ||
|
||
test_that("getting daily merra from GES DISC works", { | ||
# plus these tests take a long time to download the raw merra data | ||
|
||
# "normal" pattern | ||
create_daily_merra_data("2023-05-23") |> | ||
expect_snapshot() | ||
# merra site uses 401 instead of 400 for september 2020 dates | ||
create_daily_merra_data(merra_date = "2020-09-02") |> | ||
expect_snapshot() | ||
# merra site uses 401 instead of 400 for jun, jul, aug, sep 2021 dates | ||
create_daily_merra_data(merra_date = "2021-06-16") |> | ||
expect_snapshot() | ||
create_daily_merra_data(merra_date = "2021-05-21") |> | ||
expect_snapshot() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
test_that("get_merra_data works", { | ||
d <- list( | ||
"8841b39a7c46e25f" = as.Date(c("2023-05-18", "2023-11-06")), | ||
"8841a45555555555" = as.Date(c("2023-06-22", "2023-08-15")) | ||
) | ||
get_merra_data(x = s2::as_s2_cell(names(d)), dates = d) |> | ||
expect_snapshot() | ||
}) |