NAME
Weather::NHC::TropicalCyclone::Storm - one active storm from NHC CurrentStorms.json
SYNOPSIS
my $nhc = Weather::NHC::TropicalCyclone->new;
$nhc->fetch;
for my $storm ( @{ $nhc->active_storms } ) {
printf "%s %s: %s\n", $storm->id, $storm->name, $storm->kind;
my ( $text, $adv_num ) = $storm->fetch_forecastAdvisory;
my ( $file, $gis_adv ) = $storm->fetch_trackCone('kmzFile');
}
DESCRIPTION
A Storm object wraps one object from NHC's activeStorms array. Scalar storm properties are available as accessors and nested product objects remain ordinary hash-based H2O objects, so callers can use either accessor or hash syntax.
Version 0.36 centralizes the product/type matrix in Weather::NHC::TropicalCyclone::Resource. The historical convenience methods below are retained as thin wrappers around shared text and file download paths. This also leaves a clean boundary for a future bulk-download API.
STORM INFORMATION
The fields advertised by current NHC data include:
id
binNumber
name
classification
intensity
pressure
latitude
longitude
latitudeNumeric
longitudeNumeric
movementDir
movementSpeed
lastUpdate
NHC may add fields. Unknown fields are preserved by the top-level client.
Historical compatibility accessors
The 0.35 constructor generated several top-level accessors that were not actual current NHC field names: latitudelongitude, latitude_numberic, kmzFile34kt, kmzFile50kt, and kmzFile64kt. Version 0.36 retains those accessors for source compatibility, but new code should use latitudeNumeric and the corresponding fields under windSpeedProbabilitiesGIS instead.
kind
Returns a human-readable description of the NHC classification abbreviation.
basin
Returns atlantic for AT1-AT5, pacific for EP1-EP5 (the historical return value), and central_pacific for the currently observed CP1-CP5 bins.
TEXT PRODUCTS
These methods fetch the NHC HTML product and return the text inside its pre element. Each accepts an optional local filename and returns text, advisory number, and that filename.
fetch_publicAdvisory
Fetches the current public advisory text.
fetch_forecastAdvisory
Fetches the current forecast/advisory text.
fetch_forecastDiscussion
Fetches the current forecast discussion text.
fetch_windspeedProbabilities
Fetches the current wind-speed probability text product.
GIS AND DOWNLOADABLE PRODUCTS
The following methods accept a product representation such as zipFile, kmzFile, kmzFile34kt, or kmlFile, plus an optional local filename. They return the saved filename and advisory number. Products without an advisory number return N/A for that value. A currently unavailable NHC product returns undef.
fetch_forecastTrack
Downloads the requested forecast-track representation.
fetch_windWatchesWarnings
Downloads the requested wind-watch/warning representation when NHC provides it.
fetch_trackCone
Downloads the requested forecast-cone representation.
fetch_initialWindExtent
Downloads the requested initial wind-extent representation.
fetch_forecastWindRadiiGIS
Downloads the requested forecast wind-radii GIS representation.
fetch_bestTrackGIS
Downloads the requested best-track GIS representation.
fetch_earliestArrivalTimeTSWindsGIS
Downloads the requested earliest reasonable tropical-storm-wind arrival-time representation.
fetch_mostLikelyTimeTSWindsGIS
Downloads the requested most-likely tropical-storm-wind arrival-time representation.
fetch_windSpeedProbabilitiesGIS
Downloads a requested GIS wind-speed-probability representation.
fetch_stormSurgeWatchWarningGIS
Downloads the storm-surge watch/warning KML product when available.
fetch_potentialStormSurgeFloodingGIS
Downloads a requested potential storm-surge flooding GIS product.
fetch_peakSurgeKML
Downloads the peak-surge KML product when available.
peakSurgeKML is present in current NHC status data and is frequently null when the product does not apply.
OTHER PRODUCTS
fetch_forecastGraphics_urls
Returns an array reference containing the currently advertised PNG graphic URLs for the storm. Returns an empty array reference if no graphics directory can be determined.
fetch_best_track
Downloads the preliminary best-track b<storm-id.dat> file from NHC's ATCF best-track directory. The optional argument overrides the local filename.
fetch_forecastAdvisory_as_atcf
Fetches the current forecast/advisory, converts it to ATCF forecast records using Weather::NHC::TropicalCyclone::ForecastAdvisory, and returns the ATCF array reference, advisory number, and optional saved filename.
RESOURCE CATALOG
The product/type relationships used by these methods live in Weather::NHC::TropicalCyclone::Resource. Keeping that information declarative makes it possible for a later release to provide filtered bulk downloads by product family, category, representation, or file extension without duplicating the download implementation.
DEFAULT URLS
$DEFAULT_GRAPHICS_ROOT is the NHC storm graphics root. $DEFAULT_BTK_ROOT is the HTTPS ATCF preliminary best-track root.
LICENSE
This module is distributed under the same terms as Perl itself.