-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from pepijn-devries/work-in-progress
Work in progress
- Loading branch information
Showing
28 changed files
with
251 additions
and
129 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
^\.Rproj\.user$ | ||
^README\.Rmd$ | ||
^LICENSE\.md$ | ||
man-roxygen |
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,8 +1,8 @@ | ||
Package: CopernicusMarine | ||
Type: Package | ||
Title: Search Download and Handle Data from Copernicus Marine Service Information | ||
Version: 0.0.3 | ||
Date: 2023-01-17 | ||
Version: 0.0.6 | ||
Date: 2023-01-23 | ||
Authors@R: c(person("Pepijn", "de Vries", role = c("aut", "cre", "dtc"), | ||
email = "[email protected]", | ||
comment = c(ORCID = "0000-0002-7961-6646"))) | ||
|
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
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
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.http_status_ok <- function(x) { | ||
if (dplyr::between(x$status_code, 100, 199)) { | ||
message(sprintf("Unexpected informational response from Copernicus (status %i).", x$status_code)) | ||
return(FALSE) | ||
} | ||
if (dplyr::between(x$status_code, 300, 399)) { | ||
message(sprintf("Unexpected redirection from Copernicus (status %i).", x$status_code)) | ||
return(FALSE) | ||
} | ||
if (dplyr::between(x$status_code, 400, 499)) { | ||
message(sprintf(paste("Copernicus reported a client error (status %i).", | ||
"You may have requested information that is not available,", | ||
"please check your input.", | ||
sep = "\n"), x$status_code)) | ||
return(FALSE) | ||
} | ||
if (dplyr::between(x$status_code, 500, 599)) { | ||
message(sprintf("Copernicus reported a server error (status %i).\nPlease try again later.", x$status_code)) | ||
return(FALSE) | ||
} | ||
if (x$status_code < 100 || x$status_code >= 600) { | ||
message(sprintf("Copernicus responded with unknown status (status %i).", x$status_code)) | ||
return(FALSE) | ||
} | ||
return(TRUE) | ||
} | ||
|
||
.try_online <- function(expr, resource) { | ||
result <- tryCatch(expr, error = function(e) { | ||
message(sprintf("Failed to collect information from %s.\n%s", resource, e$message)) | ||
return(NULL) | ||
}) | ||
if (is.null(result)) return(NULL) | ||
if (!.http_status_ok(result)) return(NULL) | ||
return(result) | ||
} |
Oops, something went wrong.