Skip to content

Commit 40c49b1

Browse files
committed
add e3sm notebook
1 parent bda455c commit 40c49b1

File tree

1 file changed

+211
-5
lines changed

1 file changed

+211
-5
lines changed

notebooks/04-recipes/e3sm.ipynb

Lines changed: 211 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,225 @@
55
"id": "480d31e75354650d",
66
"metadata": {},
77
"source": [
8-
"# E3SM Radiative Feedback Analysis\n",
9-
"---"
8+
"<img src=\"https://raw.githubusercontent.com/UXARRAY/uxarray/main/docs/_static/images/logos/uxarray_logo_h_dark.svg\"\n",
9+
" width=\"30%\"\n",
10+
" alt=\"UXarray logo\"\n",
11+
" align=\"right\"\n",
12+
"/>\n",
13+
"\n",
14+
"# E3SM Atmosphere \n",
15+
"\n",
16+
"This recipe demonstrates how to analyze unstructured grid output from the Energy Exascale Earth System Model (E3SM) using UXarray. Unlike traditional approaches that require regridding, UXarray enables direct analysis of the native model output, preserving the full fidelity of the simulation data.\n",
17+
"\n",
18+
"## Objectives\n",
19+
"\n",
20+
"This recipe guides you through calculating and visualizing key atmospheric radiation metrics:\n",
21+
"\n",
22+
"1. Shortwave Cloud Radiative Effect (SWCRE)\n",
23+
"2. Longwave Cloud Radiative Effect (LWCRE)\n",
24+
"3. Net Cloud Radiative Effect (NetCRE)\n",
25+
"\n",
26+
"The workflow includes techniques for:\n",
27+
"\n",
28+
"- Computing radiation components directly on the native unstructured grid\n",
29+
"- Visualizing spatial patterns at the beginning and end of the simulation\n",
30+
"- Analyzing temporal evolution through difference plots\n",
31+
"\n",
32+
"\n",
33+
"-----"
1034
]
1135
},
1236
{
1337
"cell_type": "code",
14-
"execution_count": null,
1538
"id": "b831f927ed134d7e",
1639
"metadata": {},
40+
"source": [
41+
"import cartopy.crs as ccrs\n",
42+
"import holoviews as hv\n",
43+
"import uxarray as ux\n",
44+
"\n",
45+
"hv.extension(\"bokeh\")"
46+
],
1747
"outputs": [],
48+
"execution_count": null
49+
},
50+
{
51+
"metadata": {},
52+
"cell_type": "markdown",
1853
"source": [
19-
"# todo"
20-
]
54+
"## Data\n",
55+
"\n",
56+
"The example uses output from an E3SMv2 atmosphere-only (AMIP) simulation with the following specifications:\n",
57+
"\n",
58+
"- Simulation Period: 6 years\n",
59+
"- Configuration: Present-day control forcing (F2010)\n",
60+
"- Resolution: 1-degree horizontal (ne30pg2)\n",
61+
"- Boundary Conditions: Default E3SMv2 settings for sea surface temperatures and sea ice, cycling annually"
62+
],
63+
"id": "d87d469db62575a3"
64+
},
65+
{
66+
"metadata": {},
67+
"cell_type": "code",
68+
"source": [
69+
"grid_path = \"../../meshfiles/ne30pg2.grid.nc\"\n",
70+
"data_path = \"../../meshfiles/ne30pg2.data.nc\"\n",
71+
"\n",
72+
"uxds = ux.open_dataset(grid_path, data_path)"
73+
],
74+
"id": "7382203e13e8533b",
75+
"outputs": [],
76+
"execution_count": null
77+
},
78+
{
79+
"metadata": {},
80+
"cell_type": "markdown",
81+
"source": [
82+
"## Calculating Shortwave Cloud Radiative Effect (SWCRE)\n",
83+
"\n",
84+
"Shortwave cloud radiative effect can be approximated as the difference beteween all-sky net shortwave flux (FSNT) at the top of the model and the clear-sky net shortwave flux (FSNTC).\n",
85+
"\n",
86+
"$$SWCRE = FSNT - FSNTC$$\n",
87+
"\n"
88+
],
89+
"id": "68f9976f957933ae"
90+
},
91+
{
92+
"metadata": {},
93+
"cell_type": "code",
94+
"source": [
95+
"uxds[\"SWCRE\"] = uxds[\"FSNT\"] - uxds[\"FSNTC\"]\n",
96+
"uxds[\"SWCRE\"]"
97+
],
98+
"id": "f91d13dd7567cdda",
99+
"outputs": [],
100+
"execution_count": null
101+
},
102+
{
103+
"metadata": {},
104+
"cell_type": "markdown",
105+
"source": [
106+
"## Calculating Longwave Cloud Radiative Effect (LWCRE)\n",
107+
"\n",
108+
"Longwave cloud radiative effect is similar to that for SWCRE, but the all-sky and clear-sky longwave fluxes are applied instead.\n",
109+
"\n",
110+
"$$LWCRE = FLUT - FLUTC$$"
111+
],
112+
"id": "15147661043ff38"
113+
},
114+
{
115+
"metadata": {},
116+
"cell_type": "code",
117+
"source": [
118+
"uxds[\"LWCRE\"] = uxds[\"FLUT\"] - uxds[\"FLUTC\"]\n",
119+
"uxds[\"LWCRE\"]"
120+
],
121+
"id": "b1f7a5c84d773935",
122+
"outputs": [],
123+
"execution_count": null
124+
},
125+
{
126+
"metadata": {},
127+
"cell_type": "markdown",
128+
"source": [
129+
"\n",
130+
"## Calculating Net Cloud Radiative Effect (NetCRE)\n",
131+
"\n",
132+
"Net cloud radiative effect is thus the difference beteween shortwave and longwave cloud radiative effect.\n",
133+
"\n",
134+
"$$netCRE = SWCRE - LWCRE$$"
135+
],
136+
"id": "99782d8595d79ce5"
137+
},
138+
{
139+
"metadata": {},
140+
"cell_type": "code",
141+
"source": [
142+
"uxds[\"netCRE\"] = uxds[\"SWCRE\"] - uxds[\"LWCRE\"]\n",
143+
"uxds[\"netCRE\"]"
144+
],
145+
"id": "da1da3f5be008cd9",
146+
"outputs": [],
147+
"execution_count": null
148+
},
149+
{
150+
"metadata": {},
151+
"cell_type": "markdown",
152+
"source": [
153+
"## Plotting\n",
154+
"\n",
155+
"Having computed the Net Cloud Radiative Effect (NetCRE), we can now create visualizations to examine the spatial patterns and temporal evolution of cloud-radiation interactions. Our visualization approach focuses on three key aspects:\n",
156+
"\n",
157+
"1. Initial conditions represented by the first timestep\n",
158+
"2. Final conditions from the last timestep \n",
159+
"3. The difference between these states to reveal temporal changes\n",
160+
"\n",
161+
"The following sections demonstrate how to create these visualizations while maintaining the native unstructured grid structure, ensuring we preserve the full resolution of our simulation data. Below we declare our desired projection.\n"
162+
],
163+
"id": "3d9a1bef36af59e4"
164+
},
165+
{
166+
"metadata": {},
167+
"cell_type": "code",
168+
"source": [
169+
"projection = ccrs.Robinson()"
170+
],
171+
"id": "cdfacf0d558f0b0",
172+
"outputs": [],
173+
"execution_count": null
174+
},
175+
{
176+
"metadata": {},
177+
"cell_type": "markdown",
178+
"source": [
179+
"### Visualizing Initial and Final States\n",
180+
"\n",
181+
"The following visualization displays the Net Cloud Radiative Effect at two critical points in our model output: the initial state (first timestep) and final state (last timestep). This comparison allows us to examine both the baseline conditions and the evolved state of cloud-radiation interactions.\n"
182+
],
183+
"id": "7b22d758f9d5c36e"
184+
},
185+
{
186+
"metadata": {},
187+
"cell_type": "code",
188+
"source": [
189+
"(\n",
190+
" uxds[\"netCRE\"]\n",
191+
" .isel(time=0)\n",
192+
" .plot(\n",
193+
" projection=projection, pixel_ratio=4.0, coastline=True, title=\"First Time Step\"\n",
194+
" )\n",
195+
" + uxds[\"netCRE\"]\n",
196+
" .isel(time=-1)\n",
197+
" .plot(\n",
198+
" projection=projection, pixel_ratio=4.0, coastline=True, title=\"Final Time Step\"\n",
199+
" )\n",
200+
").cols(1)"
201+
],
202+
"id": "ed56690664c99508",
203+
"outputs": [],
204+
"execution_count": null
205+
},
206+
{
207+
"metadata": {},
208+
"cell_type": "markdown",
209+
"source": [
210+
"### Difference Analysis\n",
211+
"\n",
212+
"To quantify and visualize how the Net Cloud Radiative Effect evolved over the simulation period, we compute the difference between the final and initial states. This differential analysis highlights regions where cloud-radiation interactions have strengthened or weakened during the simulation.\n"
213+
],
214+
"id": "85742fa517eb8bdd"
215+
},
216+
{
217+
"metadata": {},
218+
"cell_type": "code",
219+
"source": [
220+
"(uxds[\"netCRE\"].isel(time=-1) - uxds[\"netCRE\"].isel(time=-0)).plot(\n",
221+
" projection=projection, coastline=True, pixel_ratio=4.0, title=\"Change in NetCRE\"\n",
222+
")"
223+
],
224+
"id": "d15916950f596215",
225+
"outputs": [],
226+
"execution_count": null
21227
}
22228
],
23229
"metadata": {

0 commit comments

Comments
 (0)