Weather::GHCN::Station - class for Station metadata
version v0.0.004
use Weather::GHCN::Station; my $stn_obj = Weather::GHCN::Station->new ( id => 'CA006105976', country => 'CA', state => 'ON', active => '1899-2022', lat => '45.3833', long => '-75.7167', elev => 79, name => 'OTTAWA CDA', gsn => '', );
The Weather::GHCN::Station class is used to encapsulate the metadata for a station as obtained from the NOAA Global Historical Climatology Network data repository. Data is sourced from the station list and the station inventory.
The module is primarily for use by Weather::GHCN::Fetch and Weather::GHCN::StationTable.
Returns the Station id.
Returns the two-character GEC country code for the station.
Returns the two-character state code for US stations, or province code for Canadian stations.
Returns the active range of the station.
Returns the station latitude.
Returns the station longitude.
Returns the station elevation.
Returns the station name.
Returns the boolean indicating whether this is a GSN station.
Returns a hash reference for the measurements available from the station daily data records.
Returns an index number which is shared by stations that have the same physical location; i.e. latitude and longitude. When station instrumentation is changed or there are other significant changes, a new station id may be assigned. This index enables you to group together stations that represent the same spot but which may have different active time periods.
Returns a number range string that represents notes which are errors or warnings about the station.
Create a new Station object.
Column headings may be needed prior to creating any Station instances, for example to print them before any data is loaded. This Headings class method is provided to handle that situation. There is a corresponding instance method.
If called in list context, a list is return; in scalar context, a list reference is returned.
See Headings in Class Methods.
This method allows you to add numbered notes to each station object. It is up to the caller to assign meaning to the numbers. They are stored in a range list (i.e. a Set::IntSpan::Fast object) so that they can be printed compactly even if there a gaps in the number ranges. For example, notes 1, 5 and 20 through 25 will print as 1,5,20-25.
The message argument is optional, but if you provide a message then it will be display on STDERR if it is considered an error message. The threshold is 50 (as established by the hard coded constant $ERR_THRESHOLD). Anything below that is considered an error. Otherwise it's considered a warning.
When the $VERBOSE argument is true, it causes warnings to also print to STDERR.
Returns the station object as a list of field values. The fields are:
$id, $country, $state, $active, $lat, $long, $elev, $name, $note_text, $idx, $grid>
The second last value, $idx is a unique serial index number provided by GHCH::StationTable during load_stations(). Unless set by a consumer of this module, its value will be undef.
The last value, $grid, is a string derived by truncating $lat and $long to 1 decimal place, converting them to N/S W/E format, and concatenting them. This results in a box that defines an area within which there may be other nearby stations of interest.
Returns the latitude and longitude coordinates of the station in decimal format as a space-separated string.
Return lines of text which describe the station in attribute: value format.
Returns a count of the number of errors that were flagged for this station. Errors generally make the station unsuitable for use. Warnings are not included.
Returns the latitude and longitude to a single decimal place and using cardinal (N/S E/W) notation. This value can be used for grouping together stations that are within a 1/10th degree grid and which may be assumed to experience similar weather conditions.
Returns a boolean indicating whether the station was selected for data loading. Selected stations are those that meet the filtering criteria (station id, station name, active range etc.) and that are not flagged with errors.
Returns the URL for the station's daily data web page in the NOAA GHCN data repository.
Defined by Object::Pad. Included for POD::Coverage.
Gary Puckering (jgpuckering@rogers.com)
Copyright 2022, Gary Puckering
To install Weather::GHCN::Fetch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Weather::GHCN::Fetch
CPAN shell
perl -MCPAN -e shell install Weather::GHCN::Fetch
For more information on module installation, please visit the detailed CPAN module installation guide.