Skip to content

Commit 134fdb7

Browse files
committed
Undo accidental update to ERA-20C_assessment.ipynb
1 parent 619485d commit 134fdb7

File tree

1 file changed

+23
-26
lines changed

1 file changed

+23
-26
lines changed

docs/examples/ERA-20C_assessment.ipynb

+23-26
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"id": "978b8621-e050-47c3-8e66-807cbac823e6",
66
"metadata": {},
77
"source": [
8-
"# Assessing storm climatology in a dataset\n",
8+
"# `huracanpy` basic use for assessing storm climatology in a dataset\n",
99
"Here, we examplify usage of `huracanpy` with the dataset of TC in ERA-20C detected by the TRACK algorithm.\n",
1010
"This is meant to show an example of workflow. Please refer to specific parts of the documentation to learn about each part (e.g. loading, plotting, etc.) in more detail."
1111
]
@@ -87,16 +87,15 @@
8787
"outputs": [],
8888
"source": [
8989
"# Apply add_all_info to add a number of useful attributes.\n",
90-
"data = huracanpy.info.add_all_info(\n",
90+
"data = huracanpy.utils.add_all_info(\n",
9191
" data,\n",
9292
" lat_name=\"latitude\",\n",
9393
" lon_name=\"longitude\",\n",
94+
" wind_name=\"wind_speed_10m\",\n",
95+
" slp_name=\"psl\",\n",
96+
" slp_units=\"hPa\",\n",
9497
")\n",
95-
"# If you want to add individually the one you need instead, have a look at the functionning of the info module itself.\n",
96-
"\n",
97-
"# TC specific\n",
98-
"data[\"sshs\"] = huracanpy.tc.get_sshs_cat(data.wind_speed_10m)\n",
99-
"data[\"pres_cat\"] = huracanpy.tc.get_sshs_cat(data.psl)"
98+
"# If you want to add individually the one you need instead, have a look at the functionning of the utils module itself."
10099
]
101100
},
102101
{
@@ -173,7 +172,7 @@
173172
],
174173
"source": [
175174
"# Basic plot of the data points\n",
176-
"huracanpy.plot.tracks(\n",
175+
"huracanpy.plot.tracks.plot_tracks_basic(\n",
177176
" data.longitude,\n",
178177
" data.latitude,\n",
179178
" data.wind_speed_10m,\n",
@@ -576,7 +575,7 @@
576575
],
577576
"source": [
578577
"# Frequency (Number of track per year)\n",
579-
"huracanpy.calc.freq(data, by=\"season\")"
578+
"huracanpy.diags.climato.freq(data, by=\"season\")"
580579
]
581580
},
582581
{
@@ -966,7 +965,7 @@
966965
],
967966
"source": [
968967
"# TCD (Accumulated duration of storms per year)\n",
969-
"huracanpy.calc.get_track_duration(data.time, data.track_ids).groupby(data.season).sum()"
968+
"huracanpy.diags.climato.TC_days(data, by=\"season\")"
970969
]
971970
},
972971
{
@@ -1356,11 +1355,9 @@
13561355
],
13571356
"source": [
13581357
"# ACE (aggregated per year)\n",
1359-
"huracanpy.tc.ace(\n",
1360-
" data.wind_speed_10m,\n",
1361-
" sum_by=data.time.dt.year,\n",
1362-
" threshold=0,\n",
1363-
").mean()"
1358+
"huracanpy.utils.ace.ace_by_point(\n",
1359+
" data.wind_speed_10m, threshold=0, wind_units=\"m s**-1\"\n",
1360+
").groupby(data.season).sum().mean()"
13641361
]
13651362
},
13661363
{
@@ -1394,15 +1391,15 @@
13941391
"\n",
13951392
"fig, axs = plt.subplots(3, sharex=True)\n",
13961393
"# Frequency\n",
1397-
"data.groupby(\"season\").apply(huracanpy.calc.freq).plot(ax=axs[0])\n",
1394+
"data.groupby(\"season\").apply(huracanpy.diags.climato.freq).plot(ax=axs[0])\n",
13981395
"axs[0].set_ylabel(\"Number of tracks\")\n",
13991396
"# TCD\n",
1400-
"data.groupby(\"season\").apply(huracanpy.calc.duration).plot(ax=axs[1])\n",
1397+
"data.groupby(\"season\").apply(huracanpy.diags.climato.TC_days).plot(ax=axs[1])\n",
14011398
"axs[1].set_ylabel(\"TC days\")\n",
14021399
"# ACE\n",
1403-
"data.groupby(\"season\").apply(lambda x: huracanpy.tc.ace(x.wind_speed_10m).sum()).plot(\n",
1404-
" ax=axs[2]\n",
1405-
")\n",
1400+
"data.groupby(\"season\").apply(\n",
1401+
" lambda x: huracanpy.diags.climato.ACE(x, wind_name=\"wind_speed_10m\")\n",
1402+
").plot(ax=axs[2])\n",
14061403
"axs[2].set_ylabel(\"ACE\")\n",
14071404
"\n",
14081405
"for ax in axs:\n",
@@ -1440,7 +1437,7 @@
14401437
"source": [
14411438
"## Seasonal\n",
14421439
"\n",
1443-
"gen = huracanpy.calc.gen_vals(\n",
1440+
"gen = huracanpy.diags.track_stats.gen_vals(\n",
14441441
" data,\n",
14451442
") # Extract the point of genesis for each track\n",
14461443
"(\n",
@@ -1494,10 +1491,10 @@
14941491
"fig, axs = plt.subplots(1, 3, sharey=True, figsize=[15, 5])\n",
14951492
"\n",
14961493
"# Duration\n",
1497-
"huracanpy.calc.get_duration(data.time, data.track_id).plot.hist(ax=axs[0])\n",
1494+
"huracanpy.diags.track_stats.duration(data.time, data.track_id).plot.hist(ax=axs[0])\n",
14981495
"\n",
14991496
"# Maximum wind speed\n",
1500-
"huracanpy.calc.get_extremum_vals(\n",
1497+
"huracanpy.diags.track_stats.extremum_vals(\n",
15011498
" data, varname=\"wind_speed_10m\", stat=\"max\"\n",
15021499
").wind_speed_10m.plot.hist(ax=axs[1])\n",
15031500
"\n",
@@ -1948,8 +1945,8 @@
19481945
],
19491946
"metadata": {
19501947
"kernelspec": {
1951-
"display_name": "Python 3 (ipykernel)",
1952-
"language": "python",
1948+
"display_name": "Python 3 (Spyder)",
1949+
"language": "python3",
19531950
"name": "python3"
19541951
},
19551952
"language_info": {
@@ -1962,7 +1959,7 @@
19621959
"name": "python",
19631960
"nbconvert_exporter": "python",
19641961
"pygments_lexer": "ipython3",
1965-
"version": "3.12.4"
1962+
"version": "3.11.9"
19661963
}
19671964
},
19681965
"nbformat": 4,

0 commit comments

Comments
 (0)