CatalogNode | R Documentation |
A catalog representation that sublcasses from ThreddsNode
thredds::ThreddsNode
-> CatalogNode
list_services()
list available services
CatalogNode$list_services( xpath = build_xpath("service", prefix = self$prefix), form = "list" )
xpath
character, the xpath specifications
form
character, either "list" or "table"
list of zero or more character vectors
list_catalogs()
list available catalogRefs
CatalogNode$list_catalogs( xpath = build_xpath(c("dataset", "catalogRef"), prefix = self$prefix), form = "list" )
xpath
character, the xpath descriptor
form
character, either "list" or "table"
a list with zero or more character vectors
list_datasets()
list available datasets
CatalogNode$list_datasets( xpath = build_xpath(c("dataset", "dataset"), prefix = self$prefix), form = "list" )
xpath
character, the xpath descriptor
form
character, either "list" or "table"
a list with zero or more character vectors
get_catalogs()
Retrieve a list one or more of child catalogs
CatalogNode$get_catalogs( index, xpath = build_xpath(c("dataset", "catalogRef"), prefix = self$prefix) )
index
integer index (1,...,nChild), indices or name(s)
xpath
character xpath representation
a list of Catalog class objects, possibly NULL
get_datasets()
Retrieve list one or more dataset children
CatalogNode$get_datasets( index, xpath = build_xpath(c("dataset", "dataset"), prefix = self$prefix) )
index
the integer index (1,...,nChild), indices or name(s)
xpath
character xpath representation
a list of Dataset objects or NULL
get_dataset_names()
Retrieve list zero or more dataset child names. If unnnamed, then we substitute "title", "ID", "urlPath", or "href" in that order of availability.
CatalogNode$get_dataset_names( xpath = build_xpath(c("dataset", "dataset"), prefix = self$prefix) )
xpath
character xpath representation
index
the integer index (1,...,nChild), indices or name(s)
character vector of zero or more names
get_catalog_names()
Retrieve list zero or more catalog child names. If unnnamed, then we substitute "title", "ID", "urlPath" or href" in that order of availability.
CatalogNode$get_catalog_names( xpath = build_xpath(c("dataset", "catalogRef"), prefix = self$prefix) )
xpath
character xpath representation
index
the integer index (1,...,nChild), indices or name(s)
character vector of zero or more names
parse_catalog_node()
Parse a catalog node
CatalogNode$parse_catalog_node(x)
x
xml_node
Catalog class object
parse_dataset_node()
Parse a dataset node
CatalogNode$parse_dataset_node(x)
x
xml_node
Dataset class object
print()
print method
CatalogNode$print(prefix = "")
prefix
character, to be printed before each line of output (like spaces)
...
other arguments for superclass
clone()
The objects of this class are cloneable with this method.
CatalogNode$clone(deep = FALSE)
deep
Whether to make a deep clone.
library(thredds)
top_uri <- 'https://oceandata.sci.gsfc.nasa.gov/opendap/catalog.xml'
Top <- thredds::CatalogNode$new(top_uri)
#to browse catalogue
#Top$browse()
#go down in 'MODISA' catalog
L3 <- Top$get_catalogs("MODISA")[["MODISA"]]$get_catalogs()[[1]]
#see what's available for 2009
catalog2009 <- L3$get_catalogs("2009")[[1]]
#get catalog for 2009-01-20
doy <- format(as.Date("2009-01-20"), "%m%d")
catalog20 <- catalog2009$get_catalogs(doy)[[doy]]
#get dataset node
chl <- catalog20$get_datasets("AQUA_MODIS.20090120.L3m.DAY.CHL.chlor_a.4km.nc")[[1]]
#retrieve the relative URL, and add it to the base URL for the service.
#Somewhat awkwardly, the relative URL comes prepended with a path separator, so we
#use straight up `paste0` to append to the base_uri.
#if(require("ncdf4")){
# base_uri <- "https://oceandata.sci.gsfc.nasa.gov:443/opendap"
# uri <- paste0(base_uri, chl[["AQUA_MODIS.20090120.L3m.DAY.CHL.chlor_a.4km.nc"]]$url)
# NC <- ncdf4::nc_open(uri)
#}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.