Skip to content

Commit 32c9672

Browse files
committed
Update documentation ipynb's to match new layout
1 parent d051127 commit 32c9672

File tree

6 files changed

+35
-31
lines changed

6 files changed

+35
-31
lines changed

docs/conf.py

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
autodoc_member_order = "bysource"
3232

3333
nbsphinx_prompt_width = "88"
34-
nbsphinx_allow_errors = True
3534

3635
# Options for intersphinx.
3736
intersphinx_mapping = {

docs/examples/IBTrACS.ipynb

+7-7
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"\n",
2929
"\n",
3030
"### Online\n",
31-
"With the arguments `tracker = \"ibtracs\", ibtracs_online=True`, `load` will retrieve IBTrACS from the NCEI-NOAA (https://www.ncei.noaa.gov/data/international-best-track-archive-for-climate-stewardship-ibtracs/v04r00/access/csv/). \n",
32-
"Use the `ibtracs_subset` argument to specify the subset you want to download. See the webpage mentionned above for the list of existing subset."
31+
"With the arguments `source=\"ibtracs\"`, `ibtracs_online=True`, `load` will retrieve IBTrACS from the NCEI-NOAA (https://www.ncei.noaa.gov/data/international-best-track-archive-for-climate-stewardship-ibtracs/v04r00/access/csv/). \n",
32+
"Use the `ibtracs_subset` argument to specify the subset you want to download. See the webpage mentionned above for the list of existing subset. The following cells are not being run as it requires downloading the IBTrACS data"
3333
]
3434
},
3535
{
@@ -46,8 +46,8 @@
4646
"outputs": [],
4747
"source": [
4848
"# Example of 'last3years' subset\n",
49-
"ib = huracanpy.load(source=\"ibtracs\", ibtracs_online=True, ibtracs_subset=\"last3years\")\n",
50-
"huracanpy.plot.tracks(ib.lon, ib.lat, intensity_var=ib.wmo_wind)"
49+
"#ib = huracanpy.load(source=\"ibtracs\", ibtracs_online=True, ibtracs_subset=\"last3years\")\n",
50+
"#huracanpy.plot.tracks(ib.lon, ib.lat, intensity_var=ib.wmo_wind)"
5151
]
5252
},
5353
{
@@ -64,8 +64,8 @@
6464
"outputs": [],
6565
"source": [
6666
"# Example of 'SI' subset\n",
67-
"ib = huracanpy.load(source=\"ibtracs\", ibtracs_online=True, ibtracs_subset=\"SI\")\n",
68-
"huracanpy.plot.tracks(ib.lon, ib.lat, intensity_var=ib.wmo_wind)"
67+
"#ib = huracanpy.load(source=\"ibtracs\", ibtracs_online=True, ibtracs_subset=\"SI\")\n",
68+
"#huracanpy.plot.tracks(ib.lon, ib.lat, intensity_var=ib.wmo_wind)"
6969
]
7070
},
7171
{
@@ -144,7 +144,7 @@
144144
"outputs": [],
145145
"source": [
146146
"# Add basin data to ib_wmo\n",
147-
"ib_wmo[\"basin\"] = huracanpy.utils.get_basin(ib_wmo.lon, ib_wmo.lat)\n",
147+
"ib_wmo[\"basin\"] = huracanpy.info.get_basin(ib_wmo.lon, ib_wmo.lat)\n",
148148
"# Match tracks between ib_wmo and ib_usa, then retrieve LMI\n",
149149
"m = huracanpy.assess.match([ib_wmo, ib_usa], names=[\"wmo\", \"usa\"])\n",
150150
"max_winds = m.join(\n",

docs/examples/basins.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"outputs": [],
3030
"source": [
3131
"# Basins defined in huracanpy\n",
32-
"huracanpy.basins[\"WMO\"]"
32+
"huracanpy.basins[\"WMO-TC\"]"
3333
]
3434
},
3535
{
@@ -41,7 +41,7 @@
4141
"source": [
4242
"# Plot basins\n",
4343
"# Default defined from 0-360.\n",
44-
"for n, (basin, geometry) in enumerate(huracanpy.basins[\"WMO\"].iterrows()):\n",
44+
"for n, (basin, geometry) in enumerate(huracanpy.basins[\"WMO-TC\"].iterrows()):\n",
4545
" # South Atlantic (SA) crosses dateline so is defined as two regions\n",
4646
" if isinstance(geometry.geometry, MultiPolygon):\n",
4747
" for geom in geometry.geometry.geoms:\n",
@@ -81,7 +81,7 @@
8181
" plt.figure()\n",
8282
" ax = plt.axes(projection=EqualEarth(central_longitude=central_longitude))\n",
8383
"\n",
84-
" for n, (basin, geometry) in enumerate(huracanpy.basins[\"WMO\"].iterrows()):\n",
84+
" for n, (basin, geometry) in enumerate(huracanpy.basins[\"WMO-TC\"].iterrows()):\n",
8585
" if isinstance(geometry.geometry, MultiPolygon):\n",
8686
" for geom in geometry.geometry.geoms:\n",
8787
" plt.plot(*geom.exterior.xy, color=f\"C{n}\", transform=transform)\n",

docs/examples/track_density.ipynb

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"outputs": [],
5656
"source": [
5757
"# Compute track density\n",
58-
"D = huracanpy.diags.density(tracks.lon, tracks.lat)\n",
58+
"D = huracanpy.calc.density(tracks.lon, tracks.lat)\n",
5959
"D # D, the track density, is a map stored in xarray"
6060
]
6161
},
@@ -115,7 +115,7 @@
115115
"outputs": [],
116116
"source": [
117117
"# Setting a smaller bin_size\n",
118-
"D = huracanpy.diags.density(tracks.lon, tracks.lat, bin_size=1)\n",
118+
"D = huracanpy.calc.density(tracks.lon, tracks.lat, bin_size=1)\n",
119119
"D.plot()\n",
120120
"D"
121121
]
@@ -128,7 +128,7 @@
128128
"outputs": [],
129129
"source": [
130130
"# Setting a larger bin_size\n",
131-
"D = huracanpy.diags.density(tracks.lon, tracks.lat, bin_size=10)\n",
131+
"D = huracanpy.calc.density(tracks.lon, tracks.lat, bin_size=10)\n",
132132
"D.plot()\n",
133133
"D"
134134
]
@@ -147,7 +147,7 @@
147147
"N = len(np.unique(tracks.season.values))\n",
148148
"print(N)\n",
149149
"## Track density with normalization.\n",
150-
"D = huracanpy.diags.density(tracks.lon, tracks.lat, N_seasons=N)\n",
150+
"D = huracanpy.calc.density(tracks.lon, tracks.lat, n_seasons=N)\n",
151151
"# In this case, now the number in D in number of TC points in each 5x5 box.\n",
152152
"D.plot()"
153153
]

docs/examples/utils.ipynb

+19-14
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"id": "02a608e9-0fb1-4532-980e-ce860b421d58",
66
"metadata": {},
77
"source": [
8-
"# Additional information with the `utils` module\n",
9-
"In the `utils` module, an `add_all_info` function add to your dataset all the information that HuracanPy may compute. Submodules allow for the computation of individual attributes."
8+
"# Additional information with the `info` module\n",
9+
"In the `info` module, an `add_all_info` function add to your dataset all the information that HuracanPy may compute. Submodules allow for the computation of individual attributes."
1010
]
1111
},
1212
{
@@ -35,7 +35,7 @@
3535
"outputs": [],
3636
"source": [
3737
"# Add info\n",
38-
"data = huracanpy.utils.add_all_info(data, slp_units=\"Pa\")\n",
38+
"data = huracanpy.info.add_all_info(data)\n",
3939
"\n",
4040
"list(data.keys()) # Available attributes"
4141
]
@@ -55,7 +55,7 @@
5555
"metadata": {},
5656
"outputs": [],
5757
"source": [
58-
"# hemisphere, can also be obtained with huracanpy.utils.geography.get_hemisphere\n",
58+
"# hemisphere, can also be obtained with huracanpy.info.get_hemisphere\n",
5959
"huracanpy.plot.tracks(\n",
6060
" data.lon, data.lat, intensity_var=data.hemisphere, scatter_kws=dict(s=10)\n",
6161
")"
@@ -68,7 +68,7 @@
6868
"metadata": {},
6969
"outputs": [],
7070
"source": [
71-
"# basin, can also be obtained with huracanpy.utils.geography.get_basin (NB: Several convention available)\n",
71+
"# basin, can also be obtained with huracanpy.info.get_basin (NB: Several convention available)\n",
7272
"huracanpy.plot.tracks(\n",
7373
" data.lon, data.lat, intensity_var=data.basin, scatter_kws=dict(s=10)\n",
7474
")"
@@ -81,7 +81,7 @@
8181
"metadata": {},
8282
"outputs": [],
8383
"source": [
84-
"# is_ocean, can also be obtained with huracanpy.utils.geography.get_is_ocean\n",
84+
"# is_ocean, can also be obtained with huracanpy.info.get_is_ocean\n",
8585
"huracanpy.plot.tracks(\n",
8686
" data.lon, data.lat, intensity_var=data.is_ocean, scatter_kws=dict(s=10)\n",
8787
")"
@@ -100,7 +100,7 @@
100100
},
101101
"outputs": [],
102102
"source": [
103-
"# country, can also be obtained with huracanpy.utils.geography.get_country\n",
103+
"# country, can also be obtained with huracanpy.info.get_country\n",
104104
"data_ = data.isel(record=slice(0, 60))\n",
105105
"huracanpy.plot.tracks(\n",
106106
" data_.lon, data_.lat, intensity_var=data_.country, scatter_kws=dict(s=10)\n",
@@ -114,7 +114,7 @@
114114
"metadata": {},
115115
"outputs": [],
116116
"source": [
117-
"# continent, can also be obtained with huracanpy.utils.geography.get_country\n",
117+
"# continent, can also be obtained with huracanpy.info.get_country\n",
118118
"huracanpy.plot.tracks(\n",
119119
" data.lon, data.lat, intensity_var=data.continent, scatter_kws=dict(s=10)\n",
120120
")"
@@ -135,7 +135,7 @@
135135
"metadata": {},
136136
"outputs": [],
137137
"source": [
138-
"# Season. Can also be obtained with huracanpy.utils.time.get_season\n",
138+
"# Season. Can also be obtained with huracanpy.info.get_season\n",
139139
"sns.scatterplot(data=data, x=\"time\", y=\"hemisphere\", hue=\"season\")"
140140
]
141141
},
@@ -144,7 +144,10 @@
144144
"id": "e2753aa6-1e8a-478f-bef5-08701ec29ad0",
145145
"metadata": {},
146146
"source": [
147-
"# Categories"
147+
"# Categories\n",
148+
"\n",
149+
"Categories are specific to tropical cyclones and can be found in the `huracanpy.tc` module\n",
150+
"A more generic function is available in `huracanpy.info.get_category`"
148151
]
149152
},
150153
{
@@ -154,11 +157,12 @@
154157
"metadata": {},
155158
"outputs": [],
156159
"source": [
157-
"# sshs, can also be obtained with huracanpy.utils.category.get_sshs_cat\n",
160+
"# sshs, can also be obtained with huracanpy.tc.get_sshs_cat\n",
161+
"sshs = huracanpy.tc.get_sshs_cat(data.wind10)\n",
158162
"huracanpy.plot.tracks(\n",
159163
" data.lon,\n",
160164
" data.lat,\n",
161-
" intensity_var=data.sshs,\n",
165+
" intensity_var=sshs,\n",
162166
" scatter_kws=dict(s=5, palette=\"Spectral\"),\n",
163167
")"
164168
]
@@ -170,11 +174,12 @@
170174
"metadata": {},
171175
"outputs": [],
172176
"source": [
173-
"# pressure category, can also be obtained with huracanpy.utils.category.get_pres_cat\n",
177+
"# pressure category, can also be obtained with huracanpy.tc.get_pres_cat\n",
178+
"pres_cat = huracanpy.tc.get_pressure_cat(data.slp)\n",
174179
"huracanpy.plot.tracks(\n",
175180
" data.lon,\n",
176181
" data.lat,\n",
177-
" intensity_var=data.pres_cat,\n",
182+
" intensity_var=pres_cat,\n",
178183
" scatter_kws=dict(s=5, palette=\"Spectral\"),\n",
179184
")"
180185
]

docs/user_guide/extract.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,15 @@
235235
"# category 2\n",
236236
"tracks = huracanpy.load(huracanpy.example_csv_file)\n",
237237
"\n",
238-
"tracks[\"category\"] = huracanpy.utils.get_pressure_cat(tracks.slp, slp_units=\"Pa\")\n",
238+
"tracks[\"category\"] = huracanpy.tc.get_pressure_cat(tracks.slp, slp_units=\"Pa\")\n",
239239
"\n",
240240
"# Show the categories for each storm\n",
241241
"# Storms 0 and 2 reach category 2, and storm 1 only reaches category 1\n",
242242
"for track_id, track in tracks.groupby(\"track_id\"):\n",
243243
" print(\"track\", track_id, \"category\", int(track.category.max()))\n",
244244
"\n",
245245
"# Subset the tracks by category threshold which will remove track 1\n",
246-
"track_subset = huracanpy.trackswhere(tracks, lambda track: track.category.max() >= 2)\n",
246+
"track_subset = huracanpy.trackswhere(tracks, tracks.track_id, lambda track: track.category.max() >= 2)\n",
247247
"\n",
248248
"# Confirm that track 1 has been filtered out\n",
249249
"print(\"\\n\", \"tracks remaining -\", set(track_subset.track_id.data))"

0 commit comments

Comments
 (0)