The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Weather::GHCN::App::Extremes - Report temperature extremes from Weather::GHCN::Fetch output

VERSION

version v0.0.004

SYNOPSIS

    use Weather::GHCN::App::Extremes;

    Weather::GHCN::App::Extremes->run( \@ARGV );

See ghcn_extremes -help for details.

SUBROUTINES

run ( \@ARGV )

Invoke this subroutine, passing in a reference to @ARGV, in order to perform an analysis of the heat or cold waves in the input data.

Input is from stdin, or from the files listed in @ARGV. Data should contain tab-separated output if the format generated by:

    ghcn_fetch -report detail

The following columns are expected:

    Year, Month, Day, Decade, S_Decade, S_Year, S_Qtr,
    TMAX, TMIN, Tavg, Qflags, StationId, Location

Any other columns are ignored.

See ghnc_extremes.pl -help for details.

read_data ( $fh, $cb, $limit )

Read weather data from the filehandle and collect extreme waves according to $limit and $Opt->cold (true for cold waves, false for heat waves).

report_extremes_daycounts ($limit, $ndays, $cmp_op)

Analyzes the input data lookin for $ndays consecutive days when the temperature is beyond $limit. By default, heatwaves are examined. If the option -cold is given, then cold waves are examined.

Returns a reference to a hash keyed on year, and which contains a tab_separated line of text that includes the station id, location, year, ymd the wave began, the number of days the wave lasted, the average temperature during the wave, and the most extreme (hot or cold) temperature during the wave.

report_extremes_per_year ($limit, $ndays, $cmp_op)

Analyzes the input data lookin for $ndays consecutive days when the temperature is beyond $limit. By default, heatwaves are examined. If the option -cold is given, then cold waves are examined.

Returns a reference to a hash keyed on year, and which contains a tab_separated line of text that includes the station id, location, year, and a count of the number of waves detected during that year.

get_options ( \@ARGV )

get_options encapsulates everything we need to process command line options, or to set options when invoking this script from a test script.

Normally it's called by passing a reference to @ARGV; from a test script you'd set up a local array variable to specify the options.

By convention, you should set up a file-scoped lexical variable named $Opt and set it in the mainline using the return value from this function. Then all options can be accessed used $Opt->option notation.

AUTHOR

Gary Puckering (jgpuckering@rogers.com)

LICENSE AND COPYRIGHT

Copyright 2022, Gary Puckering