The Cmip6Dict
object provides functionalities to fetch the latest CMIP6
Controlled Vocabularies (CVs) and Data Request (DReq) information.
cmip6_dict()
The CMIP6 CVs gives a well-defined set of global attributes that are recorded in each CMIP6 model output, providing information necessary for interpreting the data. The data of CMIP6 CVs is stored as JSON files in the WCRP-CMIP GitHub Repo.
The CMIP6 DReq defines all the quantities from CMIP6 simulations that should
be archived. This includes both quantities of general interest needed from
most of the CMIP6-endorsed model intercomparison projects (MIPs) and
quantities that are more specialized and only of interest to a single
endorsed MIP. The raw data of DReq is stored a Microsoft Excel file
(CMIP6_MIP_tables.xlsx
) in a Subversion repo.
The Cmip6Dict
object uses the parsed DReq data that is stored in the
GitHub Repo.
For more information, please see:
version()
Get the version of CVs and Data Request
A list of two element:
cvs
: A numeric_version object giving the version of CVs
dreq
: A numeric_version object giving the version of Data
Request
is_empty()
Is it an empty Cmip6Dict?
$is_empty()
checks if this Cmip6Dict
is empty, i.e. the $build()
or $load()
method hasn't been called yet and there is no data of
CVs and Data Request.
timestamp()
Get the last modified time for CVs
A list of 14 DateTimes:
"cvs"
: The last modified time for the whole CV collection
"drs"
: The last modified time for Data Reference Syntax (DRS)
"activity_id"
: The last modified time for Activity ID
"experiment_id"
: The last modified time for Experiment ID
"frequency"
: The last modified time for Frequency
"grid_label"
: The last modified time for Grid Label
"institution_id"
: The last modified time for Institution ID
"nominal_resolution"
: The last modified time for Nominal Resolution
"realm"
: The last modified time for Realm
"required_global_attributes"
: The last modified time for Required Global Attributes
"source_id"
: The last modified time for Source ID
"source_type"
: The last modified time for Source Type
"sub_experiment_id"
: The last modified time for Sub-Experiment ID
"table_id"
: The last modified time for Table ID
build()
Fetch and parse all data of CVs and Data Request
get()
Get the data for a specific CV or Data Request
type
A single string indicating the type of data to list. Should be one of:
"drs"
: Data Reference Syntax (DRS)
"activity_id"
: Activity ID
"experiment_id"
: Experiment ID
"frequency"
: Frequency
"grid_label"
: Grid Label
"institution_id"
: Institution ID
"nominal_resolution"
: Nominal Resolution
"realm"
: Realm
"required_global_attributes"
: Required Global Attributes
"source_id"
: Source ID
"source_type"
: Source Type
"sub_experiment_id"
: Sub-Experiment ID
"table_id"
: Table ID
"dreq"
: Data Request
save()
Save the Cmip6Dict object
$save()
stores all the core data of current Cmip6Dict
object into
an RDS file named CMIP6DICT
in the specified folder.
This file can be reloaded via $load()
method to restore the last
state of current Cmip6Dict
object.
Cmip6Dict$save(dir = getOption("epwshiftr.dir", "."))
load()
Load the saved Cmip6Dict object from file
$load()
loads the RDS file named CMIP6DICT
that is created using
$save()
method.
Please note that the file should be exactly the same as CMIP6DICT
without file extension.
Cmip6Dict$load(dir = getOption("epwshiftr.dir", "."))
print()
Print a summary of the current Cmip6Dict
object
$print()
gives the summary of current Cmip6Dict
object including
the version of CVs and Data Request, and the last built time.
if (FALSE) {
# create a new Cmip6Dict object
dict <- cmip6_dict()
# by default, there is no data when the Cmip6Dict was created
dict$is_empty()
# fetch and parse all CVs and Data Request data
dict$build()
# get the version of CVs nand Data Request
dict$version()
# get the last modified time for each CV and Data Request
dict$timestamp()
# get the time when the dict was built
dict$built_time()
# get the data of CVs and DReq
dict$get("activity_id")
dict$get("experiment_id")
dict$get("sub_experiment_id")
dict$get("institution_id")
dict$get("source_id")
dict$get("table_id")
dict$get("frequency")
dict$get("grid_label")
dict$get("realm")
dict$get("source_type")
dict$get("dreq")
# save the dict object for later usage
# default location is the value of global option "epwshiftr.dir"
dict$save()
# the saved dict object can be reloaded
new_dict <- cmip6_dict()
new_dict$load()
# print will show the version summary and the last built time
dict$print()
}