Overview and access at DKRZ#
This notebook guides EERIE data users and explains how to find and load data available at DKRZ.
The notebook works well within the /work/bm1344/conda-envs/py_312/
environment.
All data relevant for the project is referenced in the main DKRZ-EERIE Catalog:
[1]:
import panel as pn
pn.extension("tabulator")
[2]:
import intake
catalog = (
"https://raw.githubusercontent.com/eerie-project/intake_catalogues/main/eerie.yaml"
)
eerie_cat = intake.open_catalog(catalog)
eerie_cat
eerie:
args:
path: https://raw.githubusercontent.com/eerie-project/intake_catalogues/main/eerie.yaml
description: ''
driver: intake.catalog.local.YAMLFileCatalog
metadata: {}
Online interactive browsing with the data base table#
The following table contains all EERIE model-output available at DKRZ on the file system.
Use the filters to subset the data base
Copy one value of the catalog_entry column and use it to open the data set from the intake catalog
Each line contains a single variable long name parsed from datasets.
DRS is the data reference syntax. A template for the path hierarchy of the catalogs.
[4]:
tabu # there is a hidden cell before
[4]:
[5]:
tabu.save("eerie-intake-database.html")
The EERIE Catalog is hierarchically structured using a path template (similar to the Data Reference Syntax used in CMIP):
hpc.hardware.product.source_id.experiment_id.version.realm.grid_type
Opened with python, the catalog is a nested dictionary of catalog sources. The lowest level will finally contain data sources which can be opened as xarray datasets with to_dask()
.
You can browse through the catalog by list
ing the catalog and selecting keys:
[6]:
print(list(eerie_cat))
print(list(eerie_cat["dkrz"]))
['jasmin', 'dkrz']
['disk', 'archive', 'cloud', 'main', 'dkrz_ngc3']
Entries can be joined with a ‘.’ so that you can access deeper level entries from the highest catalog level:
[7]:
eerie_cat["dkrz.disk"]
disk:
args:
path: https://raw.githubusercontent.com/eerie-project/intake_catalogues/main/dkrz/disk/main.yaml
description: Use this catalog if you are working on Levante. This catalog contains
datasets for all raw data in /work/bm1344 and accesses the data via kerchunks
in /work/bm1344/DKRZ/kerchunks.
driver: intake.catalog.local.YAMLFileCatalog
metadata:
catalog_dir: https://raw.githubusercontent.com/eerie-project/intake_catalogues/main/dkrz
Tip
Note that there is the autocompletion feature catalogs when pushing tab.
For model-output stored on DKRZ’s disk, you can get a table-like overview from a “data base” csv file opened with pandas:
[8]:
data_base = eerie_cat["dkrz"]["disk"]["model-output"]["csv"].read()
# equivalent to
data_base = eerie_cat["dkrz.disk.model-output.csv"].read()
In the following, we display all unique values of each element of the catalog hierarchy:
[9]:
from IPython.display import display, Markdown
drs = "source_id.experiment_id.version.realm.grid_lable"
for c in drs.split("."):
display(Markdown(f"## Unique entries for *{c}*:"))
display(Markdown("- " + "\n- ".join(data_base[c].unique())))
Unique entries for source_id:#
icon-esm-er
ifs-fesom2-sr
ifs-amip-tco1279
ifs-amip-tco399
ifs-nemo
hadgem3-gc5-n640-orca12
hadgem3-gc5-n216-orca025
Unique entries for experiment_id:#
eerie-control-1950
eerie-spinup-1950
hist-1950
hist
hist-c-0-a-lr20
hist-c-0-a-lr30
hist-c-lr20-a-0
hist-c-lr30-a-0
hist-c-lr30-a-lr30
eerie-picontrol
Unique entries for version:#
v20231106
v20240618
v20240304
v20240901
v20231006
Not set
v20241010
Unique entries for realm:#
atmos
ocean
land
wave
Unique entries for grid_lable:#
gr025
native
gr1x1
Go to Browse with intake-esm to understand more about how to work with the dataframe data_base
.
Note that not all combinations of the DRS exist. For example, the ICON spinup run only has data on the native grid. You can use list
to explore the contents.
[10]:
list(eerie_cat["dkrz.disk.model-output.icon-esm-er.eerie-spinup-1950.v20240618.atmos"])
[10]:
['gr025', 'native']
See also the processing example for printing the full tree of a catalog
You can print a short description of each collection with its describe
function:
[11]:
for col in eerie_cat:
print(f"Description of {col}:")
print(eerie_cat[col].describe()["description"])
Description of jasmin:
This catalog contains datasets for EERIE stored on JASMIN
Description of dkrz:
This catalog contains datasets for EERIE stored on DKRZ
Datasets saved on DKRZ are in the DKRZ catalog:
[12]:
eerie_dkrz = eerie_cat["dkrz"]
for col in eerie_dkrz:
print(f"Description of {col}:")
print(eerie_dkrz[col].describe()["description"])
Description of disk:
Use this catalog if you are working on Levante. This catalog contains datasets for all raw data in /work/bm1344 and accesses the data via kerchunks in /work/bm1344/DKRZ/kerchunks.
Description of archive:
Only use this catalog if your desired data is not available on diks and needs to be retrieved from DKRZ's tape archive. This catalog contains datasets for archived data in /arch/bm1344
Description of cloud:
Use this catalog if you are NOT working on Levante. This catalog contains the same datasets as *dkrz_eerie_kerchunk* but data access is via the xpublish server *eerie.cloud.dkrz.de*
Description of main:
DKRZ master catalog for all /pool/data catalogs available
Description of dkrz_ngc3:
NextGEMs Cycle 3 data
The DKRZ catalogs distinguish between the storage location on DKRZ.
Note
If you are accessing the data from remote, you can use the cloud catalog. For accessing other data, you have to be logged in on DKRZ´s HPC.
[13]:
eerie_dkrz_disk = eerie_dkrz["disk"]
for col in eerie_dkrz_disk:
print(f"Description of {col}:")
print(eerie_dkrz_disk[col].describe()["description"])
Description of model-output:
EERIE Earth System Model output available on DKRZ's Levante File System. This catalog contains datasets for all raw data in /work/bm1344 and accesses the data via kerchunks in /work/bm1344/DKRZ/kerchunks
Description of observations:
This catalog contains observational data that is used for EERIE evaluation.
We continue to work with the eerie-dkrz-disk-model-output catalog to show how to
browse
open and load
subset
data.
[14]:
cat = eerie_dkrz_disk["model-output"]
list(cat)
[14]:
['icon-esm-er',
'ifs-fesom2-sr',
'ifs-amip-tco1279',
'ifs-amip-tco399',
'ifs-amip',
'ifs-nemo',
'hadgem3-gc5-n640-orca12',
'hadgem3-gc5-n216-orca025',
'csv',
'esm-json']
We have two options:
continue working with yaml files and the intake-xarray plugins (easier to load)
switching to intake-esm (easier to browse)
Browse#
With intake-esm#
We can use a json+csv from the intake catalog to generate an intake-esm catalog:
[15]:
import json
esmjson = json.loads("".join(cat["esm-json"].read()))
dkrz_disk_model_esm = intake.open_esm_datastore(
obj=dict(esmcat=esmjson, df=data_base),
columns_with_iterables=["variables", "variable-long_names", "urlpath"],
)
dkrz_disk_model_esm
dkrz-catalogue catalog with 284 dataset(s) from 346 asset(s):
unique | |
---|---|
format | 3 |
grid_id | 3 |
member_id | 1 |
institution_id | 2 |
institution | 3 |
references | 1 |
simulation_id | 5 |
variable-long_names | 103 |
variables | 113 |
source_id | 7 |
experiment_id | 10 |
version | 7 |
realm | 4 |
grid_lable | 3 |
aggregation | 73 |
urlpath | 338 |
derived_variables | 0 |
Intake-esm uses the data_base dataframe under the hood, accessible via .df
, which make things easier to browse through the catalog.
what query keywords do exist?
[16]:
dkrz_disk_model_esm.df.columns
[16]:
Index(['format', 'grid_id', 'member_id', 'institution_id', 'institution',
'references', 'simulation_id', 'variable-long_names', 'variables',
'source_id', 'experiment_id', 'version', 'realm', 'grid_lable',
'aggregation', 'urlpath'],
dtype='object')
Intake-esm uses a pandas dataframe under the hood which make things easier to browse through the catalog.
which models are available in the catalog?
[17]:
dkrz_disk_model_esm.unique()["source_id"]
[17]:
['icon-esm-er',
'ifs-fesom2-sr',
'ifs-amip-tco1279',
'ifs-amip-tco399',
'ifs-nemo',
'hadgem3-gc5-n640-orca12',
'hadgem3-gc5-n216-orca025']
Search with wild cards:
[18]:
subcat_esm = dkrz_disk_model_esm.search(
**{
"source_id": "icon-esm-er",
"experiment_id": "eerie-spinup-1950",
"grid_lable": "gr025",
"realm": "ocean",
"variable-long_names": "temperature*",
"aggregation": "monthly*",
}
)
subcat_esm
dkrz-catalogue catalog with 2 dataset(s) from 2 asset(s):
unique | |
---|---|
format | 1 |
grid_id | 1 |
member_id | 1 |
institution_id | 1 |
institution | 1 |
references | 1 |
simulation_id | 1 |
variable-long_names | 2 |
variables | 2 |
source_id | 1 |
experiment_id | 1 |
version | 1 |
realm | 1 |
grid_lable | 1 |
aggregation | 2 |
urlpath | 2 |
derived_variables | 0 |
Pure Intake#
Intake offers users a free text search field. We can search for example for the control run. Intake returns another catalog.
[19]:
searchdict = dict(
model="ICON",
realm="ocean",
exp="eerie-spinup-1950",
var="temperature",
frequency="monthly",
)
subcat = cat["icon-esm-er"]
for v in searchdict.values():
subcat = subcat.search(v)
list(subcat)
# note that `search` has a keyword argument *depth* (default: 2) which indicates how many subcatalogs should be searched.
# if you use a high level catalog, adapt that argument to your needs
[19]:
['eerie-spinup-1950.v20231106.ocean.native.model-level_monthly_mean',
'eerie-spinup-1950.v20240618.ocean.gr025.2d_monthly_mean',
'eerie-spinup-1950.v20240618.ocean.gr025.2d_monthly_square',
'eerie-spinup-1950.v20240618.ocean.native.2d_monthly_mean',
'eerie-spinup-1950.v20240618.ocean.native.2d_monthly_square',
'eerie-spinup-1950.v20240618.ocean.native.eddy_monthly_mean',
'eerie-spinup-1950.v20240618.ocean.native.model-level_monthly_mean']
Use the GUI:
[20]:
cat.gui