-
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.
Add argument "crs" to read_asc_[gz_]file()
and remove argument "projection" from read_asc_file()
- Loading branch information
Showing
8 changed files
with
49 additions
and
33 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
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.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,17 +1,23 @@ | ||
# | ||
# This test file has been generated by kwb.test::create_test_files() | ||
# launched by user hsonne on 2022-09-16 16:43:24. | ||
# Your are strongly encouraged to modify the dummy functions | ||
# so that real cases are tested. You should then delete this comment. | ||
# | ||
#library(testthat) | ||
|
||
test_that("read_asc_gz_file() works", { | ||
|
||
f <- kwb.dwd:::read_asc_gz_file | ||
|
||
expect_error( | ||
kwb.dwd:::read_asc_gz_file() | ||
# argument "file" is missing, with no default | ||
) | ||
expect_error(f()) | ||
|
||
start_url <- "ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/" | ||
|
||
#head(grep("\\.asc.gz$", kwb.dwd::dwd_files$file, value = TRUE)) | ||
|
||
url_1 <- paste0(start_url, "evapo_p/grids_germany_monthly_evapo_p_202201.asc.gz") | ||
url_2 <- paste0(start_url, "precipitation/01_Jan/grids_germany_monthly_precipitation_188101.asc.gz") | ||
|
||
crs <- sf::st_crs(31467L) | ||
|
||
expect_output(result_1 <- f(url = url_1, crs = crs)) | ||
expect_output(result_2 <- f(url = url_2, crs = crs)) | ||
|
||
expect_s4_class(result_1, "RasterLayer") | ||
expect_s4_class(result_2, "RasterLayer") | ||
}) |