-
Notifications
You must be signed in to change notification settings - Fork 2
add tests that run locally to test attributes of pvols #143
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
Draft
bart1
wants to merge
11
commits into
main
Choose a base branch
from
check_attributes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d576642
add tests that run locally to test attributes of pvols
dcaab8d
add release_bullets function so that a reminder is made for next rele…
f3cee8f
Check if is.pvol
d254ccc
add test for release_bullets
3f2f0c8
fix wavelength error
ccdde95
Add release bullet for local tests with API keys
bart1 d0c7146
Merge pull request #153 from aloftdata/main
bart1 b196147
Remove skip condition for Denmark API key test
bart1 e40424c
Merge pull request #158 from aloftdata/main
bart1 f18b767
Merge branch 'main' into check_attributes
14ea415
Merge branch 'main' into check_attributes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,103 @@ | ||
| check_attributes <- function(x, wr_df) { | ||
| expect_s3_class(x, "pvol") | ||
| expect_true(bioRad::is.pvol(x)) | ||
| expect_true(x$radar %in% wr_df$radar) | ||
| radar_df <- wr_df[ | ||
| x$radar == wr_df$radar & | ||
| (as.logical(wr_df$status) | wr_df$country == "United States"), | ||
| ] | ||
| expect_equal(nrow(radar_df), 1) | ||
| expect_equal(x$geo$height, radar_df$heightantenna, tolerance = .001) | ||
| expect_equal( | ||
| x$attributes$where$height, | ||
| radar_df$heightantenna, | ||
| tolerance = .001 | ||
| ) | ||
| expect_equal(x$geo$lat, radar_df$latitude, tolerance = .001) | ||
| expect_equal(x$attributes$where$lat, radar_df$latitude, tolerance = .001) | ||
| expect_equal(x$geo$lon, radar_df$longitude, tolerance = .001) | ||
| expect_equal(x$attributes$where$lon, radar_df$longitude, tolerance = .001) | ||
| expect_equal( | ||
| # For the Netherlands wavelength get a dim 1, using c() drops it | ||
| c(x$attributes$how$wavelength), | ||
| 299792458 / (radar_df$frequency * 10^9) * 100, | ||
| tolerance = .005 | ||
| ) | ||
| } | ||
| wr_df <- get_weather_radars(source = c("nexrad", "opera")) | ||
| t <- Sys.time() - 24 * 60 * 60 | ||
|
|
||
| test_that("Check Germany", { | ||
| skip_on_cran() | ||
| skip_on_ci() | ||
| pv <- get_pvol("depro", t) | ||
| check_attributes(pv, wr_df) | ||
| }) | ||
|
|
||
| test_that("Check Czechia", { | ||
| skip_on_cran() | ||
| skip_on_ci() | ||
|
|
||
| pv <- get_pvol("czbrd", t) | ||
| check_attributes(pv, wr_df) | ||
| }) | ||
|
|
||
| test_that("Check Estonia", { | ||
| skip_on_cran() | ||
| skip_on_ci() | ||
| pv <- get_pvol("eehar", t) | ||
| check_attributes(pv, wr_df) | ||
| }) | ||
|
|
||
| test_that("Check Finland", { | ||
| skip_on_cran() | ||
| skip_on_ci() | ||
| pv <- get_pvol("fikor", t) | ||
| check_attributes(pv, wr_df) | ||
| }) | ||
|
|
||
| test_that("Check Romania", { | ||
| skip_on_cran() | ||
| skip_on_ci() | ||
| pv <- get_pvol("roora", t) | ||
| check_attributes(pv, wr_df) | ||
| }) | ||
|
|
||
| test_that("Check Slovakia", { | ||
| skip_on_cran() | ||
| skip_on_ci() | ||
| pv <- get_pvol("skkoj", t) | ||
| check_attributes(pv, wr_df) | ||
| }) | ||
|
|
||
| test_that("Check Netherland", { | ||
| skip_on_cran() | ||
| skip_on_ci() | ||
| withr::local_options(list( | ||
| "keyring_backend" = "env" | ||
| )) | ||
| # get public key here https://developer.dataplatform.knmi.nl/open-data-api#token | ||
| withr::local_envvar( | ||
| list( | ||
| "getRad_nl_api_key" = "eyJvcmciOiI1ZTU1NGUxOTI3NGE5NjAwMDEyYTNlYjEiLCJpZCI6ImVlNDFjMWI0MjlkODQ2MThiNWI4ZDViZDAyMTM2YTM3IiwiaCI6Im11cm11cjEyOCJ9" | ||
| ) | ||
| ) | ||
| skip_if(Sys.which("KNMI_vol_h5_to_ODIM_h5") == "") | ||
| pv <- get_pvol("nldhl", t) | ||
| check_attributes(pv, wr_df) | ||
| }) | ||
|
|
||
| test_that("Check Denmark", { | ||
| skip_on_cran() | ||
| skip_on_ci() | ||
| pv <- get_pvol("dkbor", t) | ||
| check_attributes(pv, wr_df) | ||
| }) | ||
|
|
||
|
|
||
| test_that("Check US", { | ||
| skip_on_cran() | ||
| skip_on_ci() | ||
| pv <- get_pvol("KABR", t) | ||
| check_attributes(pv, wr_df) | ||
| }) | ||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why skip on CI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As i remember the tests can take quite long, if we want to test on CI i think we should avoid doing it on all runners (also to reduce load). These tests are mainly meant to check the data format of the radars so are not likely os dependent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very well, I was just curious. Seems like it should do the trick!
I've once read, I believe in the HTTP testing guide, about setting up a Github Workflow that ran every week instead of every PR to test for this kind of integrity. But I've never actually set something like that up for any of my repo's. I've used postman instead for checking that sort of thing.