Skip to content

Commit

Permalink
provide thredds workflow example (NOAA)
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Oct 12, 2023
1 parent fed797e commit 2ed8230
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
34 changes: 34 additions & 0 deletions inst/extdata/workflows/config_metadata_thredds_noaa.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"id": "thredds",
"profile": {
"project": "geoflow-thredds",
"organization": "geoflow",
"logos": [],
"options": {
"line_separator": "_\n"
},
"mode": "entity"
},



"metadata": {
"entities": [
{
"handler": "thredds",
"source": "oisst-avhrr-v02r01.20210518.nc"
}
]
},
"software": [
{
"id": "thredds",
"type": "input",
"software_type": "thredds",
"parameters": {
"x": "https://www.ncei.noaa.gov/thredds/catalog/OisstBase/NetCDF/V2.1/AVHRR/202105/catalog.xml"
}
}
],
"actions": []
}
3 changes: 2 additions & 1 deletion inst/extdata/workflows/workflows.csv
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ config_metadata_ocs.json,Load metadata entities/contacts/dictionary from CSV fil
config_metadata_dataverse.json,Load metadata entities/contacts from Dataverse records
config_metadata_zenodo.json,Load metadata entities/contacts from Zenodo deposits/records
config_metadata_zenodo_with_options.json,Load metadata entities/contacts from Zenodo deposits/records (with options declared to fetch from public records and by DOI)
config_metadata_ncml.json,Load a metadata entity/contacts from a NCML source
config_metadata_ncml.json,Load a metadata entity/contacts from a NCML source
config_metadata_thredds_noaa.json,Load metadata entities/contact from a Thredds data server (NOAA example)
41 changes: 41 additions & 0 deletions tests/testthat/test_config_metadata_thredds_noaa.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# test_config_metadata_thredds_noaa.R
# Author: Emmanuel Blondel <emmanuel.blondel1@gmail.com>
#
# Description: Integration tests for config_metadata_thredds_noaa.json workflow
#=======================
require(geoflow, quietly = TRUE)
require(testthat)

#init
test_that("init",{
testthat::skip_on_cran()
cfg_file = system.file("extdata/workflows/config_metadata_thredds_noaa.json", package = "geoflow")
CFG <- geoflow::initWorkflow(cfg_file)
expect_is(CFG$metadata$content, "list")
expect_equal(length(CFG$metadata$content), 1L)
expect_equal(names(CFG$metadata$content), "entities")
expect_equal(length(CFG$metadata$content$entities), 1L)
expect_equal(length(CFG$getEntities()), 1L)
expect_equal(length(CFG$actions), 0L)
})

#debug
test_that("debug",{
testthat::skip_on_cran()
cfg_file = system.file("extdata/workflows/config_metadata_thredds_noaa.json", package = "geoflow")
DEBUG <- geoflow::debugWorkflow(cfg_file, entityIndex = 1, dir = ".")
expect_equal(names(DEBUG), c("config", "entity"))
expect_is(DEBUG$config, "list")
expect_is(DEBUG$entity, "geoflow_entity")
})

#execute
test_that("execute",{
#testthat::skip_on_cran()
#cfg_file = system.file("extdata/workflows/config_metadata_thredds_noaa.json", package = "geoflow")
#execution
#EXEC <- geoflow::executeWorkflow(cfg_file, dir = ".")
#expect_true(dir.exists(EXEC))
#expect_true(file.exists(file.path(EXEC, "job.json")))
#expect_true(file.exists(file.path(EXEC, "job-logs.txt")))
})

0 comments on commit 2ed8230

Please sign in to comment.