| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Weather::YR::LocationForecast::Day; | 
| 2 | 3 |  |  | 3 |  | 26 | use Moose; | 
|  | 3 |  |  |  |  | 7 |  | 
|  | 3 |  |  |  |  | 31 |  | 
| 3 | 3 |  |  | 3 |  | 21532 | use namespace::autoclean; | 
|  | 3 |  |  |  |  | 8 |  | 
|  | 3 |  |  |  |  | 35 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | extends 'Weather::YR::Day'; | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | =head1 NAME | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | Weather::YR::LocationForecast::Day - Class that holds weather data for one day. | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | Don't use this class directly. Instead, access it via L<Weather::YR> and | 
| 14 |  |  |  |  |  |  | L<Weather::YR::LocationForecast>. | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | =cut | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | # Temperature | 
| 19 |  |  |  |  |  |  | has 'temperatures'    => ( isa => 'ArrayRef[Weather::YR::Model::Temperature]', is => 'ro', lazy_build => 1 ); | 
| 20 |  |  |  |  |  |  | has 'temperature'     => ( isa => 'Weather::YR::Model::Temperature',           is => 'ro', lazy_build => 1 ); | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | # Precipitation | 
| 23 |  |  |  |  |  |  | has 'precipitations' => ( isa => 'ArrayRef[Weather::YR::Model::Precipitation]', is => 'ro', lazy_build => 1 ); | 
| 24 |  |  |  |  |  |  | has 'precipitation'  => ( isa => 'Weather::YR::Model::Precipitation',           is => 'ro', lazy_build => 1 ); | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | # Wind direction | 
| 27 |  |  |  |  |  |  | has 'wind_directions' => ( isa => 'ArrayRef[Weather::YR::Model::WindDirection]', is => 'ro', lazy_build => 1 ); | 
| 28 |  |  |  |  |  |  | has 'wind_direction'  => ( isa => 'Weather::YR::Model::WindDirection',           is => 'ro', lazy_build => 1 ); | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | # Wind speed | 
| 31 |  |  |  |  |  |  | has 'wind_speeds'    => ( isa => 'ArrayRef[Weather::YR::Model::WindSpeed]', is => 'ro', lazy_build => 1 ); | 
| 32 |  |  |  |  |  |  | has 'wind_speed'     => ( isa => 'Weather::YR::Model::WindSpeed',           is => 'ro', lazy_build => 1 ); | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | # Humidity | 
| 35 |  |  |  |  |  |  | has 'humidities'   => ( isa => 'ArrayRef[Weather::YR::Model::Humidity]', is => 'ro', lazy_build => 1 ); | 
| 36 |  |  |  |  |  |  | has 'humidity'     => ( isa => 'Weather::YR::Model::Humidity',           is => 'ro', lazy_build => 1 ); | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | # Pressure | 
| 39 |  |  |  |  |  |  | has 'pressures'    => ( isa => 'ArrayRef[Weather::YR::Model::Pressure]', is => 'ro', lazy_build => 1 ); | 
| 40 |  |  |  |  |  |  | has 'pressure'     => ( isa => 'Weather::YR::Model::Pressure',           is => 'ro', lazy_build => 1 ); | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | # Cloudiness | 
| 43 |  |  |  |  |  |  | has 'cloudinesses'   => ( isa => 'ArrayRef[Weather::YR::Model::Cloudiness]', is => 'ro', lazy_build => 1 ); | 
| 44 |  |  |  |  |  |  | has 'cloudiness'     => ( isa => 'Weather::YR::Model::Cloudiness',           is => 'ro', lazy_build => 1 ); | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | # Fog | 
| 47 |  |  |  |  |  |  | has 'fogs'    => ( isa => 'ArrayRef[Weather::YR::Model::Fog]', is => 'ro', lazy_build => 1 ); | 
| 48 |  |  |  |  |  |  | has 'fog'     => ( isa => 'Weather::YR::Model::Fog',           is => 'ro', lazy_build => 1 ); | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | # Dew point temperature | 
| 51 |  |  |  |  |  |  | has 'dew_point_temperatures'    => ( isa => 'ArrayRef[Weather::YR::Model::DewPointTemperature]', is => 'ro', lazy_build => 1 ); | 
| 52 |  |  |  |  |  |  | has 'dew_point_temperature'     => ( isa => 'Weather::YR::Model::DewPointTemperature',           is => 'ro', lazy_build => 1 ); | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | =head1 METHODS | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | This class inherits all the methods from L<Weather::YR::Day> and provides the | 
| 57 |  |  |  |  |  |  | following new methods: | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | =cut | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | sub _ok_hour { | 
| 62 | 14 |  |  | 14 |  | 86 | my $self = shift; | 
| 63 | 14 |  |  |  |  | 30 | my $hour = shift; | 
| 64 |  |  |  |  |  |  |  | 
| 65 | 14 | 100 | 66 |  |  | 66 | if ( defined $hour && ($hour >= 12 && $hour <= 15) ) { | 
|  |  |  | 66 |  |  |  |  | 
| 66 | 7 |  |  |  |  | 19 | return 1; | 
| 67 |  |  |  |  |  |  | } | 
| 68 |  |  |  |  |  |  | else { | 
| 69 | 7 |  |  |  |  | 34 | return 0; | 
| 70 |  |  |  |  |  |  | } | 
| 71 |  |  |  |  |  |  | } | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | =head2 temperatures | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | Returns an array reference of all the L<Weather::YR::Model::Temperature> | 
| 76 |  |  |  |  |  |  | data points for this day. | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | =cut | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | sub _build_temperatures { | 
| 81 | 0 |  |  | 0 |  | 0 | my $self = shift; | 
| 82 |  |  |  |  |  |  |  | 
| 83 | 0 |  |  |  |  | 0 | return [ map { $_->temperature } @{$self->datapoints} ]; | 
|  | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 84 |  |  |  |  |  |  | } | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | =head2 temperature | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | Returns the "most logical" L<Weather::YR::Model::Temperature> data point for | 
| 89 |  |  |  |  |  |  | this day. | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | This works so that if you are working with "now", it will pick the data point | 
| 92 |  |  |  |  |  |  | closest to the current time. If you are working with any other days, including | 
| 93 |  |  |  |  |  |  | "today", it will return the data noon point, or the closest one after noon if | 
| 94 |  |  |  |  |  |  | there isn't one for noon. | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | =cut | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | sub _build_temperature { | 
| 99 | 0 |  |  | 0 |  | 0 | my $self = shift; | 
| 100 |  |  |  |  |  |  |  | 
| 101 | 0 |  |  |  |  | 0 | foreach ( @{$self->temperatures} ) { | 
|  | 0 |  |  |  |  | 0 |  | 
| 102 | 0 | 0 |  |  |  | 0 | if ( $self->_ok_hour($_->from->hour) ) { | 
| 103 | 0 |  |  |  |  | 0 | return $_; | 
| 104 |  |  |  |  |  |  | } | 
| 105 |  |  |  |  |  |  | } | 
| 106 |  |  |  |  |  |  |  | 
| 107 | 0 |  |  |  |  | 0 | return $self->temperatures->[0]; | 
| 108 |  |  |  |  |  |  | } | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  | =head2 precipitations | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | Returns an array reference of all the L<Weather::YR::Model::Precipitation> | 
| 113 |  |  |  |  |  |  | data points for this day. | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | =cut | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | sub _build_precipitations { | 
| 118 | 0 |  |  | 0 |  | 0 | my $self = shift; | 
| 119 |  |  |  |  |  |  |  | 
| 120 | 0 |  |  |  |  | 0 | my @precips = (); | 
| 121 |  |  |  |  |  |  |  | 
| 122 | 0 |  |  |  |  | 0 | foreach ( @{$self->datapoints} ) { | 
|  | 0 |  |  |  |  | 0 |  | 
| 123 | 0 |  |  |  |  | 0 | foreach ( @{$_->precipitations} ) { | 
|  | 0 |  |  |  |  | 0 |  | 
| 124 | 0 | 0 |  |  |  | 0 | if ( $_->from->ymd eq $self->date->ymd ) { | 
| 125 | 0 |  |  |  |  | 0 | push( @precips, $_ ); | 
| 126 |  |  |  |  |  |  | } | 
| 127 |  |  |  |  |  |  | } | 
| 128 |  |  |  |  |  |  | } | 
| 129 |  |  |  |  |  |  |  | 
| 130 | 0 |  |  |  |  | 0 | return \@precips; | 
| 131 |  |  |  |  |  |  | } | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | =head2 precipitation | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | Returns "the most logical" L<Weather::YR::Model::Precipitation> data point | 
| 136 |  |  |  |  |  |  | for this day. | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | This works so that if you are working with "now", it will pick the data point | 
| 139 |  |  |  |  |  |  | closest to the current time. If you are working with any other days, including | 
| 140 |  |  |  |  |  |  | "today", it will return the data noon point, or the closest one after noon if | 
| 141 |  |  |  |  |  |  | there isn't one for noon. | 
| 142 |  |  |  |  |  |  |  | 
| 143 |  |  |  |  |  |  | =cut | 
| 144 |  |  |  |  |  |  |  | 
| 145 |  |  |  |  |  |  | sub _build_precipitation { | 
| 146 | 0 |  |  | 0 |  | 0 | my $self = shift; | 
| 147 |  |  |  |  |  |  |  | 
| 148 | 0 |  |  |  |  | 0 | foreach ( @{$self->precipitations} ) { | 
|  | 0 |  |  |  |  | 0 |  | 
| 149 | 0 | 0 |  |  |  | 0 | if ( $self->_ok_hour($_->from->hour) ) { | 
| 150 | 0 |  |  |  |  | 0 | return $_; | 
| 151 |  |  |  |  |  |  | } | 
| 152 |  |  |  |  |  |  | } | 
| 153 |  |  |  |  |  |  |  | 
| 154 | 0 |  |  |  |  | 0 | return $self->precipitations->[0]; | 
| 155 |  |  |  |  |  |  | } | 
| 156 |  |  |  |  |  |  |  | 
| 157 |  |  |  |  |  |  | =head2 wind_directions | 
| 158 |  |  |  |  |  |  |  | 
| 159 |  |  |  |  |  |  | Returns an array reference of L<Weather::YR::Model::WindDirection> data points | 
| 160 |  |  |  |  |  |  | for this day. | 
| 161 |  |  |  |  |  |  |  | 
| 162 |  |  |  |  |  |  | =cut | 
| 163 |  |  |  |  |  |  |  | 
| 164 |  |  |  |  |  |  | sub _build_wind_directions { | 
| 165 | 1 |  |  | 1 |  | 2 | my $self = shift; | 
| 166 |  |  |  |  |  |  |  | 
| 167 | 1 |  |  |  |  | 3 | return [ map { $_->wind_direction } @{$self->datapoints} ]; | 
|  | 13 |  |  |  |  | 393 |  | 
|  | 1 |  |  |  |  | 26 |  | 
| 168 |  |  |  |  |  |  | } | 
| 169 |  |  |  |  |  |  |  | 
| 170 |  |  |  |  |  |  | =head2 wind_direction | 
| 171 |  |  |  |  |  |  |  | 
| 172 |  |  |  |  |  |  | Returns "the most logical" L<Weather::YR::Model::WindDirection> data point | 
| 173 |  |  |  |  |  |  | for this day. | 
| 174 |  |  |  |  |  |  |  | 
| 175 |  |  |  |  |  |  | This works so that if you are working with "now", it will pick the data point | 
| 176 |  |  |  |  |  |  | closest to the current time. If you are working with any other days, including | 
| 177 |  |  |  |  |  |  | "today", it will return the data noon point, or the closest one after noon if | 
| 178 |  |  |  |  |  |  | there isn't one for noon. | 
| 179 |  |  |  |  |  |  |  | 
| 180 |  |  |  |  |  |  | =cut | 
| 181 |  |  |  |  |  |  |  | 
| 182 |  |  |  |  |  |  | sub _build_wind_direction { | 
| 183 | 1 |  |  | 1 |  | 3 | my $self = shift; | 
| 184 |  |  |  |  |  |  |  | 
| 185 | 1 |  |  |  |  | 2 | foreach ( @{$self->wind_directions} ) { | 
|  | 1 |  |  |  |  | 35 |  | 
| 186 | 2 | 100 |  |  |  | 71 | if ( $self->_ok_hour($_->from->hour) ) { | 
| 187 | 1 |  |  |  |  | 31 | return $_; | 
| 188 |  |  |  |  |  |  | } | 
| 189 |  |  |  |  |  |  | } | 
| 190 |  |  |  |  |  |  |  | 
| 191 | 0 |  |  |  |  | 0 | return $self->wind_directions->[0]; | 
| 192 |  |  |  |  |  |  | } | 
| 193 |  |  |  |  |  |  |  | 
| 194 |  |  |  |  |  |  | =head2 wind_speeds | 
| 195 |  |  |  |  |  |  |  | 
| 196 |  |  |  |  |  |  | Returns an array reference of L<Weather::YR::Model::WindSpeed> data points | 
| 197 |  |  |  |  |  |  | for this day. | 
| 198 |  |  |  |  |  |  |  | 
| 199 |  |  |  |  |  |  | =cut | 
| 200 |  |  |  |  |  |  |  | 
| 201 |  |  |  |  |  |  | sub _build_wind_speeds { | 
| 202 | 1 |  |  | 1 |  | 3 | my $self = shift; | 
| 203 |  |  |  |  |  |  |  | 
| 204 | 1 |  |  |  |  | 2 | return [ map { $_->wind_speed } @{$self->datapoints} ]; | 
|  | 13 |  |  |  |  | 382 |  | 
|  | 1 |  |  |  |  | 27 |  | 
| 205 |  |  |  |  |  |  | } | 
| 206 |  |  |  |  |  |  |  | 
| 207 |  |  |  |  |  |  | =head2 wind_speed | 
| 208 |  |  |  |  |  |  |  | 
| 209 |  |  |  |  |  |  | Returns "the most logical" L<Weather::YR::Model::WindSpeed> data point | 
| 210 |  |  |  |  |  |  | for this day. | 
| 211 |  |  |  |  |  |  |  | 
| 212 |  |  |  |  |  |  | This works so that if you are working with "now", it will pick the data point | 
| 213 |  |  |  |  |  |  | closest to the current time. If you are working with any other days, including | 
| 214 |  |  |  |  |  |  | "today", it will return the data noon point, or the closest one after noon if | 
| 215 |  |  |  |  |  |  | there isn't one for noon. | 
| 216 |  |  |  |  |  |  |  | 
| 217 |  |  |  |  |  |  | =cut | 
| 218 |  |  |  |  |  |  |  | 
| 219 |  |  |  |  |  |  | sub _build_wind_speed { | 
| 220 | 1 |  |  | 1 |  | 5 | my $self = shift; | 
| 221 |  |  |  |  |  |  |  | 
| 222 | 1 |  |  |  |  | 3 | foreach ( @{$self->wind_speeds} ) { | 
|  | 1 |  |  |  |  | 34 |  | 
| 223 | 2 | 100 |  |  |  | 71 | if ( $self->_ok_hour($_->from->hour) ) { | 
| 224 | 1 |  |  |  |  | 32 | return $_; | 
| 225 |  |  |  |  |  |  | } | 
| 226 |  |  |  |  |  |  | } | 
| 227 |  |  |  |  |  |  |  | 
| 228 | 0 |  |  |  |  | 0 | return $self->wind_speeds->[0]; | 
| 229 |  |  |  |  |  |  | } | 
| 230 |  |  |  |  |  |  |  | 
| 231 |  |  |  |  |  |  | =head2 humidities | 
| 232 |  |  |  |  |  |  |  | 
| 233 |  |  |  |  |  |  | Returns an array reference of L<Weather::YR::Model::WindSpeed> data points | 
| 234 |  |  |  |  |  |  | for this day. | 
| 235 |  |  |  |  |  |  |  | 
| 236 |  |  |  |  |  |  | =cut | 
| 237 |  |  |  |  |  |  |  | 
| 238 |  |  |  |  |  |  | sub _build_humidities { | 
| 239 | 1 |  |  | 1 |  | 2 | my $self = shift; | 
| 240 |  |  |  |  |  |  |  | 
| 241 | 1 |  |  |  |  | 3 | return [ map { $_->humidity } @{$self->datapoints} ]; | 
|  | 13 |  |  |  |  | 379 |  | 
|  | 1 |  |  |  |  | 26 |  | 
| 242 |  |  |  |  |  |  | } | 
| 243 |  |  |  |  |  |  |  | 
| 244 |  |  |  |  |  |  | =head2 humidity | 
| 245 |  |  |  |  |  |  |  | 
| 246 |  |  |  |  |  |  | Returns "the most logical" L<Weather::YR::Model::Humidity> data point | 
| 247 |  |  |  |  |  |  | for this day. | 
| 248 |  |  |  |  |  |  |  | 
| 249 |  |  |  |  |  |  | This works so that if you are working with "now", it will pick the data point | 
| 250 |  |  |  |  |  |  | closest to the current time. If you are working with any other days, including | 
| 251 |  |  |  |  |  |  | "today", it will return the data noon point, or the closest one after noon if | 
| 252 |  |  |  |  |  |  | there isn't one for noon. | 
| 253 |  |  |  |  |  |  |  | 
| 254 |  |  |  |  |  |  | =cut | 
| 255 |  |  |  |  |  |  |  | 
| 256 |  |  |  |  |  |  | sub _build_humidity { | 
| 257 | 1 |  |  | 1 |  | 3 | my $self = shift; | 
| 258 |  |  |  |  |  |  |  | 
| 259 | 1 |  |  |  |  | 2 | foreach ( @{$self->humidities} ) { | 
|  | 1 |  |  |  |  | 33 |  | 
| 260 | 2 | 100 |  |  |  | 72 | if ( $self->_ok_hour($_->from->hour) ) { | 
| 261 | 1 |  |  |  |  | 30 | return $_; | 
| 262 |  |  |  |  |  |  | } | 
| 263 |  |  |  |  |  |  | } | 
| 264 |  |  |  |  |  |  |  | 
| 265 | 0 |  |  |  |  | 0 | return $self->humidities->[0]; | 
| 266 |  |  |  |  |  |  | } | 
| 267 |  |  |  |  |  |  |  | 
| 268 |  |  |  |  |  |  | =head2 pressures | 
| 269 |  |  |  |  |  |  |  | 
| 270 |  |  |  |  |  |  | Returns an array reference of L<Weather::YR::Model::Pressure> data points | 
| 271 |  |  |  |  |  |  | for this day. | 
| 272 |  |  |  |  |  |  |  | 
| 273 |  |  |  |  |  |  | =cut | 
| 274 |  |  |  |  |  |  |  | 
| 275 |  |  |  |  |  |  | sub _build_pressures { | 
| 276 | 1 |  |  | 1 |  | 2 | my $self = shift; | 
| 277 |  |  |  |  |  |  |  | 
| 278 | 1 |  |  |  |  | 3 | return [ map { $_->pressure } @{$self->datapoints} ]; | 
|  | 13 |  |  |  |  | 396 |  | 
|  | 1 |  |  |  |  | 26 |  | 
| 279 |  |  |  |  |  |  | } | 
| 280 |  |  |  |  |  |  |  | 
| 281 |  |  |  |  |  |  | =head2 pressure | 
| 282 |  |  |  |  |  |  |  | 
| 283 |  |  |  |  |  |  | Returns "the most logical" L<Weather::YR::Model::Humidity> data point | 
| 284 |  |  |  |  |  |  | for this day. | 
| 285 |  |  |  |  |  |  |  | 
| 286 |  |  |  |  |  |  | This works so that if you are working with "now", it will pick the data point | 
| 287 |  |  |  |  |  |  | closest to the current time. If you are working with any other days, including | 
| 288 |  |  |  |  |  |  | "today", it will return the data noon point, or the closest one after noon if | 
| 289 |  |  |  |  |  |  | there isn't one for noon. | 
| 290 |  |  |  |  |  |  |  | 
| 291 |  |  |  |  |  |  | =cut | 
| 292 |  |  |  |  |  |  |  | 
| 293 |  |  |  |  |  |  | sub _build_pressure { | 
| 294 | 1 |  |  | 1 |  | 3 | my $self = shift; | 
| 295 |  |  |  |  |  |  |  | 
| 296 | 1 |  |  |  |  | 3 | foreach ( @{$self->pressures} ) { | 
|  | 1 |  |  |  |  | 34 |  | 
| 297 | 2 | 100 |  |  |  | 57 | if ( $self->_ok_hour($_->from->hour) ) { | 
| 298 | 1 |  |  |  |  | 31 | return $_; | 
| 299 |  |  |  |  |  |  | } | 
| 300 |  |  |  |  |  |  | } | 
| 301 |  |  |  |  |  |  |  | 
| 302 | 0 |  |  |  |  | 0 | return $self->pressures->[0]; | 
| 303 |  |  |  |  |  |  | } | 
| 304 |  |  |  |  |  |  |  | 
| 305 |  |  |  |  |  |  | =head2 cloudinesses | 
| 306 |  |  |  |  |  |  |  | 
| 307 |  |  |  |  |  |  | Returns an array reference of L<Weather::YR::Model::Cloudiness> data points | 
| 308 |  |  |  |  |  |  | for this day. | 
| 309 |  |  |  |  |  |  |  | 
| 310 |  |  |  |  |  |  | =cut | 
| 311 |  |  |  |  |  |  |  | 
| 312 |  |  |  |  |  |  | sub _build_cloudinesses { | 
| 313 | 1 |  |  | 1 |  | 2 | my $self = shift; | 
| 314 |  |  |  |  |  |  |  | 
| 315 | 1 |  |  |  |  | 2 | return [ map { $_->cloudiness } @{$self->datapoints} ]; | 
|  | 13 |  |  |  |  | 383 |  | 
|  | 1 |  |  |  |  | 27 |  | 
| 316 |  |  |  |  |  |  | } | 
| 317 |  |  |  |  |  |  |  | 
| 318 |  |  |  |  |  |  | =head2 cloudiness | 
| 319 |  |  |  |  |  |  |  | 
| 320 |  |  |  |  |  |  | Returns "the most logical" L<Weather::YR::Model::Cloudiness> data point | 
| 321 |  |  |  |  |  |  | for this day. | 
| 322 |  |  |  |  |  |  |  | 
| 323 |  |  |  |  |  |  | This works so that if you are working with "now", it will pick the data point | 
| 324 |  |  |  |  |  |  | closest to the current time. If you are working with any other days, including | 
| 325 |  |  |  |  |  |  | "today", it will return the data noon point, or the closest one after noon if | 
| 326 |  |  |  |  |  |  | there isn't one for noon. | 
| 327 |  |  |  |  |  |  |  | 
| 328 |  |  |  |  |  |  | =cut | 
| 329 |  |  |  |  |  |  |  | 
| 330 |  |  |  |  |  |  | sub _build_cloudiness { | 
| 331 | 1 |  |  | 1 |  | 3 | my $self = shift; | 
| 332 |  |  |  |  |  |  |  | 
| 333 | 1 |  |  |  |  | 2 | foreach ( @{$self->cloudinesses} ) { | 
|  | 1 |  |  |  |  | 42 |  | 
| 334 | 2 | 100 |  |  |  | 58 | if ( $self->_ok_hour($_->from->hour) ) { | 
| 335 | 1 |  |  |  |  | 32 | return $_; | 
| 336 |  |  |  |  |  |  | } | 
| 337 |  |  |  |  |  |  | } | 
| 338 |  |  |  |  |  |  |  | 
| 339 | 0 |  |  |  |  | 0 | return $self->cloudinesses->[0]; | 
| 340 |  |  |  |  |  |  | } | 
| 341 |  |  |  |  |  |  |  | 
| 342 |  |  |  |  |  |  | =head2 fogs | 
| 343 |  |  |  |  |  |  |  | 
| 344 |  |  |  |  |  |  | Returns an array reference of L<Weather::YR::Model::Fog> data points | 
| 345 |  |  |  |  |  |  | for this day. | 
| 346 |  |  |  |  |  |  |  | 
| 347 |  |  |  |  |  |  | =cut | 
| 348 |  |  |  |  |  |  |  | 
| 349 |  |  |  |  |  |  | sub _build_fogs { | 
| 350 | 1 |  |  | 1 |  | 3 | my $self = shift; | 
| 351 |  |  |  |  |  |  |  | 
| 352 | 1 |  |  |  |  | 2 | return [ map { $_->fog } @{$self->datapoints} ]; | 
|  | 13 |  |  |  |  | 375 |  | 
|  | 1 |  |  |  |  | 29 |  | 
| 353 |  |  |  |  |  |  | } | 
| 354 |  |  |  |  |  |  |  | 
| 355 |  |  |  |  |  |  | =head2 fog | 
| 356 |  |  |  |  |  |  |  | 
| 357 |  |  |  |  |  |  | Returns "the most logical" L<Weather::YR::Model::Fog> data point | 
| 358 |  |  |  |  |  |  | for this day. | 
| 359 |  |  |  |  |  |  |  | 
| 360 |  |  |  |  |  |  | This works so that if you are working with "now", it will pick the data point | 
| 361 |  |  |  |  |  |  | closest to the current time. If you are working with any other days, including | 
| 362 |  |  |  |  |  |  | "today", it will return the data noon point, or the closest one after noon if | 
| 363 |  |  |  |  |  |  | there isn't one for noon. | 
| 364 |  |  |  |  |  |  |  | 
| 365 |  |  |  |  |  |  | =cut | 
| 366 |  |  |  |  |  |  |  | 
| 367 |  |  |  |  |  |  | sub _build_fog { | 
| 368 | 1 |  |  | 1 |  | 2 | my $self = shift; | 
| 369 |  |  |  |  |  |  |  | 
| 370 | 1 |  |  |  |  | 3 | foreach ( @{$self->fogs} ) { | 
|  | 1 |  |  |  |  | 68 |  | 
| 371 | 2 | 100 |  |  |  | 60 | if ( $self->_ok_hour($_->from->hour) ) { | 
| 372 | 1 |  |  |  |  | 29 | return $_; | 
| 373 |  |  |  |  |  |  | } | 
| 374 |  |  |  |  |  |  | } | 
| 375 |  |  |  |  |  |  |  | 
| 376 | 0 |  |  |  |  | 0 | return $self->fogs->[0]; | 
| 377 |  |  |  |  |  |  | } | 
| 378 |  |  |  |  |  |  |  | 
| 379 |  |  |  |  |  |  | =head2 dew_point_temperatures | 
| 380 |  |  |  |  |  |  |  | 
| 381 |  |  |  |  |  |  | Returns an array reference of L<Weather::YR::Model::DewPointTemperature> data points | 
| 382 |  |  |  |  |  |  | for this day. | 
| 383 |  |  |  |  |  |  |  | 
| 384 |  |  |  |  |  |  | =cut | 
| 385 |  |  |  |  |  |  |  | 
| 386 |  |  |  |  |  |  | sub _build_dew_point_temperatures { | 
| 387 | 1 |  |  | 1 |  | 3 | my $self = shift; | 
| 388 |  |  |  |  |  |  |  | 
| 389 | 1 |  |  |  |  | 2 | return [ map { $_->dew_point_temperature } @{$self->datapoints} ]; | 
|  | 13 |  |  |  |  | 419 |  | 
|  | 1 |  |  |  |  | 26 |  | 
| 390 |  |  |  |  |  |  | } | 
| 391 |  |  |  |  |  |  |  | 
| 392 |  |  |  |  |  |  | =head2 dew_point_temperature | 
| 393 |  |  |  |  |  |  |  | 
| 394 |  |  |  |  |  |  | Returns "the most logical" L<Weather::YR::Model::DewPointTemperature> data point | 
| 395 |  |  |  |  |  |  | for this day. | 
| 396 |  |  |  |  |  |  |  | 
| 397 |  |  |  |  |  |  | This works so that if you are working with "now", it will pick the data point | 
| 398 |  |  |  |  |  |  | closest to the current time. If you are working with any other days, including | 
| 399 |  |  |  |  |  |  | "today", it will return the data noon point, or the closest one after noon if | 
| 400 |  |  |  |  |  |  | there isn't one for noon. | 
| 401 |  |  |  |  |  |  |  | 
| 402 |  |  |  |  |  |  | =cut | 
| 403 |  |  |  |  |  |  |  | 
| 404 |  |  |  |  |  |  | sub _build_dew_point_temperature { | 
| 405 | 1 |  |  | 1 |  | 3 | my $self = shift; | 
| 406 |  |  |  |  |  |  |  | 
| 407 | 1 |  |  |  |  | 2 | foreach ( @{$self->dew_point_temperatures} ) { | 
|  | 1 |  |  |  |  | 35 |  | 
| 408 | 2 | 100 |  |  |  | 57 | if ( $self->_ok_hour($_->from->hour) ) { | 
| 409 | 1 |  |  |  |  | 32 | return $_; | 
| 410 |  |  |  |  |  |  | } | 
| 411 |  |  |  |  |  |  | } | 
| 412 |  |  |  |  |  |  |  | 
| 413 | 0 |  |  |  |  |  | return $self->dew_point_temperatures->[0]; | 
| 414 |  |  |  |  |  |  | } | 
| 415 |  |  |  |  |  |  |  | 
| 416 |  |  |  |  |  |  | # | 
| 417 |  |  |  |  |  |  | # The End | 
| 418 |  |  |  |  |  |  | # | 
| 419 |  |  |  |  |  |  | __PACKAGE__->meta->make_immutable; | 
| 420 |  |  |  |  |  |  |  | 
| 421 |  |  |  |  |  |  | 1; |