Skip to content

Commit

Permalink
production push
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfiex committed Nov 17, 2024
1 parent 888f69b commit 2c0fe46
Show file tree
Hide file tree
Showing 294 changed files with 5,267 additions and 0 deletions.
Binary file added data_descriptors/.DS_Store
Binary file not shown.
Empty file added data_descriptors/.nojekyll
Empty file.
27 changes: 27 additions & 0 deletions data_descriptors/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Load JSON Key Display</title>
<link rel='stylesheet' href='https://bootswatch.com/5/sketchy/bootstrap.css'>
<style>
body { padding:10px; }
h2 { font-size:0.8rem; margin-left: 10px }
h3 { font-size:0.6rem; margin-left: 15px ; color:gray }
p { margin-left: 30px }
pre {border: none; padding:40px}
ul {padding-left: 40px}
</style>
</head>
<body>
<h1 id='title'>Data Descriptor</h1>
<div>
<code id="content"></code>
</div>

<script src='https://wcrp-cmip.github.io/CMIP-LD/static/404_restful.js'>

</script>
</body>
</html>
65 changes: 65 additions & 0 deletions data_descriptors/CLD2vIV.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import glob
import json
from collections import OrderedDict
import os
import subprocess





remote_url = subprocess.check_output(["git", "remote", "get-url", "origin"], text=True).strip()
user_repo = remote_url.split("github.com")[-1].replace(":", "/").replace(".git", "").strip("/")
pages_url = f"https://{user_repo.split('/')[0]}.github.io/{user_repo.split('/')[1]}"

# print(remote_url)
# print(user_repo)
# print(pages_url)
# https://github.com/WCRP-CMIP/WCRP-UNIVERSE.git
# WCRP-CMIP/WCRP-UNIVERSE
# https://WCRP-CMIP.github.io/WCRP-UNIVERSE


folders = glob.glob('*/')


for folder in folders:
print(folder)
files = glob.glob(folder + '*.json')
for file in files:
with open(file, 'r') as f:

js = json.load(f)

if '@type' not in js:
continue
js['id'] = file.split('/')[-1]
js['type'] = js['@type'].replace('-', '_')
js['@context'] = f'{pages_url}/data_descriptors/{folder}_context'
del js['@type'], js['@id']

js = OrderedDict(sorted(js.items()))


json.dump(js, open(file,'w') , indent=4)
# print(file)


# context new file
location = f"{pages_url}/data_descriptors/{folder}"
context = {

"@context": {
"@base": location,
"@vocab": location,
"id": "@id",
"type": "@type"
},
"@embed": "@always"
}

json.dump(context, open(f"{folder}_context.json", 'w'), indent=4)


os.system('rm -f ' + folder + '*.jsonld')

13 changes: 13 additions & 0 deletions data_descriptors/_globalcontext
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"@context": {
"id": "@id",
"type": "@type",
"wcrp-universe:": "https://WCRP-CMIP.github.io/WCRP-UNIVERSE/",
"mip-variables:": "https://WCRP-CMIP/github.io/MIPvariables/",
"cmip6plus:": "https://WCRP-CMIP.github.io/CMIP6Plus_CVs/",
"cmip7:": "https://WCRP-CMIP.github.io/CMIP7_CVs/",
"mip-cmor-tables:": "https://PCMDI.github.io/mip-cmor-tables/",
"cf": "https://WCRP-CMIP.github.io/WCRP-CMIP/CF/"
},
"@embed": "@always"
}
Binary file added data_descriptors/activity/.DS_Store
Binary file not shown.
15 changes: 15 additions & 0 deletions data_descriptors/activity/_context
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"@context": {
"@base": "https://wcrp-cmip.github.io/WCRP-UNIVERSE/activity/",
"@vocab": "https://wcrp-cmip.github.io/WCRP-UNIVERSE/activity/",
"id": "@id",
"type": "@type",
"cf": "https://WCRP-CMIP.github.io/WCRP-CMIP/CF/",
"cmip6plus:": "https://WCRP-CMIP.github.io/CMIP6Plus_CVs/",
"cmip7:": "https://WCRP-CMIP.github.io/CMIP7_CVs/",
"mip-cmor-tables:": "https://PCMDI.github.io/mip-cmor-tables/",
"mip-variables:": "https://WCRP-CMIP/github.io/MIPvariables/",
"wcrp-universe:": "https://WCRP-CMIP.github.io/WCRP-UNIVERSE/"
},
"@embed": "@always"
}
7 changes: 7 additions & 0 deletions data_descriptors/activity/cmip
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"@id": "cmip",
"@type": "activity",
"description": "CMIP DECK: 1pctCO2, abrupt4xCO2, amip, esm-piControl, esm-historical, historical, and piControl experiments",
"name": "CMIP",
"url": "https://gmd.copernicus.org/articles/9/1937/2016/gmd-9-1937-2016.pdf"
}
7 changes: 7 additions & 0 deletions data_descriptors/activity/cmip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"@id": "cmip",
"@type": "activity",
"description": "CMIP DECK: 1pctCO2, abrupt4xCO2, amip, esm-piControl, esm-historical, historical, and piControl experiments",
"name": "CMIP",
"url": "https://gmd.copernicus.org/articles/9/1937/2016/gmd-9-1937-2016.pdf"
}
30 changes: 30 additions & 0 deletions data_descriptors/activity/graph
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"@context": {
"@base": "https://wcrp-cmip.github.io/WCRP-UNIVERSE/activity/",
"@vocab": "https://wcrp-cmip.github.io/WCRP-UNIVERSE/activity/",
"id": "@id",
"type": "@type",
"cf": "https://WCRP-CMIP.github.io/WCRP-CMIP/CF/",
"cmip6plus:": "https://WCRP-CMIP.github.io/CMIP6Plus_CVs/",
"cmip7:": "https://WCRP-CMIP.github.io/CMIP7_CVs/",
"mip-cmor-tables:": "https://PCMDI.github.io/mip-cmor-tables/",
"mip-variables:": "https://WCRP-CMIP/github.io/MIPvariables/",
"wcrp-universe:": "https://WCRP-CMIP.github.io/WCRP-UNIVERSE/"
},
"@graph": [
{
"@id": "cmip",
"@type": "activity",
"description": "CMIP DECK: 1pctCO2, abrupt4xCO2, amip, esm-piControl, esm-historical, historical, and piControl experiments",
"name": "CMIP",
"url": "https://gmd.copernicus.org/articles/9/1937/2016/gmd-9-1937-2016.pdf"
},
{
"@id": "lesfmip",
"@type": "activity",
"description": "The Large Ensemble Single Forcing Model Intercomparison Project",
"name": "LESFMIP",
"url": "https://www.frontiersin.org/articles/10.3389/fclim.2022.955414/full"
}
]
}
30 changes: 30 additions & 0 deletions data_descriptors/activity/graph.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"@context": {
"@base": "https://wcrp-cmip.github.io/WCRP-UNIVERSE/activity/",
"@vocab": "https://wcrp-cmip.github.io/WCRP-UNIVERSE/activity/",
"id": "@id",
"type": "@type",
"cf": "https://WCRP-CMIP.github.io/WCRP-CMIP/CF/",
"cmip6plus:": "https://WCRP-CMIP.github.io/CMIP6Plus_CVs/",
"cmip7:": "https://WCRP-CMIP.github.io/CMIP7_CVs/",
"mip-cmor-tables:": "https://PCMDI.github.io/mip-cmor-tables/",
"mip-variables:": "https://WCRP-CMIP/github.io/MIPvariables/",
"wcrp-universe:": "https://WCRP-CMIP.github.io/WCRP-UNIVERSE/"
},
"@graph": [
{
"@id": "cmip",
"@type": "activity",
"description": "CMIP DECK: 1pctCO2, abrupt4xCO2, amip, esm-piControl, esm-historical, historical, and piControl experiments",
"name": "CMIP",
"url": "https://gmd.copernicus.org/articles/9/1937/2016/gmd-9-1937-2016.pdf"
},
{
"@id": "lesfmip",
"@type": "activity",
"description": "The Large Ensemble Single Forcing Model Intercomparison Project",
"name": "LESFMIP",
"url": "https://www.frontiersin.org/articles/10.3389/fclim.2022.955414/full"
}
]
}
1 change: 1 addition & 0 deletions data_descriptors/activity/graph.min
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"@context":{"@base":"https://wcrp-cmip.github.io/WCRP-UNIVERSE/activity/","@vocab":"https://wcrp-cmip.github.io/WCRP-UNIVERSE/activity/","id":"@id","type":"@type","cf":"https://WCRP-CMIP.github.io/WCRP-CMIP/CF/","cmip6plus:":"https://WCRP-CMIP.github.io/CMIP6Plus_CVs/","cmip7:":"https://WCRP-CMIP.github.io/CMIP7_CVs/","mip-cmor-tables:":"https://PCMDI.github.io/mip-cmor-tables/","mip-variables:":"https://WCRP-CMIP/github.io/MIPvariables/","wcrp-universe:":"https://WCRP-CMIP.github.io/WCRP-UNIVERSE/"},"@graph":[{"@id":"cmip","@type":"activity","description":"CMIP DECK: 1pctCO2, abrupt4xCO2, amip, esm-piControl, esm-historical, historical, and piControl experiments","name":"CMIP","url":"https://gmd.copernicus.org/articles/9/1937/2016/gmd-9-1937-2016.pdf"},{"@id":"lesfmip","@type":"activity","description":"The Large Ensemble Single Forcing Model Intercomparison Project","name":"LESFMIP","url":"https://www.frontiersin.org/articles/10.3389/fclim.2022.955414/full"}]}
1 change: 1 addition & 0 deletions data_descriptors/activity/graph.min.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"@context":{"@base":"https://wcrp-cmip.github.io/WCRP-UNIVERSE/activity/","@vocab":"https://wcrp-cmip.github.io/WCRP-UNIVERSE/activity/","id":"@id","type":"@type","cf":"https://WCRP-CMIP.github.io/WCRP-CMIP/CF/","cmip6plus:":"https://WCRP-CMIP.github.io/CMIP6Plus_CVs/","cmip7:":"https://WCRP-CMIP.github.io/CMIP7_CVs/","mip-cmor-tables:":"https://PCMDI.github.io/mip-cmor-tables/","mip-variables:":"https://WCRP-CMIP/github.io/MIPvariables/","wcrp-universe:":"https://WCRP-CMIP.github.io/WCRP-UNIVERSE/"},"@graph":[{"@id":"cmip","@type":"activity","description":"CMIP DECK: 1pctCO2, abrupt4xCO2, amip, esm-piControl, esm-historical, historical, and piControl experiments","name":"CMIP","url":"https://gmd.copernicus.org/articles/9/1937/2016/gmd-9-1937-2016.pdf"},{"@id":"lesfmip","@type":"activity","description":"The Large Ensemble Single Forcing Model Intercomparison Project","name":"LESFMIP","url":"https://www.frontiersin.org/articles/10.3389/fclim.2022.955414/full"}]}
7 changes: 7 additions & 0 deletions data_descriptors/activity/lesfmip
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"@id": "lesfmip",
"@type": "activity",
"description": "The Large Ensemble Single Forcing Model Intercomparison Project",
"name": "LESFMIP",
"url": "https://www.frontiersin.org/articles/10.3389/fclim.2022.955414/full"
}
7 changes: 7 additions & 0 deletions data_descriptors/activity/lesfmip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"@id": "lesfmip",
"@type": "activity",
"description": "The Large Ensemble Single Forcing Model Intercomparison Project",
"name": "LESFMIP",
"url": "https://www.frontiersin.org/articles/10.3389/fclim.2022.955414/full"
}
110 changes: 110 additions & 0 deletions data_descriptors/del.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"import glob\n",
"import json \n",
"from collections import OrderedDict"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"folders = glob.glob('*/')\n"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"mip_era/\n"
]
},
{
"ename": "KeyError",
"evalue": "'@type'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[13], line 8\u001b[0m\n\u001b[1;32m 6\u001b[0m js \u001b[38;5;241m=\u001b[39m json\u001b[38;5;241m.\u001b[39mload(f)\n\u001b[1;32m 7\u001b[0m js[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mid\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m file\u001b[38;5;241m.\u001b[39msplit(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m/\u001b[39m\u001b[38;5;124m'\u001b[39m)[\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m]\n\u001b[0;32m----> 8\u001b[0m js[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtype\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[43mjs\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m@type\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[1;32m 9\u001b[0m js[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m@context\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mhttps://wcrp-cmip.github.io/MIP_UNIVERSE/data_descriptors/\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mfolder\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m_context\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 10\u001b[0m \u001b[38;5;28;01mdel\u001b[39;00m js[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m@type\u001b[39m\u001b[38;5;124m'\u001b[39m], js[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m@id\u001b[39m\u001b[38;5;124m'\u001b[39m]\n",
"\u001b[0;31mKeyError\u001b[0m: '@type'"
]
}
],
"source": [
"for folder in folders:\n",
" print(folder)\n",
" files = glob.glob(folder + '*.json')\n",
" for file in files:\n",
" with open(file, 'r') as f:\n",
" \n",
" js = json.load(f)\n",
" \n",
" if '@type' in js: \n",
" continue\n",
" js['id'] = file.split('/')[-1]\n",
" js['type'] = js['@type']\n",
" js['@context'] = f'https://wcrp-cmip.github.io/MIP_UNIVERSE/data_descriptors/{folder}_context'\n",
" del js['@type'], js['@id']\n",
" \n",
" js = OrderedDict(sorted(js.items()))\n",
" \n",
" \n",
" json.dump(js, open(file,'w') , indent=4)\n",
" print(file)\n",
" \n",
" \n",
" \n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.10"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Binary file added data_descriptors/frequency/.DS_Store
Binary file not shown.
9 changes: 9 additions & 0 deletions data_descriptors/frequency/1hr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"@context": "https://wcrp-cmip.github.io/WCRP-UNIVERSE/frequency/_context",
"description": "sampled hourly",
"id": "1hr",
"long_name": "1 Hourly Frequency",
"name": "1hr",
"type": "frequency",
"unit": "hour"
}
9 changes: 9 additions & 0 deletions data_descriptors/frequency/1hr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"@context": "https://wcrp-cmip.github.io/WCRP-UNIVERSE/frequency/_context",
"description": "sampled hourly",
"id": "1hr",
"long_name": "1 Hourly Frequency",
"name": "1hr",
"type": "frequency",
"unit": "hour"
}
9 changes: 9 additions & 0 deletions data_descriptors/frequency/1hrcm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"@context": "https://wcrp-cmip.github.io/WCRP-UNIVERSE/frequency/_context",
"description": "monthly-mean diurnal cycle resolving each day into 1-hour means",
"id": "1hrcm",
"long_name": "1 Hour Climatology Monthly",
"name": "1hrCM",
"type": "frequency",
"unit": "hour"
}
9 changes: 9 additions & 0 deletions data_descriptors/frequency/1hrcm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"@context": "https://wcrp-cmip.github.io/WCRP-UNIVERSE/frequency/_context",
"description": "monthly-mean diurnal cycle resolving each day into 1-hour means",
"id": "1hrcm",
"long_name": "1 Hour Climatology Monthly",
"name": "1hrCM",
"type": "frequency",
"unit": "hour"
}
9 changes: 9 additions & 0 deletions data_descriptors/frequency/1hrpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"@context": "https://wcrp-cmip.github.io/WCRP-UNIVERSE/frequency/_context",
"description": "sampled hourly, at specified time point within an hour",
"id": "1hrpt",
"long_name": "1 Hour Point",
"name": "1hrPt",
"type": "frequency",
"unit": "hour"
}
Loading

0 comments on commit 2c0fe46

Please sign in to comment.