CatalogNode {thredds}R Documentation

A class for Catalogs (which may contain catalogs references or datasets)

Description

A catalog representation that sublcasses from ThreddsNode

Super class

thredds::ThreddsNode -> CatalogNode

Methods

Public methods

Inherited methods

Method list_services()

list available services

Usage
CatalogNode$list_services(
  xpath = build_xpath("service", prefix = self$prefix),
  form = "list"
)
Arguments
xpath

character, the xpath specifications

form

character, either "list" or "table"

Returns

list of zero or more character vectors


Method list_catalogs()

list available catalogRefs

Usage
CatalogNode$list_catalogs(
  xpath = build_xpath(c("dataset", "catalogRef"), prefix = self$prefix),
  form = "list"
)
Arguments
xpath

character, the xpath descriptor

form

character, either "list" or "table"

Returns

a list with zero or more character vectors


Method list_datasets()

list available datasets

Usage
CatalogNode$list_datasets(
  xpath = build_xpath(c("dataset", "dataset"), prefix = self$prefix),
  form = "list"
)
Arguments
xpath

character, the xpath descriptor

form

character, either "list" or "table"

Returns

a list with zero or more character vectors


Method get_catalogs()

Retrieve a list one or more of child catalogs

Usage
CatalogNode$get_catalogs(
  index,
  xpath = build_xpath(c("dataset", "catalogRef"), prefix = self$prefix)
)
Arguments
index

integer index (1,...,nChild), indices or name(s)

xpath

character xpath representation

Returns

a list of Catalog class objects, possibly NULL


Method get_datasets()

Retrieve list one or more dataset children

Usage
CatalogNode$get_datasets(
  index,
  xpath = build_xpath(c("dataset", "dataset"), prefix = self$prefix)
)
Arguments
index

the integer index (1,...,nChild), indices or name(s)

xpath

character xpath representation

Returns

a list of Dataset objects or NULL


Method 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.

Usage
CatalogNode$get_dataset_names(
  xpath = build_xpath(c("dataset", "dataset"), prefix = self$prefix)
)
Arguments
xpath

character xpath representation

index

the integer index (1,...,nChild), indices or name(s)

Returns

character vector of zero or more names


Method 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.

Usage
CatalogNode$get_catalog_names(
  xpath = build_xpath(c("dataset", "catalogRef"), prefix = self$prefix)
)
Arguments
xpath

character xpath representation

index

the integer index (1,...,nChild), indices or name(s)

Returns

character vector of zero or more names


Method parse_catalog_node()

Parse a catalog node

Usage
CatalogNode$parse_catalog_node(x)
Arguments
x

xml_node

Returns

Catalog class object


Method parse_dataset_node()

Parse a dataset node

Usage
CatalogNode$parse_dataset_node(x)
Arguments
x

xml_node

Returns

Dataset class object


Method print()

print method

Usage
CatalogNode$print(prefix = "")
Arguments
prefix

character, to be printed before each line of output (like spaces)

...

other arguments for superclass


Method clone()

The objects of this class are cloneable with this method.

Usage
CatalogNode$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

 
  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)
  #}
 


[Package thredds version 0.1-4 Index]