Skip to content

Commit

Permalink
Make ADI available in metadata catalog (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
kzollove authored Nov 11, 2023
1 parent 4ba8eb7 commit 5c9a383
Show file tree
Hide file tree
Showing 6 changed files with 240 additions and 118 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
.httr-oauth
.DS_Store
inst/doc
inst/config.yml
errorReportSql.txt
examples/
13 changes: 13 additions & 0 deletions R/stageData.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ getStaged <- function(rec, storageConfig = readStorageConfig()) {
isPersisted <- storageConfig$`offline-storage`$`persist-data`
storageDir <- file.path(storageConfig$`offline-storage`$directory, rec$dataset_name)
gisTempDir <- file.path(tempdir(), 'gaia')

if (!dir.exists(gisTempDir)) {
dir.create(gisTempDir)
}
Expand All @@ -50,6 +51,18 @@ getStaged <- function(rec, storageConfig = readStorageConfig()) {
options(timeout = 600)
on.exit(options(timeout = baseTimeout))

if (rec$download_method == "local") {
message("Loading locally hosted dataset...")
if(!dir.exists(storageDir) || !file.exists(file.path(storageDir, rec$download_url))) {
msg <- paste0("You are trying to load source data of type \"local\",\nbut no local dataset was found.\nPlease ensure that the directory you specified for external\nstorage in the config file:\n(", storageDir,")\nexists and contains the source data for this variable (", rec$download_url,").\nFor information about obtaining this source dataset, visit\n", rec$documentation_url)
stop(msg, call. = T)
}

return(readFromZip(zipfile = file.path(storageDir, rec$download_url),
exdir = gisTempDir,
rec = rec))
}

if (rec$download_method == "file") {
if (rec$download_subtype == "zip") {

Expand Down
5 changes: 0 additions & 5 deletions inst/config.yml

This file was deleted.

Loading

0 comments on commit 5c9a383

Please sign in to comment.