.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/tracks.storm.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_tracks.storm.py: ========================= Individual Storm Analysis ========================= This sample script illustrates how to retrieve a single storm from the HURDAT2 dataset, and make plots and analyses of this storm. .. GENERATED FROM PYTHON SOURCE LINES 7-11 .. code-block:: default import tropycal.tracks as tracks import datetime as dt .. GENERATED FROM PYTHON SOURCE LINES 12-17 HURTDAT2 Dataset ---------------- Let's start by creating an instance of a TrackDataset object. By default, this reads in the HURDAT2 dataset from the National Hurricane Center (NHC) website. For this example we'll be using the HURDAT2 dataset over the North Atlantic basin. HURDAT data is not available for the most recent hurricane seasons. To include the latest data up through today, the "include_btk" flag would need to be set to True, which reads in preliminary best track data from the NHC website. .. GENERATED FROM PYTHON SOURCE LINES 17-20 .. code-block:: default basin = tracks.TrackDataset(basin='north_atlantic',source='hurdat',include_btk=False) .. rst-class:: sphx-glr-script-out .. code-block:: none --> Starting to read in HURDAT2 data --> Completed reading in HURDAT2 data (2.36 seconds) .. GENERATED FROM PYTHON SOURCE LINES 21-26 Individual storm analysis ------------------------- Individual storms can be retrieved from the dataset by calling the ``get_storm()`` function, which returns an instance of a Storm object. This can be done by either entering a tuple containing the storm name and year, or by the standard tropical cyclone ID (e.g., "AL012019"). Let's retrieve an instance of Hurricane Michael from 2018: .. GENERATED FROM PYTHON SOURCE LINES 26-29 .. code-block:: default storm = basin.get_storm(('michael',2018)) .. GENERATED FROM PYTHON SOURCE LINES 30-31 We can quickly visualize what the Storm object contains by printing it: .. GENERATED FROM PYTHON SOURCE LINES 31-34 .. code-block:: default print(storm) .. rst-class:: sphx-glr-script-out .. code-block:: none Storm Summary: Maximum Wind: 140 knots Minimum Pressure: 919 hPa Start Time: 0600 UTC 07 October 2018 End Time: 1800 UTC 11 October 2018 Variables: time (datetime) [2018-10-06 18:00:00 .... 2018-10-15 18:00:00] extra_obs (int64) [0 .... 0] special (str) [ .... ] type (str) [LO .... EX] lat (float64) [17.8 .... 41.2] lon (float64) [-86.6 .... -10.0] vmax (int64) [25 .... 35] mslp (int64) [1006 .... 1001] wmo_basin (str) [north_atlantic .... north_atlantic] More Information: id: AL142018 operational_id: AL142018 name: MICHAEL year: 2018 season: 2018 basin: north_atlantic source_info: NHC Hurricane Database source: hurdat ace: 12.5 realtime: False invest: False .. GENERATED FROM PYTHON SOURCE LINES 35-38 This instance of Storm contains several methods that return the storm data back in different data types. The following examples will show # how to retrieve 3 different data types. Retrieve a dictionary of Michael's data: .. GENERATED FROM PYTHON SOURCE LINES 38-41 .. code-block:: default print(storm.to_dict()) .. rst-class:: sphx-glr-script-out .. code-block:: none {'id': 'AL142018', 'operational_id': 'AL142018', 'name': 'MICHAEL', 'year': 2018, 'season': 2018, 'basin': 'north_atlantic', 'source_info': 'NHC Hurricane Database', 'source': 'hurdat', 'time': [datetime.datetime(2018, 10, 6, 18, 0), datetime.datetime(2018, 10, 7, 0, 0), datetime.datetime(2018, 10, 7, 6, 0), datetime.datetime(2018, 10, 7, 12, 0), datetime.datetime(2018, 10, 7, 18, 0), datetime.datetime(2018, 10, 8, 0, 0), datetime.datetime(2018, 10, 8, 6, 0), datetime.datetime(2018, 10, 8, 12, 0), datetime.datetime(2018, 10, 8, 18, 0), datetime.datetime(2018, 10, 9, 0, 0), datetime.datetime(2018, 10, 9, 6, 0), datetime.datetime(2018, 10, 9, 12, 0), datetime.datetime(2018, 10, 9, 18, 0), datetime.datetime(2018, 10, 10, 0, 0), datetime.datetime(2018, 10, 10, 6, 0), datetime.datetime(2018, 10, 10, 12, 0), datetime.datetime(2018, 10, 10, 17, 30), datetime.datetime(2018, 10, 10, 18, 0), datetime.datetime(2018, 10, 11, 0, 0), datetime.datetime(2018, 10, 11, 6, 0), datetime.datetime(2018, 10, 11, 12, 0), datetime.datetime(2018, 10, 11, 18, 0), datetime.datetime(2018, 10, 12, 0, 0), datetime.datetime(2018, 10, 12, 6, 0), datetime.datetime(2018, 10, 12, 12, 0), datetime.datetime(2018, 10, 12, 18, 0), datetime.datetime(2018, 10, 13, 0, 0), datetime.datetime(2018, 10, 13, 6, 0), datetime.datetime(2018, 10, 13, 12, 0), datetime.datetime(2018, 10, 13, 18, 0), datetime.datetime(2018, 10, 14, 0, 0), datetime.datetime(2018, 10, 14, 6, 0), datetime.datetime(2018, 10, 14, 12, 0), datetime.datetime(2018, 10, 14, 18, 0), datetime.datetime(2018, 10, 15, 0, 0), datetime.datetime(2018, 10, 15, 6, 0), datetime.datetime(2018, 10, 15, 12, 0), datetime.datetime(2018, 10, 15, 18, 0)], 'extra_obs': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 'special': ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'L', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], 'type': ['LO', 'LO', 'TD', 'TS', 'TS', 'TS', 'TS', 'HU', 'HU', 'HU', 'HU', 'HU', 'HU', 'HU', 'HU', 'HU', 'HU', 'HU', 'HU', 'TS', 'TS', 'TS', 'EX', 'EX', 'EX', 'EX', 'EX', 'EX', 'EX', 'EX', 'EX', 'EX', 'EX', 'EX', 'EX', 'EX', 'EX', 'EX'], 'lat': [17.8, 18.1, 18.4, 18.8, 19.1, 19.7, 20.2, 20.9, 21.7, 22.7, 23.7, 24.6, 25.6, 26.6, 27.7, 29.0, 30.0, 30.2, 31.5, 32.8, 34.1, 35.6, 36.5, 37.3, 39.1, 41.1, 43.1, 44.8, 46.4, 47.6, 48.4, 48.8, 48.6, 47.5, 45.9, 44.4, 42.8, 41.2], 'lon': [-86.6, -86.9, -86.8, -86.4, -85.7, -85.5, -85.4, -85.1, -85.1, -85.2, -85.8, -86.2, -86.4, -86.5, -86.6, -86.3, -85.5, -85.4, -84.5, -83.2, -81.7, -80.0, -77.7, -75.0, -70.6, -66.1, -61.5, -55.7, -48.2, -40.7, -33.1, -26.1, -20.7, -16.4, -13.5, -11.4, -10.3, -10.0], 'vmax': [25, 25, 30, 35, 45, 50, 60, 65, 75, 85, 85, 90, 100, 110, 120, 125, 140, 135, 80, 50, 45, 45, 50, 60, 60, 60, 65, 65, 65, 65, 65, 65, 60, 55, 55, 50, 35, 35], 'mslp': [1006, 1004, 1004, 1003, 999, 996, 984, 982, 977, 971, 973, 968, 961, 952, 945, 934, 919, 920, 957, 979, 987, 991, 988, 983, 980, 977, 975, 975, 975, 975, 975, 975, 975, 978, 982, 989, 996, 1001], 'wmo_basin': ['north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic', 'north_atlantic'], 'ace': 12.505} .. GENERATED FROM PYTHON SOURCE LINES 42-43 Retrieve xarray Dataset object with Michael's data: .. GENERATED FROM PYTHON SOURCE LINES 43-46 .. code-block:: default print(storm.to_xarray()) .. rst-class:: sphx-glr-script-out .. code-block:: none Dimensions: (time: 38) Coordinates: * time (time) datetime64[ns] 2018-10-06T18:00:00 ... 2018-10-15T18:00:00 Data variables: extra_obs (time) int64 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 special (time) .. GENERATED FROM PYTHON SOURCE LINES 59-60 Plot the tornado tracks associated with Michael, along with the accompanying daily practically perfect forecast (PPH): .. GENERATED FROM PYTHON SOURCE LINES 60-63 .. code-block:: default storm.plot_tors(plotPPH=True) .. image-sg:: /examples/images/sphx_glr_tracks.storm_002.png :alt: Hurricane MICHAEL Tornado tracks and daily PPH (%), 07 Oct 2018 – 11 Oct 2018 140 kt • 919 hPa • 12.5 ACE :srcset: /examples/images/sphx_glr_tracks.storm_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none --> Starting to read in tornado track data --> Completed reading in tornado data for 1950-2022 (6.12 seconds) .. GENERATED FROM PYTHON SOURCE LINES 64-67 If this storm was ever in NHC's area of responsibility, you can retrieve operational NHC forecast data for this event provided it is available. Forecast discussions date back to 1992, and forecast tracks date back to 1954. Retrieve a single forecast discussion for Michael: .. GENERATED FROM PYTHON SOURCE LINES 67-76 .. code-block:: default #Method 1: Specify date closest to desired discussion disco = storm.get_nhc_discussion(forecast=dt.datetime(2018,10,7,0)) print(disco['text']) #Method 2: Specify forecast discussion ID disco = storm.get_nhc_discussion(forecast=2) #print(disco['text']) printing this would show the same output .. rst-class:: sphx-glr-script-out .. code-block:: none ZCZC MIATCDAT4 ALL TTAA00 KNHC DDHHMM Potential Tropical Cyclone Fourteen Discussion Number 1 NWS National Hurricane Center Miami FL AL142018 400 PM CDT Sat Oct 06 2018 Satellite imagery and surface observations indicate that the circulation of the low pressure area in the northwestern Caribbean Sea is getting better defined, and that the associated convection is becoming better organized. While the system is currently not well enough organized to call it a tropical depression, current indications in the global models and the intensity guidance are that the system will develop into a tropical cyclone within 24 h and could bring tropical storm conditions to portions of western Cuba and the northeastern Yucatan Peninsula. Based on the need for warnings and watches in these areas, advisories are being initiated on Potential Tropical Cyclone Fourteen. Although the intensity guidance is in excellent agreement that the system should strengthen through the forecast period, the global models indicate that shear caused by an upper-level trough over the Gulf of Mexico will persist through at least 48 h. In addition, the strongest winds are currently well removed from the center, which is likely to slow development. Based on this, the intensity forecast is in the lower part of the guidance envelope through 48 h, and then shows a faster rate of development from 48-96 h when the shear is forecast to diminish. The intensity forecast is closest to a blend of the IVCN and HCCA consensus models. For the first 24-48 h, the disturbance should move generally northward on the western side of a weak mid-level ridge over the Caribbean Sea. After that time, a large mid-latitude trough over the central United States and a mid- to upper-level ridge over the western Atlantic should steer the system generally northward at a faster forward speed, with the system expected to move near or over the northern Gulf coast in about 96 h. After landfall, the system is likely to recurve northeastward into the westerlies. The track guidance is in good overall agreement with this scenario. However, it should be noted that there is a nearly 300 n mi cross-track spread in the guidance at the 96-h point. The forecast track lies just to the west of the various consensus models. Key Messages for Potential Tropical Cyclone Fourteen: 1. This system is expected to produce heavy rainfall and flash flooding over portions of Central America, western Cuba, and the northeastern Yucatan Peninsula of Mexico during the next couple of days. The system is also forecast to become a tropical storm by Sunday night and tropical storm conditions are expected over portions of western Cuba where a Tropical Storm Warning is in effect. 2. The system could bring storm surge, rainfall, and wind impacts to portions of the northern Gulf Coast by mid-week, although it is too soon to specify the exact location and magnitude of these impacts. Residents in these areas should monitor the progress of this system. FORECAST POSITIONS AND MAX WINDS INIT 06/2100Z 18.0N 86.6W 25 KT 30 MPH...POTENTIAL TROP CYCLONE 12H 07/0600Z 18.7N 86.7W 25 KT 30 MPH 24H 07/1800Z 19.9N 86.6W 30 KT 35 MPH...TROPICAL CYCLONE 36H 08/0600Z 21.0N 86.6W 35 KT 40 MPH 48H 08/1800Z 22.5N 86.7W 40 KT 45 MPH 72H 09/1800Z 26.0N 87.5W 55 KT 65 MPH 96H 10/1800Z 30.5N 86.5W 60 KT 70 MPH 120H 11/1800Z 35.5N 81.5W 30 KT 35 MPH...INLAND $$ Forecaster Beven NNNN .. GENERATED FROM PYTHON SOURCE LINES 77-80 NHC also archives forecast tracks, albeit in a different format than the official advisory data, so the operational forecast IDs here differ from the discussion IDs. As such, the forecast cone is not directly retrieved from NHC, but is generated using an algorithm that yields a cone closely resembling the official NHC cone. Let's plot Michael's second forecast cone: .. GENERATED FROM PYTHON SOURCE LINES 80-83 .. code-block:: default storm.plot_nhc_forecast(forecast=2) .. image-sg:: /examples/images/sphx_glr_tracks.storm_003.png :alt: Potential Tropical Cyclone FOURTEEN, 30 mph • 1004 hPa • Forecast #2 Forecast Issued: 0300 UTC 07 Oct 2018 :srcset: /examples/images/sphx_glr_tracks.storm_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 84-87 Now let's look at the 12th forecast for Michael. Note that the observed track here differs from the HURDAT2 track plotted previously! This is because this plot displays the operationally analyzed location and intensity, rather than the post-storm analysis data. This is done to account for differences between HURDAT2 and operational data. .. GENERATED FROM PYTHON SOURCE LINES 87-90 .. code-block:: default storm.plot_nhc_forecast(forecast=12) .. image-sg:: /examples/images/sphx_glr_tracks.storm_004.png :alt: Hurricane MICHAEL, 110 mph • 965 hPa • Forecast #12 Forecast Issued: 1500 UTC 09 Oct 2018 :srcset: /examples/images/sphx_glr_tracks.storm_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 91-94 To get the raw NHC forecast data, we can use the ``get_nhc_forecast_dict()`` method, and provide a date for the requested forecast. This is a subset of the ``get_operational_forecasts()`` method, which pulls in all available forecasts whether NHC, deterministic model or ensemble members. .. GENERATED FROM PYTHON SOURCE LINES 94-97 .. code-block:: default storm.get_nhc_forecast_dict(dt.datetime(2018,10,9,18)) .. rst-class:: sphx-glr-script-out .. code-block:: none {'init': datetime.datetime(2018, 10, 9, 18, 0), 'fhr': [0, 3, 12, 24, 36, 48, 72, 96, 120], 'lat': [25.5, 26.0, 27.6, 29.7, 31.8, 33.9, 39.0, 45.5, 50.0], 'lon': [-86.4, -86.4, -86.6, -85.9, -84.1, -81.0, -70.0, -51.0, -30.0], 'vmax': [105, 105, 110, 110, 60, 45, 55, 55, 45], 'mslp': [nan, 957, nan, nan, nan, nan, nan, nan, nan], 'type': ['HU', 'HU', 'HU', 'HU', 'TS', 'TS', 'TS', 'EX', 'EX'], 'windrad': [{34: [150, 140, 70, 140], 50: [70, 50, 30, 50], 64: [40, 30, 20, 30]}, {34: [150, 140, 70, 140], 50: [70, 50, 30, 50], 64: [40, 30, 20, 30]}, {34: [150, 140, 70, 140], 50: [70, 60, 40, 50], 64: [35, 30, 25, 30]}, {34: [130, 140, 90, 130], 50: [60, 60, 40, 50], 64: [35, 30, 25, 30]}, {34: [90, 120, 60, 60], 50: [40, 40, 20, 20]}, {34: [50, 140, 40, 40]}, {34: [150, 240, 180, 70], 50: [0, 90, 90, 0]}, {34: [0, 0, 0, 0]}, {34: [0, 0, 0, 0]}]} .. GENERATED FROM PYTHON SOURCE LINES 98-108 IBTrACS Dataset --------------- We can also read in IBTrACS data and use it the same way as we would use HURDAT2 data. There are caveats to using IBTrACS data, however, which are described more in depth in the :doc:`../data` page. We'll retrieve the global IBTrACS dataset, using the Joint Typhoon Warning Center (JTWC) data, modified with the Neumann reanalysis for southern hemisphere storms, and including a special reanalysis for Cyclone Catarina (2004) in Brazil. .. warning:: By default, IBTrACS data is read in from an online source. If you're reading in the global IBTrACS dataset, this could be quite slow. For global IBTrACS, it is recommended to have the CSV file saved locally (`link to data`_), then set the flag ``ibtracs_url="local_path"``. .. _link to data: https://www.ncei.noaa.gov/data/international-best-track-archive-for-climate-stewardship-ibtracs/v04r00/access/csv/ibtracs.ALL.list.v04r00.csv .. GENERATED FROM PYTHON SOURCE LINES 108-111 .. code-block:: default ibtracs = tracks.TrackDataset(basin='all',source='ibtracs',ibtracs_mode='jtwc_neumann',catarina=True) .. rst-class:: sphx-glr-script-out .. code-block:: none --> Starting to read in ibtracs data --> Completed reading in ibtracs data (77.27 seconds) .. GENERATED FROM PYTHON SOURCE LINES 112-117 The functionality for handling storms in IBTrACS is the same as with using HURDAT2, the only limitation being no NHC and operational model data can be accessed when using IBTrACS as the data source. `Super Typhoon Haiyan`_ (2013) was a catastrophic storm in the West Pacific basin, having made landfall in the Philippines. With estimated sustained winds of 195 mph (170 kt), it is among one of the most powerful tropical cyclones in recorded history. We can illustrate this by making a plot of Haiyan's observed track and intensity, from JTWC data: .. _Super Typhoon Haiyan: https://en.wikipedia.org/wiki/Typhoon_Haiyan .. GENERATED FROM PYTHON SOURCE LINES 117-121 .. code-block:: default storm = ibtracs.get_storm(('haiyan',2013)) storm.plot() .. image-sg:: /examples/images/sphx_glr_tracks.storm_005.png :alt: Super Typhoon HAIYAN, 03 Nov 2013 – 11 Nov 2013 170 kt • 895 hPa • 38.2 ACE :srcset: /examples/images/sphx_glr_tracks.storm_005.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 122-125 `Cyclone Catarina`_ (2004) was an extremely rare hurricane-force tropical cyclone that developed in the South Atlantic basin, which normally doesn't see tropical cyclone activity, and subsequently made landfall in Brazil. The "Catarina" name is unofficial; it was not assigned a name in real time, and JTWC assigned it the ID "AL502004". Recall that when reading in the IBTrACS dataset previously, we set ``Catarina=True``. This read in data for Cyclone Catarina from a special post-storm reanalysis from McTaggart-Cowan et al. (2006). Let's make a plot of Catarina's observed track and intensity per this reanalysis: .. _Cyclone Catarina: https://en.wikipedia.org/wiki/Hurricane_Catarina .. GENERATED FROM PYTHON SOURCE LINES 125-129 .. code-block:: default storm = ibtracs.get_storm(('catarina',2004)) storm.plot() .. image-sg:: /examples/images/sphx_glr_tracks.storm_006.png :alt: Cyclone CATARINA, 24 Mar 2004 – 28 Mar 2004 85 kt • 972 hPa • 7.2 ACE :srcset: /examples/images/sphx_glr_tracks.storm_006.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 130-131 If we were to read in IBTrACS without setting ``Catarina=True`` (which sets it to False by default) and plot the track for "AL502004", we would get a noticeably different (shorter) and weaker track. .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 1 minutes 44.799 seconds) .. _sphx_glr_download_examples_tracks.storm.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: tracks.storm.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: tracks.storm.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_