Skip to content

Commit 6b9fc83

Browse files
authored
More templates (#8)
* add seasonal forecast * cleanup * renaming
1 parent 2ab8fea commit 6b9fc83

7 files changed

+532
-31
lines changed

notebooks/01-Application_Template_ERA5.ipynb renamed to notebooks/01-Application_Template_Overview.ipynb

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
"id": "ae8bf7b2",
77
"metadata": {},
88
"source": [
9-
"## APPLICATION TEMPLATE ERA5 - GLOBAL DAILY MEAN TEMPERATURE\n",
9+
"## APPLICATION TEMPLATE OVERVIEW - GLOBAL DAILY MEAN TEMPERATURE\n",
1010
"\n",
11-
"package c3s_eqc_automatic_quality_control (https://github.com/bopen/c3s-eqc-automatic-quality-control)"
11+
"Templates are built upon `c3s_eqc_automatic_quality_control` (https://github.com/bopen/c3s-eqc-automatic-quality-control)"
1212
]
1313
},
1414
{
@@ -63,11 +63,12 @@
6363
]
6464
},
6565
{
66+
"attachments": {},
6667
"cell_type": "markdown",
6768
"id": "29a64fdc",
6869
"metadata": {},
6970
"source": [
70-
"For request definition we use **`c3s_eqc_toolbox_template.update_request_date`**.\n",
71+
"For request definition we use **`download.update_request_date`**.\n",
7172
"\n",
7273
"It allows to generate the requests for a given period `[start, stop]` if stop is `None` then compute the stop month as follows:\n",
7374
"if `current day > switch_month_day`: then `stop_month = current_month - 1`\n",
@@ -117,24 +118,25 @@
117118
]
118119
},
119120
{
121+
"attachments": {},
120122
"cell_type": "markdown",
121123
"id": "df75d54b",
122124
"metadata": {},
123125
"source": [
124126
"The processing will be perform as follows:\n",
125127
"\n",
126-
"**Definition of the transformation `f`** to be applied to each single chunk\n",
128+
"**Definition of the transformation function `transform_func`** to be applied to each single chunk\n",
127129
"\n",
128130
"**Chunk definition**: define how to chunk the request along time dimension (year, month, day):\n",
129-
"e.g. `chunks={\"year\": 1,\"month\": 1}`\n",
131+
"e.g. `chunks={\"year\": 1,\"month\": 1}`. Alternatively, use `split_all=True` to chunk as much as possible.\n",
130132
"\n",
131133
"**Download and processing**: for each chunk in time\n",
132134
"\n",
133135
"```\n",
134136
"- Download chunk\n",
135137
"- Cache the downloaded chunk (optional)\n",
136-
"- Apply the operation `f` to the chunk\n",
137-
"- Cache transformed chunk, `f(chunks)` (optional)\n",
138+
"- Apply the operation `transform_func` to the chunk\n",
139+
"- Cache transformed chunk, `transform_func(chunks)` (optional)\n",
138140
"```\n",
139141
"\n",
140142
"Merge all the transformed chunk"
@@ -231,6 +233,15 @@
231233
"fig.show()"
232234
]
233235
},
236+
{
237+
"attachments": {},
238+
"cell_type": "markdown",
239+
"id": "84465449",
240+
"metadata": {},
241+
"source": [
242+
"#### Save figure"
243+
]
244+
},
234245
{
235246
"cell_type": "code",
236247
"execution_count": null,

notebooks/Deliverables/C-In_situ_ungridded.ipynb renamed to notebooks/in_situ/01-Application_Template_Global_Timeseries_Ungridded.ipynb

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
{
22
"cells": [
3+
{
4+
"attachments": {},
5+
"cell_type": "markdown",
6+
"metadata": {},
7+
"source": [
8+
"# Ungridded In Situ: Global timeseries"
9+
]
10+
},
11+
{
12+
"attachments": {},
13+
"cell_type": "markdown",
14+
"metadata": {},
15+
"source": [
16+
"## Import libraries\n",
17+
"\n",
18+
"Switch warnings off for better readability."
19+
]
20+
},
321
{
422
"cell_type": "code",
523
"execution_count": null,
@@ -15,6 +33,14 @@
1533
"warnings.filterwarnings(\"ignore\")"
1634
]
1735
},
36+
{
37+
"attachments": {},
38+
"cell_type": "markdown",
39+
"metadata": {},
40+
"source": [
41+
"## Define request"
42+
]
43+
},
1844
{
1945
"cell_type": "code",
2046
"execution_count": null,
@@ -30,6 +56,14 @@
3056
"stop = \"2020-01\""
3157
]
3258
},
59+
{
60+
"attachments": {},
61+
"cell_type": "markdown",
62+
"metadata": {},
63+
"source": [
64+
"## Generate requests"
65+
]
66+
},
3367
{
3468
"cell_type": "code",
3569
"execution_count": null,
@@ -39,6 +73,18 @@
3973
"requests = download.update_request_date(request, start=start, stop=stop)"
4074
]
4175
},
76+
{
77+
"attachments": {},
78+
"cell_type": "markdown",
79+
"metadata": {},
80+
"source": [
81+
"## Define transform function:\n",
82+
"\n",
83+
"1. Convert timestamp to datetime\n",
84+
"1. Rename variables using station names\n",
85+
"1. Compute chunk mean and std"
86+
]
87+
},
4288
{
4389
"cell_type": "code",
4490
"execution_count": null,
@@ -62,6 +108,14 @@
62108
" return xr.merge(dataarrays)"
63109
]
64110
},
111+
{
112+
"attachments": {},
113+
"cell_type": "markdown",
114+
"metadata": {},
115+
"source": [
116+
"## Compute monthly mean and std timeseries"
117+
]
118+
},
65119
{
66120
"cell_type": "code",
67121
"execution_count": null,
@@ -76,6 +130,14 @@
76130
")"
77131
]
78132
},
133+
{
134+
"attachments": {},
135+
"cell_type": "markdown",
136+
"metadata": {},
137+
"source": [
138+
"## Plot and save figure"
139+
]
140+
},
79141
{
80142
"cell_type": "code",
81143
"execution_count": null,
@@ -92,13 +154,6 @@
92154
"fig.show()\n",
93155
"fig.write_image(filename + \".png\")"
94156
]
95-
},
96-
{
97-
"cell_type": "code",
98-
"execution_count": null,
99-
"metadata": {},
100-
"outputs": [],
101-
"source": []
102157
}
103158
],
104159
"metadata": {

notebooks/Deliverables/D-In_situ_gridded.ipynb renamed to notebooks/in_situ/02-Application_Template_Global_Timeseries_Gridded.ipynb

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
{
22
"cells": [
3+
{
4+
"attachments": {},
5+
"cell_type": "markdown",
6+
"metadata": {},
7+
"source": [
8+
"# Gridded In Situ: Global timeseries"
9+
]
10+
},
11+
{
12+
"attachments": {},
13+
"cell_type": "markdown",
14+
"metadata": {},
15+
"source": [
16+
"## Import libraries\n",
17+
"\n",
18+
"Switch warnings off for better readability."
19+
]
20+
},
321
{
422
"cell_type": "code",
523
"execution_count": null,
@@ -13,6 +31,14 @@
1331
"warnings.filterwarnings(\"ignore\")"
1432
]
1533
},
34+
{
35+
"attachments": {},
36+
"cell_type": "markdown",
37+
"metadata": {},
38+
"source": [
39+
"## Define request"
40+
]
41+
},
1642
{
1743
"cell_type": "code",
1844
"execution_count": null,
@@ -30,6 +56,14 @@
3056
"}"
3157
]
3258
},
59+
{
60+
"attachments": {},
61+
"cell_type": "markdown",
62+
"metadata": {},
63+
"source": [
64+
"## Compute spatially-weighted global mean timeseries"
65+
]
66+
},
3367
{
3468
"cell_type": "code",
3569
"execution_count": null,
@@ -44,6 +78,14 @@
4478
")"
4579
]
4680
},
81+
{
82+
"attachments": {},
83+
"cell_type": "markdown",
84+
"metadata": {},
85+
"source": [
86+
"## Compute spatially-weighted global std timeseries"
87+
]
88+
},
4789
{
4890
"cell_type": "code",
4991
"execution_count": null,
@@ -58,6 +100,14 @@
58100
")"
59101
]
60102
},
103+
{
104+
"attachments": {},
105+
"cell_type": "markdown",
106+
"metadata": {},
107+
"source": [
108+
"## Plot and save figure"
109+
]
110+
},
61111
{
62112
"cell_type": "code",
63113
"execution_count": null,

notebooks/Deliverables/A-Reanalysis_single_level.ipynb renamed to notebooks/renalysis/01-Application_Template_Global_Timeseries_Single_Level.ipynb

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,17 @@
55
"cell_type": "markdown",
66
"metadata": {},
77
"source": [
8-
"# Reanalysis single level: Global timeseries"
8+
"# Single Level Reanalysis: Global timeseries"
9+
]
10+
},
11+
{
12+
"attachments": {},
13+
"cell_type": "markdown",
14+
"metadata": {},
15+
"source": [
16+
"## Import libraries\n",
17+
"\n",
18+
"Switch warnings off for better readability."
919
]
1020
},
1121
{
@@ -21,6 +31,14 @@
2131
"warnings.filterwarnings(\"ignore\")"
2232
]
2333
},
34+
{
35+
"attachments": {},
36+
"cell_type": "markdown",
37+
"metadata": {},
38+
"source": [
39+
"## Define request"
40+
]
41+
},
2442
{
2543
"cell_type": "code",
2644
"execution_count": null,
@@ -38,6 +56,14 @@
3856
"stop = None"
3957
]
4058
},
59+
{
60+
"attachments": {},
61+
"cell_type": "markdown",
62+
"metadata": {},
63+
"source": [
64+
"## Generate requests"
65+
]
66+
},
4167
{
4268
"cell_type": "code",
4369
"execution_count": null,
@@ -47,6 +73,14 @@
4773
"requests = download.update_request_date(request, start=start, stop=stop)"
4874
]
4975
},
76+
{
77+
"attachments": {},
78+
"cell_type": "markdown",
79+
"metadata": {},
80+
"source": [
81+
"## Compute spatially-weighted global mean timeseries"
82+
]
83+
},
5084
{
5185
"cell_type": "code",
5286
"execution_count": null,
@@ -61,6 +95,14 @@
6195
")"
6296
]
6397
},
98+
{
99+
"attachments": {},
100+
"cell_type": "markdown",
101+
"metadata": {},
102+
"source": [
103+
"## Compute spatially-weighted global std timeseries"
104+
]
105+
},
64106
{
65107
"cell_type": "code",
66108
"execution_count": null,
@@ -75,6 +117,14 @@
75117
")"
76118
]
77119
},
120+
{
121+
"attachments": {},
122+
"cell_type": "markdown",
123+
"metadata": {},
124+
"source": [
125+
"## Plot and save figure"
126+
]
127+
},
78128
{
79129
"cell_type": "code",
80130
"execution_count": null,
@@ -87,13 +137,6 @@
87137
"fig.show()\n",
88138
"fig.write_image(filename + \".png\")"
89139
]
90-
},
91-
{
92-
"cell_type": "code",
93-
"execution_count": null,
94-
"metadata": {},
95-
"outputs": [],
96-
"source": []
97140
}
98141
],
99142
"metadata": {
@@ -112,7 +155,7 @@
112155
"name": "python",
113156
"nbconvert_exporter": "python",
114157
"pygments_lexer": "ipython3",
115-
"version": "3.10.8"
158+
"version": "3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:27:35) [Clang 14.0.6 ]"
116159
},
117160
"vscode": {
118161
"interpreter": {

0 commit comments

Comments
 (0)