Additional information with the info module#
The info allows for the computation of individual attributes.
[1]:
import seaborn as sns
import huracanpy
# Load tracks
filename = huracanpy.example_year_file
data = huracanpy.load(filename)
list(data.keys()) # Available attributes
[1]:
['track_id',
'year',
'month',
'day',
'hour',
'i',
'j',
'lon',
'lat',
'slp',
'zs',
'wind10',
'time']
Geographical attributes#
[2]:
# hemisphere, can also be obtained with huracanpy.info.hemisphere
data = data.hrcn.add_hemisphere()
huracanpy.plot.tracks(
data.lon, data.lat, intensity_var=data.hemisphere, scatter_kws=dict(s=10)
)
[2]:
(<Figure size 1000x1000 with 1 Axes>, <GeoAxes: xlabel='lon', ylabel='lat'>)
[3]:
# basin, can also be obtained with huracanpy.info.basin
# (NB: Several convention available)
data = data.hrcn.add_basin()
huracanpy.plot.tracks(
data.lon, data.lat, intensity_var=data.basin, scatter_kws=dict(s=10)
)
[3]:
(<Figure size 1000x1000 with 1 Axes>, <GeoAxes: xlabel='lon', ylabel='lat'>)
[4]:
# is_ocean, can also be obtained with huracanpy.info.is_ocean
data = data.hrcn.add_is_ocean()
huracanpy.plot.tracks(
data.lon, data.lat, intensity_var=data.is_ocean, scatter_kws=dict(s=10)
)
/home/docs/checkouts/readthedocs.org/user_builds/huracanpy/envs/v1.3.1_a/lib/python3.12/site-packages/cartopy/io/__init__.py:242: DownloadWarning: Downloading: https://naturalearth.s3.amazonaws.com/10m_physical/ne_10m_ocean.zip
warnings.warn(f'Downloading: {url}', DownloadWarning)
[4]:
(<Figure size 1000x1000 with 1 Axes>, <GeoAxes: xlabel='lon', ylabel='lat'>)
[5]:
# country, can also be obtained with huracanpy.info.country
data = data.hrcn.add_country()
data_ = data.isel(record=slice(0, 60))
huracanpy.plot.tracks(
data_.lon, data_.lat, intensity_var=data_.country, scatter_kws=dict(s=10)
)
/home/docs/checkouts/readthedocs.org/user_builds/huracanpy/envs/v1.3.1_a/lib/python3.12/site-packages/cartopy/io/__init__.py:242: DownloadWarning: Downloading: https://naturalearth.s3.amazonaws.com/10m_cultural/ne_10m_admin_0_countries.zip
warnings.warn(f'Downloading: {url}', DownloadWarning)
[5]:
(<Figure size 1000x1000 with 1 Axes>, <GeoAxes: xlabel='lon', ylabel='lat'>)
/home/docs/checkouts/readthedocs.org/user_builds/huracanpy/envs/v1.3.1_a/lib/python3.12/site-packages/cartopy/io/__init__.py:242: DownloadWarning: Downloading: https://naturalearth.s3.amazonaws.com/10m_physical/ne_10m_coastline.zip
warnings.warn(f'Downloading: {url}', DownloadWarning)
[6]:
# continent, can also be obtained with huracanpy.info.continent
data = data.hrcn.add_continent()
huracanpy.plot.tracks(
data.lon, data.lat, intensity_var=data.continent, scatter_kws=dict(s=10)
)
[6]:
(<Figure size 1000x1000 with 1 Axes>, <GeoAxes: xlabel='lon', ylabel='lat'>)
Time attributes#
[7]:
# Season. Can also be obtained with huracanpy.info.season
data = data.hrcn.add_season()
data = data.hrcn.add_hemisphere()
sns.scatterplot(data=data, x="time", y="hemisphere", hue="season")
[7]:
<Axes: xlabel='time', ylabel='hemisphere'>
Categories#
Categories are specific to tropical cyclones and can be found in the huracanpy.tc module A more generic function is available in huracanpy.info.get_category
[8]:
# sshs
sshs = huracanpy.tc.saffir_simpson_category(data.wind10)
huracanpy.plot.tracks(
data.lon,
data.lat,
intensity_var=sshs,
scatter_kws=dict(s=5, palette="Spectral"),
)
[8]:
(<Figure size 1000x1000 with 1 Axes>, <GeoAxes: xlabel='lon', ylabel='lat'>)
[9]:
# pressure category
pres_cat = huracanpy.tc.pressure_category(data.slp)
huracanpy.plot.tracks(
data.lon,
data.lat,
intensity_var=pres_cat,
scatter_kws=dict(s=5, palette="Spectral"),
)
/home/docs/checkouts/readthedocs.org/user_builds/huracanpy/envs/v1.3.1_a/lib/python3.12/site-packages/huracanpy/tc/_category.py:73: UserWarning: Caution, pressure are likely in Pa, they are being converted to hPa for categorization. In future specify the units explicitly by passing slp_units="Pa" to this function or setting slp.attrs["units"] = "Pa"
warnings.warn(
[9]:
(<Figure size 1000x1000 with 1 Axes>, <GeoAxes: xlabel='lon', ylabel='lat'>)