Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • catalog/ruby
1 result
Show changes
Commits on Source (18)
......@@ -95,3 +95,20 @@ simulations:
experiment: CMIP7 - historical
resolution: r2b5l130 atmos / r2b7 ocean
path: /work/mh0287/b364148/Icon/Git_lev/icon.nwp.hdext.intno/experiments/tvp1826_003
slo1834:
metadata:
contact: Stephan Lorenz
date_end: '1900-12-31'
date_start: '1700-01-01'
experiment: CMIP7 - PICTRL
resolution: r2b5l130 atmos / r2b7 ocean
path: /work/mh0287/m211032/Icon/Git_lev/icon.XPP.20240717/build.intel-hdext/experiments/slo1834
slo1835:
metadata:
contact: Stephan Lorenz
date_end: '1900-12-31'
date_start: '1700-01-01'
experiment: CMIP7 - PICTRL
resolution: r2b5l130 atmos / r2b7 ocean
path: /work/mh0287/m211032/Icon/Git_lev/icon.XPP.20240717/build.intel-hdext/experiments/slo1835
......@@ -50,7 +50,7 @@ simulations:
contact: Helmuth Haak
experiment: DRAGON - lowres
resolution: r2b5 atmos / r2b7 ocean
path: /work/mh0033/m211054/projects/icon/seamless/icon-2024.10/build_hdext/experiments/hel25019_r5b7_ctrl
path: /work/mh0033/m211054/projects/icon/seamless/icon-2024.10/build_hdext/experiments/hel25019_r5b7_ctrl/outdata
hel25020_r5b7_ctrl:
metadata:
contact: Helmuth Haak
......
......@@ -7,14 +7,6 @@ simulations:
experiment: HAMOCC - PICTRL
resolution: r2b4l90 atmos / r2b6 ocean
path: /work/uo1451/m300805/projects/seamless/icon-XPP-20240717/build.intel-hdint/experiments/FC001_XPPslo1774
FC04_XPPslo1802:
metadata:
contact: Fatemeh Chegini
date_end: '2384-12-31'
date_start: '2350-01-01'
experiment: HAMOCC - PICTRL
resolution: r2b5l130 atmos / r2b7 ocean
path: /work/uo1451/m300805/projects/seamless/icon-XPP-20240717/build.intel-hdext/experiments/FC04_XPPslo1802
slo1774:
metadata:
contact: Stephan Lorenz
......@@ -23,11 +15,3 @@ simulations:
experiment: CMIP7 - PICTRL
resolution: r2b4l90 atmos / r2b6 ocean
path: /work/mh0287/m211032/Icon/Git_lev/icon.XPP.20240717/build.intel-hdint/experiments/slo1774
slo1802:
metadata:
contact: Stephan Lorenz
date_end: '2299-12-31'
date_start: '1300-01-01'
experiment: PICTRL
resolution: r2b5l130 atmos / r2b7 ocean
path: /work/mh0287/m211032/Icon/Git_lev/icon.XPP.20240717/build.intel-hdext/experiments/slo1802
This diff is collapsed.
This diff is collapsed.
%% Cell type:code id: tags:
``` python
import pandas as pd
import yaml
```
%% Cell type:code id: tags:
``` python
df = pd.read_excel("../inputs/enso_tuning.xlsx", index_col=0)
df.loc[df["Remark"].isna(), "Remark"] = ""
```
%% Cell type:code id: tags:
``` python
always_add = {
"experiment": "coming decade - icon xpp enso tuning",
"contact": "Dakuan Yu",
}
always_copy = ["Remark", "Resolution"]
defaults = df.iloc[5]
defaults
runs = {}
for name, row in df.iloc[4:].iterrows():
runs[name] = dict(always_add)
if name == defaults.name:
runs[name] |= dict(
parameters={
k.lower(): v for k, v in row.items() if v and k not in always_copy
}
)
else:
runs[name] |= dict(parameters=dict(defaults=defaults.name))
for k, v in row.items():
if k in always_copy:
if v:
runs[name][k.lower()] = v
else:
if v != defaults[k]:
runs[name]["parameters"][k.lower()] = v
```
%% Cell type:code id: tags:
``` python
with open("../inputs/icon-xpp-enso.metadata", "w") as mdf:
yaml.dump(runs, mdf)
```
This diff is collapsed.
import xarray as xr
from typing import List
from pathlib import Path
from datetime import datetime
import logging
class BadDataset(RuntimeError):
pass
def open_nc(filename):
return xr.open_dataset(filename, use_cftime=True)
def fix_abs_datetime(broken_time):
if broken_time.attrs.get("units", None) == "day as %Y%m%d.%f":
time_as_string = f"{broken_time:08.0f}"
broken_time = datetime.strptime(time_as_string, "%Y%m%d").date()
try:
timestr = f"{broken_time:%Y-%m-%d}"
except Exception as e:
print(e, broken_time)
raise
return timestr
def get_start_end(files: List[Path]):
try:
first = open_nc(files[0])
start = first.time[0]
except AttributeError as e:
logging.warning(f" Cannot read start time from {files[0]}: {e}.")
return dict()
date_start = fix_abs_datetime(start)
try:
last = open_nc(files[-1])
end = last.time[-1]
date_end = fix_abs_datetime(end)
except IndexError:
logging.warning(
f" {files[-1]} has a broken time axis. Removing it from the list of inputs."
)
try:
last = open_nc(files[-2])
end = last.time[-1]
date_end = fix_abs_datetime(end)
del files[-1]
except IndexError:
raise BadDataset(f"Can't deduce times from {files}") from None
return dict(date_start=date_start, date_end=date_end)