blib/lib/Weather/GHCN/Fetch.pm untested

filter: Statementstmt 0.0% 0 / 4 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 1 Podpod n/a totaltotal 0.0% 0 / 5 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
CRAP 2.0
1 # Weather::GHCN::Fetch.pm - class for creating applications that fetch NOAA GHCN data
2
3 use v5.18; # minimum for Object::Pad
4
5 package Weather::GHCN::Fetch;
6
7 our $VERSION = 'v0.0.003';
8
9 =head1 NAME
10
11 Weather::GHCN::Fetch - Access the NOAA GHCN Global Historical Climatology Network repository
12  
13 =head1 VERSION
14  
15 version v0.0.003
16
17 =head1 DESCRIPTION
18
19 The B<Weather::GHCN >module library provides classes that can be used to develop
20 applications that access weather data collected by the U.S. National
21 Oceanic and Atmospheric Administration. The modules enable the
22 retrieval of the surface station weather data and metadata that NOAA
23 publishes as the Global Historical Climatology Network (GHCN) data
24 repository, which is fed by weather data sources from around
25 the world.
26
27 =head1 NOAA GHCN DATA SOURCES
28
29 The main data sources are:
30
31 =over 4
32
33 =item
34
35 L<https://www1.ncdc.noaa.gov/pub/data/ghcn/daily/all/>
36
37 =item
38
39 L<https://www1.ncdc.noaa.gov/pub/data/ghcn/daily/ghcnd-stations.txt>
40
41 =item
42
43 L<https://www1.ncdc.noaa.gov/pub/data/ghcn/daily/ghcnd-inventory.txt>
44
45 =back
46
47 NOAA also provides a readme file here:
48
49 =over 4
50
51 =item
52
53 L<https://www1.ncdc.noaa.gov/pub/data/ghcn/daily/readme.txt>
54
55 =back
56
57 =head1 APPLICATION SCRIPTS
58
59 The B<Weather::GHCN::Fetch> package includes fully functional application
60 scripts that are based on B<Weather::GHCN::App> modules. These are:
61
62 =over 4
63
64 =item B<ghcn_fetch>
65
66 Fetches station and/or weather data for reporting.
67
68 =item B<ghcn_extremes>
69
70 Reports temperature extremes, including heatwaves and coldwaves, from
71 station-level daily weather retrieved by B<ghcn_fetch>.
72
73 =item B<ghcn_station_counts>
74
75 Take a list of stations found by B<ghcn_fetch>, examines the active
76 date range, and produces a count of stations that were active in
77 each year of the range.
78
79 =back
80
81 The output from all scripts is tab-separated and designed for easy
82 import into Excel (or similar) for analysis, reporting and charting.
83 B<ghcn_extremes> and B<ghcn_station_counts> are designed to take the
84 output from B<ghcn_fetch> via pipeline.
85
86 Each script has a B<-help> option that documents its features and options.
87
88 =head1 APPLICATION MODULES
89
90 The application scripts are mostly just a thin veneer over corresponding
91 modules in the B<Weather::GHCN::App> namespace. That and the POD
92 necessary for B<-help> and B<-usage>.
93
94 The application scripts are built upon the API modules, primarily
95 B<Weather::GHCN::StationTable>.
96
97 =head1 API MODULES
98
99 The API modules are the heart of the package, encapsulating the logic
100 necessary for accessing the GHCN repository, downloading station
101 metadata and daily weather data, managing the plethora of options
102 supported by the B<ghcn_fetch> application, etc.
103
104 The modules are:
105
106 Weather::GHCN::StationTable
107 Weather::GHCN::Station
108 Weather::GHCN::Common
109 Weather::GHCN::CountryCodes
110 Weather::GHCN::Measures
111 Weather::GHCN::Options
112 Weather::GHCN::TimingStats
113
114 This module, B<Weather::GHCN::Fetch>, is actually just a stub that
115 provides documentation and a primary module name for the distribution.
116
117 =head1 EXAMPLES
118
119 The primary usefulness of this package comes from the application
120 scripts. Here are some examples:
121
122 B<List the weather stations in NY state with "New York" in the name:>
123
124 C<ghcn_fetch -country US -state NY -location "New York">
125
126 B<List the New York weather stations active between 1900 and 1920:>
127
128 C<ghcn_fetch -cou US -st NY -location "New York" -active 1900-1920>
129
130 B<Report the yearly max, min and average temperatures at JFK airport:>
131
132 C<ghcn_fetch yearly -cou US -st NY -location "New York JFK">
133
134 B<Report the monthly max, min and average temperatures at JFK airport:>
135
136 C<ghcn_fetch monthly -cou US -st NY -location "New York JFK">
137
138 B<Report the daily max, min and average temperatures at JFK airport:>
139
140 C<ghcn_fetch daily -cou US -st NY -location "New York JFK">
141
142 B<Launch the GUI for an options dialog>
143
144 C<ghcn_fetch -gui>
145
146 (requires B<Tk> and B<Tk::Getopt> to be installed)
147
148 B<Get documentation on all the options>
149
150 C<ghcn_fetch -help>
151
152 B<Find the 5-day heatwaves at the JFK airport station:>
153
154 C<ghcn_fetch id -cou US -st NY -location "New York JFK" | ghcn_extremes>
155
156 B<Find the 3-day coldwaves (<= 15C) at the JFK airport station:>
157
158 C<ghcn_fetch id -cou US -st NY -location "New York JFK" | ghcn_extremes -cold -ndays 3 -limit -15>
159
160 B<For each year between 1900 and 1950, count the number of active weather stations in NY state:>
161
162 C<ghcn_fetch id -cou US -st NY -active 1900-1950 | ghcn_station_counts>
163
164 =head1 AUTHOR
165
166 Gary Puckering (jgpuckering@rogers.com)
167
168 =head1 LICENSE AND COPYRIGHT
169
170 Copyright 2022, Gary Puckering
171
172 =cut
173
174 1;