Skip to content

Commit b20997f

Browse files
authored
Merge pull request #55 from roocs/add-test-notebooks
added initial test notebooks
2 parents 3ccde37 + 42d1e0f commit b20997f

File tree

2 files changed

+289
-0
lines changed

2 files changed

+289
-0
lines changed
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "likely-dover",
6+
"metadata": {},
7+
"source": [
8+
"# Test: subset HadGEM3-GC31-LL/ssp245\n",
9+
"\n",
10+
"* Project: c3s-cmip6\n",
11+
"* Variable: tas\n",
12+
"* Frequency: day\n",
13+
"* *Complete* files"
14+
]
15+
},
16+
{
17+
"cell_type": "code",
18+
"execution_count": null,
19+
"id": "tribal-marshall",
20+
"metadata": {},
21+
"outputs": [],
22+
"source": [
23+
"import os\n",
24+
"os.environ['ROOK_URL'] = 'http://rook1.cloud.dkrz.de/wps'\n",
25+
"\n",
26+
"from rooki import operators as ops"
27+
]
28+
},
29+
{
30+
"cell_type": "code",
31+
"execution_count": null,
32+
"id": "funky-affiliate",
33+
"metadata": {},
34+
"outputs": [],
35+
"source": [
36+
"wf = ops.Subset(\n",
37+
" ops.Input(\n",
38+
" 'cmip6', ['c3s-cmip6.ScenarioMIP.MOHC.HadGEM3-GC31-LL.ssp245.r1i1p1f3.day.tas.gn.v20190908']\n",
39+
" ),\n",
40+
")\n",
41+
" "
42+
]
43+
},
44+
{
45+
"cell_type": "code",
46+
"execution_count": null,
47+
"id": "speaking-majority",
48+
"metadata": {},
49+
"outputs": [],
50+
"source": [
51+
"resp = wf.orchestrate()\n",
52+
"assert resp.ok"
53+
]
54+
},
55+
{
56+
"cell_type": "code",
57+
"execution_count": null,
58+
"id": "ceramic-remedy",
59+
"metadata": {},
60+
"outputs": [],
61+
"source": [
62+
"resp.download_urls()"
63+
]
64+
},
65+
{
66+
"cell_type": "code",
67+
"execution_count": null,
68+
"id": "obvious-reference",
69+
"metadata": {},
70+
"outputs": [],
71+
"source": [
72+
"assert 'tas_day_HadGEM3-GC31-LL_ssp245_r1i1p1f3_gn_20150101-20491230.nc' in resp.download_urls()[0]\n"
73+
]
74+
},
75+
{
76+
"cell_type": "code",
77+
"execution_count": null,
78+
"id": "sapphire-switzerland",
79+
"metadata": {},
80+
"outputs": [],
81+
"source": [
82+
"assert 'https://data.mips.copernicus-climate.eu/thredds/fileServer/esg_c3s-cmip6' in resp.download_urls()[0]"
83+
]
84+
},
85+
{
86+
"cell_type": "code",
87+
"execution_count": null,
88+
"id": "insured-supply",
89+
"metadata": {},
90+
"outputs": [],
91+
"source": [
92+
"assert resp.num_files == 2, resp.num_files"
93+
]
94+
},
95+
{
96+
"cell_type": "code",
97+
"execution_count": null,
98+
"id": "overall-halloween",
99+
"metadata": {},
100+
"outputs": [],
101+
"source": [
102+
"assert int(resp.size_in_mb) == 1684, resp.size_in_mb"
103+
]
104+
},
105+
{
106+
"cell_type": "markdown",
107+
"id": "breeding-tiger",
108+
"metadata": {},
109+
"source": [
110+
"Provenance: \n",
111+
"* expected duration=20 secs"
112+
]
113+
},
114+
{
115+
"cell_type": "code",
116+
"execution_count": null,
117+
"id": "coral-partition",
118+
"metadata": {},
119+
"outputs": [],
120+
"source": [
121+
"from IPython.display import Image\n",
122+
"Image(resp.provenance_image())"
123+
]
124+
}
125+
],
126+
"metadata": {
127+
"kernelspec": {
128+
"display_name": "Python 3",
129+
"language": "python",
130+
"name": "python3"
131+
},
132+
"language_info": {
133+
"codemirror_mode": {
134+
"name": "ipython",
135+
"version": 3
136+
},
137+
"file_extension": ".py",
138+
"mimetype": "text/x-python",
139+
"name": "python",
140+
"nbconvert_exporter": "python",
141+
"pygments_lexer": "ipython3",
142+
"version": "3.9.2"
143+
}
144+
},
145+
"nbformat": 4,
146+
"nbformat_minor": 5
147+
}
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "outer-velvet",
6+
"metadata": {},
7+
"source": [
8+
"# Test: subset c3s-cmip6 HadGEM3-GC31-LL/ssp585"
9+
]
10+
},
11+
{
12+
"cell_type": "code",
13+
"execution_count": null,
14+
"id": "latest-model",
15+
"metadata": {},
16+
"outputs": [],
17+
"source": [
18+
"import os\n",
19+
"os.environ['ROOK_URL'] = 'http://rook1.cloud.dkrz.de/wps'\n",
20+
"\n",
21+
"from rooki import operators as ops"
22+
]
23+
},
24+
{
25+
"cell_type": "code",
26+
"execution_count": null,
27+
"id": "nutritional-tender",
28+
"metadata": {},
29+
"outputs": [],
30+
"source": [
31+
"wf = ops.Subset(\n",
32+
" ops.Input(\n",
33+
" 'cmip6', ['c3s-cmip6.ScenarioMIP.MOHC.HadGEM3-GC31-LL.ssp585.r1i1p1f3.Amon.tas.gn.v20200114']\n",
34+
" ),\n",
35+
")\n",
36+
" "
37+
]
38+
},
39+
{
40+
"cell_type": "code",
41+
"execution_count": null,
42+
"id": "incoming-nicaragua",
43+
"metadata": {},
44+
"outputs": [],
45+
"source": [
46+
"resp = wf.orchestrate()\n",
47+
"assert resp.ok"
48+
]
49+
},
50+
{
51+
"cell_type": "code",
52+
"execution_count": null,
53+
"id": "occupational-publication",
54+
"metadata": {},
55+
"outputs": [],
56+
"source": [
57+
"resp.download_urls()"
58+
]
59+
},
60+
{
61+
"cell_type": "code",
62+
"execution_count": null,
63+
"id": "specified-pizza",
64+
"metadata": {},
65+
"outputs": [],
66+
"source": [
67+
"assert 'tas_Amon_HadGEM3-GC31-LL_ssp585_r1i1p1f3_gn_201501-204912.nc' in resp.download_urls()[0]\n"
68+
]
69+
},
70+
{
71+
"cell_type": "code",
72+
"execution_count": null,
73+
"id": "black-explosion",
74+
"metadata": {},
75+
"outputs": [],
76+
"source": [
77+
"assert 'https://data.mips.copernicus-climate.eu/thredds/fileServer/esg_c3s-cmip6' in resp.download_urls()[0]"
78+
]
79+
},
80+
{
81+
"cell_type": "code",
82+
"execution_count": null,
83+
"id": "novel-luther",
84+
"metadata": {},
85+
"outputs": [],
86+
"source": [
87+
"assert resp.num_files == 2, resp.num_files"
88+
]
89+
},
90+
{
91+
"cell_type": "code",
92+
"execution_count": null,
93+
"id": "iraqi-score",
94+
"metadata": {},
95+
"outputs": [],
96+
"source": [
97+
"assert int(resp.size_in_mb) == 55, resp.size_in_mb"
98+
]
99+
},
100+
{
101+
"cell_type": "markdown",
102+
"id": "further-period",
103+
"metadata": {},
104+
"source": [
105+
"Provenance: \n",
106+
"* expected duration=20 secs"
107+
]
108+
},
109+
{
110+
"cell_type": "code",
111+
"execution_count": null,
112+
"id": "integrated-coffee",
113+
"metadata": {},
114+
"outputs": [],
115+
"source": [
116+
"from IPython.display import Image\n",
117+
"Image(resp.provenance_image())"
118+
]
119+
}
120+
],
121+
"metadata": {
122+
"kernelspec": {
123+
"display_name": "Python 3",
124+
"language": "python",
125+
"name": "python3"
126+
},
127+
"language_info": {
128+
"codemirror_mode": {
129+
"name": "ipython",
130+
"version": 3
131+
},
132+
"file_extension": ".py",
133+
"mimetype": "text/x-python",
134+
"name": "python",
135+
"nbconvert_exporter": "python",
136+
"pygments_lexer": "ipython3",
137+
"version": "3.9.2"
138+
}
139+
},
140+
"nbformat": 4,
141+
"nbformat_minor": 5
142+
}

0 commit comments

Comments
 (0)