diff --git a/.github/workflows/update-cv.yaml b/.github/workflows/update-cv.yaml index 0f43609..f3b433a 100644 --- a/.github/workflows/update-cv.yaml +++ b/.github/workflows/update-cv.yaml @@ -42,23 +42,11 @@ jobs: python -m pip install --upgrade pip if [ -f requirements.txt ]; then pip install -r requirements.txt; fi pip install pre-commit - #pre-commit install - name: Update controlled vocabulary run: | - python scripts/createCORDEXCV.py - mv CORDEX_CV.json tables/Tables - - # - name: Commit CORDEX_CV.json - # run: | - # cd tables - # git config --global user.name "github-actions[bot]" - # (pre-commit run --all-files) || true - # git pull origin main - #git config --global user.email 'your-username@users.noreply.github.com' - #git commit Tables/CORDEX_CV.json -m "automated CV update" - #git status - #git push + python scripts/create-cv.py + mv CORDEX-CMIP6_CV.json tables/Tables - name: Check if there are any changes id: verify_diff @@ -73,6 +61,6 @@ jobs: git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" (pre-commit run --all-files) || true - git commit Tables/CORDEX_CV.json -m "automated CV update" + git commit Tables/CORDEX_CV.json -m "CV update" git status git push diff --git a/CORDEX_DRS.json b/CORDEX-CMIP6_DRS.json similarity index 100% rename from CORDEX_DRS.json rename to CORDEX-CMIP6_DRS.json diff --git a/CORDEX_activity_id.json b/CORDEX-CMIP6_activity_id.json similarity index 100% rename from CORDEX_activity_id.json rename to CORDEX-CMIP6_activity_id.json diff --git a/CORDEX_domain.json b/CORDEX-CMIP6_domain.json similarity index 100% rename from CORDEX_domain.json rename to CORDEX-CMIP6_domain.json diff --git a/CORDEX_domain_id.json b/CORDEX-CMIP6_domain_id.json similarity index 100% rename from CORDEX_domain_id.json rename to CORDEX-CMIP6_domain_id.json diff --git a/CORDEX_driving_institution_id.json b/CORDEX-CMIP6_driving_institution_id.json similarity index 100% rename from CORDEX_driving_institution_id.json rename to CORDEX-CMIP6_driving_institution_id.json diff --git a/CORDEX_driving_source_id.json b/CORDEX-CMIP6_driving_source_id.json similarity index 99% rename from CORDEX_driving_source_id.json rename to CORDEX-CMIP6_driving_source_id.json index fc2392f..7dc045f 100644 --- a/CORDEX_driving_source_id.json +++ b/CORDEX-CMIP6_driving_source_id.json @@ -680,13 +680,6 @@ "driving_source_id": "IPSL-CM6A-LR-INCA", "driving_source": "IPSL-CM6A-LR-INCA (2019): \naerosol: INCA v6 AER\natmos: LMDZ (NPv6 ; 144 x 143 longitude/latitude; 79 levels; top level 80000 m)\natmosChem: none\nland: ORCHIDEE (v2.0, Water/Carbon/Energy mode)\nlandIce: none\nocean: NEMO-OPA (eORCA1.3, tripolar primarily 1deg; 362 x 332 longitude/latitude; 75 levels; top grid cell 0-2 m)\nocnBgchem: NEMO-PISCES\nseaIce: NEMO-LIM3" }, - "IPSL-CM6A-MR025": { - "driving_institution_id": [ - "IPSL" - ], - "driving_source_id": "IPSL-CM6A-MR025", - "driving_source": "IPSL-CM6A-MR025 (2021): \naerosol: none\natmos: LMDZ (NPv6; 256 x 256 longitude/latitude; 79 levels; top level 80000 m)\natmosChem: none\nland: ORCHIDEE (v2.2, Water/Carbon/Energy mode; same grid as atmos)\nlandIce: none\nocean: NEMO-OPA (eORCA025, tripolar primarily 0.25deg; 1442 x 1207 longitude/latitude; 75 levels; top grid cell 0-2 m)\nocnBgchem: none\nseaIce: NEMO-LIM3 (same grid as ocean)" - }, "IPSL-CM6A-MR1": { "driving_institution_id": [ "IPSL" diff --git a/CORDEX_experiment_id.json b/CORDEX-CMIP6_experiment_id.json similarity index 100% rename from CORDEX_experiment_id.json rename to CORDEX-CMIP6_experiment_id.json diff --git a/CORDEX_frequency.json b/CORDEX-CMIP6_frequency.json similarity index 100% rename from CORDEX_frequency.json rename to CORDEX-CMIP6_frequency.json diff --git a/CORDEX_institution_id.json b/CORDEX-CMIP6_institution_id.json similarity index 100% rename from CORDEX_institution_id.json rename to CORDEX-CMIP6_institution_id.json diff --git a/CORDEX_license.json b/CORDEX-CMIP6_license.json similarity index 100% rename from CORDEX_license.json rename to CORDEX-CMIP6_license.json diff --git a/CORDEX_native_resolution.json b/CORDEX-CMIP6_native_resolution.json similarity index 100% rename from CORDEX_native_resolution.json rename to CORDEX-CMIP6_native_resolution.json diff --git a/CORDEX_project_id.json b/CORDEX-CMIP6_project_id.json similarity index 100% rename from CORDEX_project_id.json rename to CORDEX-CMIP6_project_id.json diff --git a/CORDEX_realm.json b/CORDEX-CMIP6_realm.json similarity index 100% rename from CORDEX_realm.json rename to CORDEX-CMIP6_realm.json diff --git a/CORDEX_required_global_attributes.json b/CORDEX-CMIP6_required_global_attributes.json similarity index 100% rename from CORDEX_required_global_attributes.json rename to CORDEX-CMIP6_required_global_attributes.json diff --git a/CORDEX_source_id.json b/CORDEX-CMIP6_source_id.json similarity index 100% rename from CORDEX_source_id.json rename to CORDEX-CMIP6_source_id.json diff --git a/CORDEX_source_type.json b/CORDEX-CMIP6_source_type.json similarity index 100% rename from CORDEX_source_type.json rename to CORDEX-CMIP6_source_type.json diff --git a/CORDEX_table_id.json b/CORDEX-CMIP6_table_id.json similarity index 100% rename from CORDEX_table_id.json rename to CORDEX-CMIP6_table_id.json diff --git a/CORDEX_grid_label.json b/CORDEX_grid_label.json deleted file mode 100644 index d5363bd..0000000 --- a/CORDEX_grid_label.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "grid_label": { - "gm": "global mean data", - "gn": "data reported on a model's native grid", - "gna": "data reported on a native grid in the region of Antarctica", - "gng": "data reported on a native grid in the region of Greenland", - "gnz": "zonal mean data reported on a model's native latitude grid", - "gr": "regridded data reported on the data provider's preferred target grid", - "gr1": "regridded data reported on a grid other than the native grid and other than the preferred target grid", - "gr1a": "regridded data reported in the region of Antarctica on a grid other than the native grid and other than the preferred target grid", - "gr1g": "regridded data reported in the region of Greenland on a grid other than the native grid and other than the preferred target grid", - "gr1z": "regridded zonal mean data reported on a grid other than the native latitude grid and other than the preferred latitude target grid", - "gr2": "regridded data reported on a grid other than the native grid and other than the preferred target grid", - "gr2a": "regridded data reported in the region of Antarctica on a grid other than the native grid and other than the preferred target grid", - "gr2g": "regridded data reported in the region of Greenland on a grid other than the native grid and other than the preferred target grid", - "gr2z": "regridded zonal mean data reported on a grid other than the native latitude grid and other than the preferred latitude target grid", - "gr3": "regridded data reported on a grid other than the native grid and other than the preferred target grid", - "gr3a": "regridded data reported in the region of Antarctica on a grid other than the native grid and other than the preferred target grid", - "gr3g": "regridded data reported in the region of Greenland on a grid other than the native grid and other than the preferred target grid", - "gr3z": "regridded zonal mean data reported on a grid other than the native latitude grid and other than the preferred latitude target grid", - "gr4": "regridded data reported on a grid other than the native grid and other than the preferred target grid", - "gr4a": "regridded data reported in the region of Antarctica on a grid other than the native grid and other than the preferred target grid", - "gr4g": "regridded data reported in the region of Greenland on a grid other than the native grid and other than the preferred target grid", - "gr4z": "regridded zonal mean data reported on a grid other than the native latitude grid and other than the preferred latitude target grid", - "gr5": "regridded data reported on a grid other than the native grid and other than the preferred target grid", - "gr5a": "regridded data reported in the region of Antarctica on a grid other than the native grid and other than the preferred target grid", - "gr5g": "regridded data reported in the region of Greenland on a grid other than the native grid and other than the preferred target grid", - "gr5z": "regridded zonal mean data reported on a grid other than the native latitude grid and other than the preferred latitude target grid", - "gr6": "regridded data reported on a grid other than the native grid and other than the preferred target grid", - "gr6a": "regridded data reported in the region of Antarctica on a grid other than the native grid and other than the preferred target grid", - "gr6g": "regridded data reported in the region of Greenland on a grid other than the native grid and other than the preferred target grid", - "gr6z": "regridded zonal mean data reported on a grid other than the native latitude grid and other than the preferred latitude target grid", - "gr7": "regridded data reported on a grid other than the native grid and other than the preferred target grid", - "gr7a": "regridded data reported in the region of Antarctica on a grid other than the native grid and other than the preferred target grid", - "gr7g": "regridded data reported in the region of Greenland on a grid other than the native grid and other than the preferred target grid", - "gr7z": "regridded zonal mean data reported on a grid other than the native latitude grid and other than the preferred latitude target grid", - "gr8": "regridded data reported on a grid other than the native grid and other than the preferred target grid", - "gr8a": "regridded data reported in the region of Antarctica on a grid other than the native grid and other than the preferred target grid", - "gr8g": "regridded data reported in the region of Greenland on a grid other than the native grid and other than the preferred target grid", - "gr8z": "regridded zonal mean data reported on a grid other than the native latitude grid and other than the preferred latitude target grid", - "gr9": "regridded data reported on a grid other than the native grid and other than the preferred target grid", - "gr9a": "regridded data reported in the region of Antarctica on a grid other than the native grid and other than the preferred target grid", - "gr9g": "regridded data reported in the region of Greenland on a grid other than the native grid and other than the preferred target grid", - "gr9z": "regridded zonal mean data reported on a grid other than the native latitude grid and other than the preferred latitude target grid", - "gra": "regridded data in the region of Antarctica reported on the data provider's preferred target grid", - "grg": "regridded data in the region of Greenland reported on the data provider's preferred target grid", - "grz": "regridded zonal mean data reported on the data provider's preferred latitude target grid" - } -} diff --git a/docs/CORDEX_institution_id.html b/docs/CORDEX_institution_id.html deleted file mode 100644 index 4621da6..0000000 --- a/docs/CORDEX_institution_id.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - -WCRP-CORDEX CORDEX-CMIP6 CV institution_id - - - -

WCRP-CORDEX CORDEX-CMIP6 CV institution_id

Registered institutions. This is a test page.

- - - - - - - - - - - - - - - - - - - -
institution_idinstitution
GERICSClimate Service Center Germany, Helmholtz Centre hereon GmbH, Fischertwiete 1, 20095 Hamburg, Germany
UCANInstituto de Fisica de Cantabria (IFCA), CSIC-Universidad de Cantabria, 39005 Santander, Spain
- - diff --git a/docs/CORDEX_source_id.html b/docs/CORDEX_source_id.html deleted file mode 100644 index aa1cd29..0000000 --- a/docs/CORDEX_source_id.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - -WCRP-CORDEX CORDEX-CMIP6 CV source_id - - - -

WCRP-CORDEX CORDEX-CMIP6 CV source_id

Registered models and license. This is a test page.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
source_idlabelrelease_yearinstitution_idactivity_participationcohortlicense
REMO2020REMO20202022GERICSCORDEXRegisteredCreative Commons Attribution 4.0 International License (CC BY 4.0; https://creativecommons.org/licenses/by/4.0/).
WRF442QWRF-v4.4.2-Q2022AUTH, BCCR, UCANCORDEXRegisteredCreative Commons Attribution 4.0 International License (CC BY 4.0; https://creativecommons.org/licenses/by/4.0/).
- - diff --git a/docs/CORDEX_source_id_components.html b/docs/CORDEX_source_id_components.html deleted file mode 100644 index 82f112e..0000000 --- a/docs/CORDEX_source_id_components.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - -WCRP-CORDEX CORDEX-CMIP6 CV model components - - - -

WCRP-CORDEX CORDEX-CMIP6 CV model components

Registered models with components. This is a test page.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
source_idlabelrelease_yearinstitution_idaerosolatmosatmosChemlandlandIceoceanlakeocnBgchemseaIce
REMO2020REMO20202022GERICSMACv2dynamicnonenonenoneprescribedFLakenonenone
WRF442QWRF-v4.4.2-Q2022AUTH, BCCR, UCANprescribeddynamicnoneNOAH-MPnoneprescribednonenonenone
- - diff --git a/scripts/common.py b/scripts/common.py index 09bd503..1a5e757 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -12,7 +12,7 @@ table_dir = op.join(op.dirname(op.dirname(__file__)), "Tables") -table_prefix = "CORDEX" +table_prefix = "CORDEX-CMIP6" def read_json_url(url): diff --git a/scripts/createCORDEXCV.py b/scripts/create-cv.py similarity index 76% rename from scripts/createCORDEXCV.py rename to scripts/create-cv.py index 0325d27..ced0982 100644 --- a/scripts/createCORDEXCV.py +++ b/scripts/create-cv.py @@ -3,28 +3,27 @@ import urllib.request from collections import OrderedDict +from common import table_prefix + # List of files needed from github for CORDEX CV # --------------------------------------------- filelist = [ - "CORDEX_required_global_attributes.json", - "CORDEX_activity_id.json", - "CORDEX_project_id.json", - "CORDEX_domain_id.json", - "CORDEX_domain.json", - "CORDEX_institution_id.json", - "CORDEX_driving_source_id.json", - "CORDEX_source_id.json", - "CORDEX_source_type.json", - "CORDEX_frequency.json", - "CORDEX_grid_label.json", - # "CORDEX_native_resolution.json", - "CORDEX_realm.json", - "CORDEX_table_id.json", - # "CORDEX_license.json", - "CORDEX_DRS.json", + f"{table_prefix}_required_global_attributes.json", + f"{table_prefix}_activity_id.json", + f"{table_prefix}_project_id.json", + f"{table_prefix}_domain_id.json", + f"{table_prefix}_domain.json", + f"{table_prefix}_institution_id.json", + f"{table_prefix}_driving_source_id.json", + f"{table_prefix}_source_id.json", + f"{table_prefix}_source_type.json", + f"{table_prefix}_frequency.json", + f"{table_prefix}_native_resolution.json", + f"{table_prefix}_realm.json", + f"{table_prefix}_license.json", + f"{table_prefix}_DRS.json", + f"{table_prefix}_experiment_id.json", "mip_era.json", - # "CORDEX_driving_experiment_id.json", - "CORDEX_experiment_id.json", ] # Github repository with CORDEX related Control Vocabulary files # ------------------------------------------------------------- @@ -103,11 +102,11 @@ def readGit(self): with urllib.request.urlopen(req) as response: urlJson = response.read().decode() myjson = json.loads(urlJson, object_pairs_hook=OrderedDict) - if file == "CORDEX_source_id.json": + if file == f"{table_prefix}_source_id.json": self.createSource(myjson) - if file == "CORDEX_experiment_id.json": + if file == f"{table_prefix}_experiment_id.json": self.createExperimentID(myjson) - if file == "CORDEX_license.json": + if file == "{table_prefix}_license.json": self.createLicense(myjson) Dico.update(myjson) @@ -124,18 +123,18 @@ def run(): regexp["mip_era"] = ["CMIP6"] regexp["product"] = ["model-output"] regexp["tracking_id"] = ["hdl:21.14100/.*"] - regexp["further_info_url"] = ["https://furtherinfo.es-doc.org/.*"] - regexp["realization_index"] = ["^\\[\\{0,\\}[[:digit:]]\\{1,\\}\\]\\{0,\\}$"] + # regexp["further_info_url"] = ["https://furtherinfo.es-doc.org/.*"] + # regexp["realization_index"] = ["^\\[\\{0,\\}[[:digit:]]\\{1,\\}\\]\\{0,\\}$"] regexp["variant_label"] = [ "r[[:digit:]]\\{1,\\}i[[:digit:]]\\{1,\\}p[[:digit:]]\\{1,\\}f[[:digit:]]\\{1,\\}$" ] - regexp["data_specs_version"] = [ - "^[[:digit:]]\\{2,2\\}\\.[[:digit:]]\\{2,2\\}\\.[[:digit:]]\\{2,2\\}$" - ] + # regexp["data_specs_version"] = [ + # "^[[:digit:]]\\{2,2\\}\\.[[:digit:]]\\{2,2\\}\\.[[:digit:]]\\{2,2\\}$" + # ] regexp["Conventions"] = ["^CF-1.7 CMIP-6.[0-2]\\( UGRID-1.0\\)\\{0,\\}$"] - regexp["forcing_index"] = ["^\\[\\{0,\\}[[:digit:]]\\{1,\\}\\]\\{0,\\}$"] - regexp["initialization_index"] = ["^\\[\\{0,\\}[[:digit:]]\\{1,\\}\\]\\{0,\\}$"] - regexp["physics_index"] = ["^\\[\\{0,\\}[[:digit:]]\\{1,\\}\\]\\{0,\\}$"] + # regexp["forcing_index"] = ["^\\[\\{0,\\}[[:digit:]]\\{1,\\}\\]\\{0,\\}$"] + # regexp["initialization_index"] = ["^\\[\\{0,\\}[[:digit:]]\\{1,\\}\\]\\{0,\\}$"] + # regexp["physics_index"] = ["^\\[\\{0,\\}[[:digit:]]\\{1,\\}\\]\\{0,\\}$"] CV["CV"].update(regexp) for exp in CV["CV"]["experiment_id"]: diff --git a/scripts/create-domain_id.py b/scripts/create-domain_id.py index 0563fa7..6051fb0 100644 --- a/scripts/create-domain_id.py +++ b/scripts/create-domain_id.py @@ -1,12 +1,19 @@ import pandas as pd -from common import domain_table_url, write_json +from common import domain_table_url, table_prefix, write_json def create_domain_id_table(): + """Create domain_id CV from cordex domain table + + Creates CV from domains in table: + "https://raw.githubusercontent.com/WCRP-CORDEX/domain-tables/ + main/rotated-latitude-longitude.csv" + + """ df = pd.read_csv(domain_table_url, index_col="domain_id") df["domain_id"] = df.index text = {"domain_id": df[["domain", "domain_id"]].to_dict(orient="index")} - write_json(text, "CORDEX_domain_id.json") + write_json(text, f"{table_prefix}_domain_id.json") if __name__ == "__main__": diff --git a/scripts/create-driving-source.py b/scripts/create-driving-source.py index bbea3a9..fd93cc3 100644 --- a/scripts/create-driving-source.py +++ b/scripts/create-driving-source.py @@ -1,13 +1,7 @@ -from common import CMIP6_CV_URL, read_json_url, write_json +from common import CMIP6_CV_URL, read_json_url, table_prefix, write_json def create_driving_source_attrs(cmip6_source_id): - """Create CORDEX driving source id from CMIP6 source_id - - Takes the original CMIP6 source id, takes and renames - some attributes for use as driving_source_id in CORDEX. - - """ keep_rename = { "institution_id": "driving_institution_id", "source_id": "driving_source_id", @@ -32,12 +26,18 @@ def era5_driving_source_id(): def create_driving_source_id(): + """Create CORDEX driving source id from CMIP6 source_id + + Takes the original CMIP6 source id, takes and renames + some attributes for use as driving_source_id in CORDEX. + + """ cmip6_cv = read_json_url(CMIP6_CV_URL) driving_source_id = dict( driving_source_id=create_driving_source_attrs(cmip6_cv["CV"]["source_id"]) ) driving_source_id["driving_source_id"]["ECMWF-ERA5"] = era5_driving_source_id() - return write_json(driving_source_id, "CORDEX_driving_source_id.json") + return write_json(driving_source_id, f"{table_prefix}_driving_source_id.json") if __name__ == "__main__": diff --git a/scripts/create-html-datatables.py b/scripts/create-html-datatables.py index c0f98b2..3a0d27a 100644 --- a/scripts/create-html-datatables.py +++ b/scripts/create-html-datatables.py @@ -1,6 +1,7 @@ import json import pandas as pd +from common import table_prefix def addtag(word, field): @@ -188,8 +189,8 @@ def json2datatable( if __name__ == "__main__": for cv in ["source_id", "institution_id"]: json2datatable( - f"../CORDEX_{cv}.json", - f"../docs/CORDEX_{cv}.html", + f"../{table_prefix}_{cv}.json", + f"../docs/{table_prefix}_{cv}.html", cv, columns=datatable_columns[cv], is_1d=is_1d[cv], @@ -197,8 +198,8 @@ def json2datatable( intro=text[cv], ) json2datatable( - "../CORDEX_source_id.json", - "../docs/CORDEX_source_id_components.html", + f"../{table_prefix}_source_id.json", + f"../docs/{table_prefix}_source_id_components.html", "source_id", columns=datatable_columns["source_id_components"], linearize_columns=["model_component"],