line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
#=============================================================================== |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# FILE: Place.pm |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# DESCRIPTION: creates Geo::ReadGRIB::Place objects |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# FILES: --- |
9
|
|
|
|
|
|
|
# BUGS: --- |
10
|
|
|
|
|
|
|
# NOTES: --- |
11
|
|
|
|
|
|
|
# AUTHOR: Frank Lyon Cox (Dr), |
12
|
|
|
|
|
|
|
# COMPANY: Practial Wizardry |
13
|
|
|
|
|
|
|
# VERSION: 1.0 |
14
|
|
|
|
|
|
|
# CREATED: 2/3/2009 10:42:57 PM Pacific Standard Time |
15
|
|
|
|
|
|
|
# REVISION: --- |
16
|
|
|
|
|
|
|
#=============================================================================== |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package Geo::ReadGRIB::Place; |
19
|
|
|
|
|
|
|
|
20
|
12
|
|
|
12
|
|
65
|
use strict; |
|
12
|
|
|
|
|
21
|
|
|
12
|
|
|
|
|
394
|
|
21
|
12
|
|
|
12
|
|
85
|
use warnings; |
|
12
|
|
|
|
|
113
|
|
|
12
|
|
|
|
|
4994
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = 1.0; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#-------------------------------------------------------------------------- |
26
|
|
|
|
|
|
|
# new( ) |
27
|
|
|
|
|
|
|
#-------------------------------------------------------------------------- |
28
|
|
|
|
|
|
|
sub new { |
29
|
605
|
|
|
605
|
1
|
712
|
my $class = shift; |
30
|
605
|
|
|
|
|
740
|
my $self = {}; |
31
|
605
|
|
|
|
|
1268
|
bless $self, $class; |
32
|
605
|
|
|
|
|
1583
|
return $self; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
#-------------------------------------------------------------------------- |
36
|
|
|
|
|
|
|
# thisTime( ) |
37
|
|
|
|
|
|
|
#-------------------------------------------------------------------------- |
38
|
|
|
|
|
|
|
sub thisTime { |
39
|
2418
|
|
|
2418
|
1
|
2708
|
my $self = shift; |
40
|
2418
|
|
|
|
|
6626
|
my $arg = shift; |
41
|
2418
|
100
|
|
|
|
5426
|
$self->{time} = $arg if defined $arg; |
42
|
2418
|
|
|
|
|
7076
|
return $self->{time}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
#-------------------------------------------------------------------------- |
46
|
|
|
|
|
|
|
# lat( ) |
47
|
|
|
|
|
|
|
#-------------------------------------------------------------------------- |
48
|
|
|
|
|
|
|
sub lat { |
49
|
1813
|
|
|
1813
|
1
|
1953
|
my $self = shift; |
50
|
1813
|
|
|
|
|
2123
|
my $arg = shift; |
51
|
1813
|
100
|
|
|
|
3538
|
$self->{lat} = $arg if defined $arg; |
52
|
1813
|
|
|
|
|
5355
|
return $self->{lat}; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
#-------------------------------------------------------------------------- |
56
|
|
|
|
|
|
|
# long( ) |
57
|
|
|
|
|
|
|
#-------------------------------------------------------------------------- |
58
|
|
|
|
|
|
|
sub long { |
59
|
1813
|
|
|
1813
|
1
|
2128
|
my $self = shift; |
60
|
1813
|
|
|
|
|
1925
|
my $arg = shift; |
61
|
1813
|
100
|
|
|
|
3454
|
$self->{long} = $arg if defined $arg; |
62
|
1813
|
|
|
|
|
5508
|
return $self->{long}; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
#-------------------------------------------------------------------------- |
66
|
|
|
|
|
|
|
# types( ) |
67
|
|
|
|
|
|
|
# |
68
|
|
|
|
|
|
|
# returns an array ref of type names |
69
|
|
|
|
|
|
|
#-------------------------------------------------------------------------- |
70
|
|
|
|
|
|
|
sub types { |
71
|
604
|
|
|
604
|
1
|
701
|
my $self = shift; |
72
|
604
|
|
|
|
|
888
|
my $arg = shift; |
73
|
604
|
50
|
|
|
|
1302
|
push @{$self->{types}}, $arg if defined $arg; |
|
604
|
|
|
|
|
1684
|
|
74
|
604
|
|
|
|
|
1435
|
return $self->{types}; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
#-------------------------------------------------------------------------- |
78
|
|
|
|
|
|
|
# data( type_name ) |
79
|
|
|
|
|
|
|
# |
80
|
|
|
|
|
|
|
# takes a type_name and returns the associated data |
81
|
|
|
|
|
|
|
#-------------------------------------------------------------------------- |
82
|
|
|
|
|
|
|
sub data { |
83
|
1208
|
|
|
1208
|
1
|
1971
|
my $self = shift; |
84
|
1208
|
|
|
|
|
1211
|
my $type = shift; |
85
|
1208
|
|
|
|
|
1304
|
my $data = shift; |
86
|
|
|
|
|
|
|
|
87
|
1208
|
100
|
|
|
|
2844
|
$self->{data}->{$type} = $data if defined $data; |
88
|
|
|
|
|
|
|
|
89
|
1208
|
50
|
|
|
|
13230
|
if ( not defined $self->{data}->{$type} ) { |
90
|
0
|
|
|
|
|
0
|
warn "Place: Not a valid type: $type\n"; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
1208
|
|
|
|
|
4516
|
return $self->{data}->{$type}; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 NAME |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Geo::ReadGRIB::Place - Contains the value of a one or more data type at a given |
100
|
|
|
|
|
|
|
time and geographic location. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 VERSION |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This documentation refers to Geo::ReadGRIB::Place version 1.0 as returned by |
105
|
|
|
|
|
|
|
a call to Geo::ReadGRIB::PlaceIterator::Current() |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 SYNOPSIS |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
use Geo::ReadGRIB; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
$w = new Geo::ReadGRIB "grib-file"; |
113
|
|
|
|
|
|
|
$w->getFullCatalog; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
print $w->show,"\n"; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
$plit = $w->extractLaLo(data_type, lat1, long1, lat2, long2, time); |
118
|
|
|
|
|
|
|
die $w->getError if $w->getError; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
# $plit is a Geo::ReadGRIB::PlaceIterator |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
while ( $place = $plit->current() and $plit->next ) { |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# $place is a Geo::ReadGRIB::Place object |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
$time = $place->thisTime; |
127
|
|
|
|
|
|
|
$latitude = $place->lat; |
128
|
|
|
|
|
|
|
$longitude = $place->long; |
129
|
|
|
|
|
|
|
$data_types = $place->types; # an array ref of type names |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
$data = $place->data( data_type ); |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
# process data... |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 DESCRIPTION |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Objects of this class are returned by the current() method of a |
140
|
|
|
|
|
|
|
PlaceIterator object which itself has been returned by the |
141
|
|
|
|
|
|
|
extractLaLo() or extract() methods of a Geo::ReadGRIB object. A place |
142
|
|
|
|
|
|
|
object has a unique latitude and longitude for one time and has data |
143
|
|
|
|
|
|
|
for one or more data types. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 METHODS |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Objects of this class are read only and all parameters may be |
148
|
|
|
|
|
|
|
accessed by the following methods. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=over 4 |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item $object->new; |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item $object->thisTime; |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item $object->lat; |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=item $object->long; |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item $object->types; |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=item $object->data(type); |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=back |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
There are no known bugs in this module. Please report problems through |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
http://rt.cpan.org |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
or contact Frank Cox, Patches are welcome. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 AUTHOR |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Frank Cox, Efrank.l.cox@gmail.comE |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Copyright (C) 2009 by Frank Cox |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
183
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.4 or, |
184
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=cut |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
1; |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
|