EsgResult is a base class that represents basic query results from
ESGF search RESTful API. It defines common fields and methods for results
from all query types, including Dataset, File and Aggregation. Results
from the three types are
In general, there is no need to create an EsgResult manually.
idA character vector indicating globally unique record identifiers.
urlA list of data.table with 3 columns:
service \[character\]: The service types, e.g. OPENDAP,
HTTPServer, etc.;
url \[character\]: The actual URLs;
mime_type \[character\]: The MIME types indicating
the nature and format of the corresponding document of the
URLs.
sizeA vector of units indicating the file sizes.
fieldsA character vector indicating all fields in the results, preserving the order returned by the response.
time_filterA list describing the time range used by
$filter_time(), or NULL if no result-level time filter
has been recorded.
new()Create a new EsgResult object
EsgResult$new(index_node, params, response, context = NULL)index_nodeThe URL to the ESGF Index Node. It should be the
same as the index_node for an EsgQuery object that
collects the query results.
paramsA list of query parameters.
responseThe result of an query response.
contextOptional saved-result context. Used internally for result-level metadata such as recorded time filters.
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. Possible field names can be retrieved
using $fields. Default: NULL.
formattedWhether to use formatted values for special fields,
including url and size. Default: FALSE.
A data.table.
save()Save the result into a JSON file
$save() puts main data of an EsgResult object into a JSON file
which can be loaded to restore the current state of result using
EsgResult$load().
fileA string indicating the JSON file path to save the data to.
prettyWhether to add indentation whitespace to JSON output.
For details, please see jsonlite::toJSON(). Default: TRUE.
load()Restore the result state from an JSON file
$load() reads data of an EsgResult object from a JSON file
created using
EsgResult$save(). Saved
result fields are restored as read-only active bindings. A saved
file can only be loaded by the matching result type.
query_url()Return the ESGF search query URL used to create this result.
EsgResult$query_url(pages = c("first", "all"))reachable()Probe whether result records are reachable through a service URL.
$reachable() performs a lightweight probe of the selected service
URL for each record already held in the result. It returns diagnostic
rows and does not modify result context or saved-result metadata.
EsgResult$reachable(
service = "OPENDAP",
level = c("data_node", "url"),
probe = NULL
)serviceESGF URL service to probe. Default: "OPENDAP".
levelProbe level. "data_node" probes the root URL of each
data node; "url" probes the actual service URL for each
record. Default: "data_node".
probeOptional named list of probe settings. Supported fields
are timeout, concurrency, network_policy,
cache_seconds, and cache_failures_seconds.
A data.table with columns
record_index, id, data_node, service, url,
reachable, latency_ms, error, probe_level,
probe_url, and probe_cached.
slice()Subset result records by row, logical selector, or record ID.
$slice() filters the records already held in memory. It does not
change the original ESGF query parameters or query URL provenance.
filter()Subset result records with a predicate function.
selection()Return local selection provenance for this result.
$selection() maps current rows back to the result object that first
recorded selection provenance. It does not record intermediate filter
steps.