Skip to content

Commit 8bfc32f

Browse files
committed
Remove unused var_units argument from docstring
1 parent 2040177 commit 8bfc32f

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed

docs/examples/ERA-20C_assessment.ipynb

+26-23
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"id": "978b8621-e050-47c3-8e66-807cbac823e6",
66
"metadata": {},
77
"source": [
8-
"# `huracanpy` basic use for assessing storm climatology in a dataset\n",
8+
"# 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,15 +87,16 @@
8787
"outputs": [],
8888
"source": [
8989
"# Apply add_all_info to add a number of useful attributes.\n",
90-
"data = huracanpy.utils.add_all_info(\n",
90+
"data = huracanpy.info.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",
9794
")\n",
98-
"# If you want to add individually the one you need instead, have a look at the functionning of the utils module itself."
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)"
99100
]
100101
},
101102
{
@@ -172,7 +173,7 @@
172173
],
173174
"source": [
174175
"# Basic plot of the data points\n",
175-
"huracanpy.plot.tracks.plot_tracks_basic(\n",
176+
"huracanpy.plot.tracks(\n",
176177
" data.longitude,\n",
177178
" data.latitude,\n",
178179
" data.wind_speed_10m,\n",
@@ -575,7 +576,7 @@
575576
],
576577
"source": [
577578
"# Frequency (Number of track per year)\n",
578-
"huracanpy.diags.climato.freq(data, by=\"season\")"
579+
"huracanpy.calc.freq(data, by=\"season\")"
579580
]
580581
},
581582
{
@@ -965,7 +966,7 @@
965966
],
966967
"source": [
967968
"# TCD (Accumulated duration of storms per year)\n",
968-
"huracanpy.diags.climato.TC_days(data, by=\"season\")"
969+
"huracanpy.calc.get_track_duration(data.time, data.track_ids).groupby(data.season).sum()"
969970
]
970971
},
971972
{
@@ -1355,9 +1356,11 @@
13551356
],
13561357
"source": [
13571358
"# ACE (aggregated per year)\n",
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()"
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()"
13611364
]
13621365
},
13631366
{
@@ -1391,15 +1394,15 @@
13911394
"\n",
13921395
"fig, axs = plt.subplots(3, sharex=True)\n",
13931396
"# Frequency\n",
1394-
"data.groupby(\"season\").apply(huracanpy.diags.climato.freq).plot(ax=axs[0])\n",
1397+
"data.groupby(\"season\").apply(huracanpy.calc.freq).plot(ax=axs[0])\n",
13951398
"axs[0].set_ylabel(\"Number of tracks\")\n",
13961399
"# TCD\n",
1397-
"data.groupby(\"season\").apply(huracanpy.diags.climato.TC_days).plot(ax=axs[1])\n",
1400+
"data.groupby(\"season\").apply(huracanpy.calc.duration).plot(ax=axs[1])\n",
13981401
"axs[1].set_ylabel(\"TC days\")\n",
13991402
"# ACE\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",
1403+
"data.groupby(\"season\").apply(lambda x: huracanpy.tc.ace(x.wind_speed_10m).sum()).plot(\n",
1404+
" ax=axs[2]\n",
1405+
")\n",
14031406
"axs[2].set_ylabel(\"ACE\")\n",
14041407
"\n",
14051408
"for ax in axs:\n",
@@ -1437,7 +1440,7 @@
14371440
"source": [
14381441
"## Seasonal\n",
14391442
"\n",
1440-
"gen = huracanpy.diags.track_stats.gen_vals(\n",
1443+
"gen = huracanpy.calc.gen_vals(\n",
14411444
" data,\n",
14421445
") # Extract the point of genesis for each track\n",
14431446
"(\n",
@@ -1491,10 +1494,10 @@
14911494
"fig, axs = plt.subplots(1, 3, sharey=True, figsize=[15, 5])\n",
14921495
"\n",
14931496
"# Duration\n",
1494-
"huracanpy.diags.track_stats.duration(data.time, data.track_id).plot.hist(ax=axs[0])\n",
1497+
"huracanpy.calc.get_duration(data.time, data.track_id).plot.hist(ax=axs[0])\n",
14951498
"\n",
14961499
"# Maximum wind speed\n",
1497-
"huracanpy.diags.track_stats.extremum_vals(\n",
1500+
"huracanpy.calc.get_extremum_vals(\n",
14981501
" data, varname=\"wind_speed_10m\", stat=\"max\"\n",
14991502
").wind_speed_10m.plot.hist(ax=axs[1])\n",
15001503
"\n",
@@ -1945,8 +1948,8 @@
19451948
],
19461949
"metadata": {
19471950
"kernelspec": {
1948-
"display_name": "Python 3 (Spyder)",
1949-
"language": "python3",
1951+
"display_name": "Python 3 (ipykernel)",
1952+
"language": "python",
19501953
"name": "python3"
19511954
},
19521955
"language_info": {
@@ -1959,7 +1962,7 @@
19591962
"name": "python",
19601963
"nbconvert_exporter": "python",
19611964
"pygments_lexer": "ipython3",
1962-
"version": "3.11.9"
1965+
"version": "3.12.4"
19631966
}
19641967
},
19651968
"nbformat": 4,

huracanpy/calc/_rates.py

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def get_delta(var, track_ids=None, centering="forward"):
2222
----------
2323
var : xarray.DataArray
2424
track_ids : array_like, optional
25-
var_units : str, optional
2625
centering : str, optional
2726
2827
Returns

0 commit comments

Comments
 (0)