EsgResultFile is a class that represents query results for
File type from ESGF search RESTful API.
In general, there is no need to create an EsgResultDataset manually.
Usually, it is created by calling
EsgResultDataset$collect().
epwshiftr::EsgResult -> EsgResultFile
filenameA character vector indicating file names on the sever.
url_opendapA character vector of the OPeNDAP URLs of the files.
url_downloadA character vector of the download URLs of the files.
fieldsA character vector indicating all response fields,
followed by derived fields such as filename, url_opendap
and url_download when their source fields are available.
Inherited methods
epwshiftr::EsgResult$count()epwshiftr::EsgResult$filter()epwshiftr::EsgResult$initialize()epwshiftr::EsgResult$load()epwshiftr::EsgResult$query_url()epwshiftr::EsgResult$reachable()epwshiftr::EsgResult$save()epwshiftr::EsgResult$selection()epwshiftr::EsgResult$slice()epwshiftr::EsgResult$to_dt()
to_data_table()Convert the results into a data.table
fieldsA non-empty character vector indicating the fields to
put into the data.table. If NULL, all fields in the query
result will be used. Default: NULL.
formattedWhether to use formatted values for special fields,
including url and size. Default: FALSE.
A data.table.
filter_time()Filter file records by the time range covered by each file
method = "drs" parses the time range from CMIP/DRS-style NetCDF
filenames in title, URL basenames, or id. This is fast and does
not open files, but it depends on the ESGF filename convention.
Records whose time range cannot be parsed are kept and reported with
a warning.
method = "opendap" opens each OPeNDAP URL and reads the NetCDF
time axis to determine the file range. This is more exact, but much
slower and requires OPeNDAP access.
The requested time filter is recorded on the returned result and is
carried into EsgDataset$read_region() when a dataset is opened from
the filtered result.
EsgResultFile$filter_time(start, stop, method = c("drs", "opendap"))download_plan()Build a persistent downloader plan for file records.
replicaWhether to use current records or expand known replicas.
serviceESGF URL service to download from. Default: "HTTPServer".
probeWhether to lightly probe URLs before ranking them.
strategyCandidate ranking strategy.
allWhether replica expansion should retrieve all matching records.
node_statsOptional data node history from
Downloader$data_nodes().
network_policyOptional network options from
Downloader$network_policy.
node_policyOptional data-node cooldown policy from
Downloader$node_policy.
probe_concurrencyMaximum concurrent URL probes. Default: 1.
probe_cache_secondsSeconds to reuse fresh data-node probe
history before probing a URL again. Default: 3600.
expand_replicas()Query ESGF for same-version master and replica records.
repair_urls()Replace unreachable service URLs with reachable replica records.
$repair_urls() probes the current records for the selected service,
queries ESGF replicas by master_id for records whose URL is missing or
unreachable, probes candidate replica URLs, and returns a new result with
repaired records in the original row order. The original result is not
modified. The returned result records the original query URL plus the
replica lookup query URL in $query_url("all").
EsgResultFile$repair_urls(
service = c("OPENDAP", "HTTPServer"),
index_node = NULL,
probe = NULL
)serviceService URL to repair. One of "OPENDAP" or
"HTTPServer". Default: "OPENDAP".
index_nodeOptional ESGF search index node used to look up
replicas. If NULL, the current result index node is used.
probeOptional named list of probe settings. Supported fields
are level, timeout, concurrency, network_policy,
cache_seconds, and cache_failures_seconds. Default
level is "data_node".
select_replica()Select the preferred candidate URL per logical file.
EsgResultFile$select_replica(
strategy = c("fastest", "first", "stable"),
probe = TRUE,
service = "HTTPServer",
node_stats = NULL,
network_policy = NULL,
node_policy = NULL,
probe_concurrency = 1L,
probe_cache_seconds = 3600L
)strategyCandidate ranking strategy.
probeWhether to lightly probe URLs before ranking them.
serviceESGF URL service to download from. Default:
"HTTPServer".
node_statsOptional data node history from
Downloader$data_nodes().
network_policyOptional network options from
Downloader$network_policy.
node_policyOptional data-node cooldown policy from
Downloader$node_policy.
probe_concurrencyMaximum concurrent URL probes. Default: 1.
probe_cache_secondsSeconds to reuse fresh data-node probe
history before probing a URL again. Default: 3600.
download()Enqueue and run file downloads using a Downloader.
downloaderOptional persistent Downloader. If NULL,
store$downloader() is used when store is supplied.
storeOptional EsgStore providing a bound downloader.
replicaWhether to use current records or expand known replicas before downloading.
serviceESGF URL service to download from. Default:
"HTTPServer".
probeWhether to lightly probe URLs before ranking them.
strategyCandidate ranking strategy.
probe_concurrencyMaximum concurrent URL probes when
probe = TRUE. Default comes from the downloader worker count.
probe_cache_secondsSeconds to reuse fresh data-node probe
history before probing a URL again. Default: 3600.
session_labelOptional download session label.
runWhether to run the queued session immediately. Default:
TRUE.
...Additional arguments passed to Downloader$run().
print()Print a summary of the current dataset
open_dataset()Open a file as an EsgDataset for remote data access via OPeNDAP
EsgResultFile$open_dataset(
which = NULL,
fallback = c("ask", "auto", "error"),
store = NULL,
downloader = NULL,
progress = getOption("epwshiftr.progress", interactive())
)whichFile records to open. Use integer indices or file IDs.
If NULL, all file records are opened. Default: NULL.
fallbackWhat to do if OPeNDAP is unavailable. One of:
"ask": Interactively ask the user (default). In a
non-interactive session this raises an error.
"auto": Automatically download the file via HTTPServer.
"error": Raise an error.
storeOptional EsgStore used for recoverable HTTP fallback.
downloaderOptional persistent Downloader used for recoverable HTTP fallback.
progressWhether to show progress bars while opening
OPeNDAP records and any HTTP fallback downloads. By default
the package option epwshiftr.progress is used, falling back
to interactive().