Weather::Meteo - Interface to https://open-meteo.com for historical weather data
Version 0.08
use Weather::Meteo; my $meteo = Weather::Meteo->new(); my $weather = $meteo->weather({ latitude => 0.1, longitude => 0.2, date => '2022-12-25' });
Weather::Meteo provides an interface to open-meteo.com for historical weather data from 1940.
my $meteo = Weather::Meteo->new(); my $ua = LWP::UserAgent->new(); $ua->env_proxy(1); $meteo = Weather::Meteo->new(ua => $ua); my $weather = $meteo->weather({ latitude => 51.34, longitude => 1.42, date => '2022-12-25' }); my @snowfall = @{$weather->{'hourly'}->{'snowfall'}}; print 'Number of cms of snow: ', $snowfall[1], "\n";
use Geo::Location::Point; my $ramsgate = Geo::Location::Point->new({ latitude => 51.34, longitude => 1.42 }); # Print snowfall at 1AM on Christmas morning in Ramsgate $weather = $meteo->weather($ramsgate, '2022-12-25'); @snowfall = @{$weather->{'hourly'}->{'snowfall'}}; print 'Number of cms of snow: ', $snowfall[1], "\n";
Takes an optional argument, tz, which defaults to 'Europe/London'. For that to work set TIMEZONEDB_KEY to be your API key from https://timezonedb.com.
Accessor method to get and set UserAgent object used internally. You can call env_proxy for example, to get the proxy information from environment variables:
$meteo->ua()->env_proxy(1);
You can also set your own User-Agent object:
use LWP::UserAgent::Throttled; my $ua = LWP::UserAgent::Throttled->new(); $ua->throttle('open-meteo.com' => 1); $meteo->ua($ua);
Nigel Horne, <njh@bandsman.co.uk>
<njh@bandsman.co.uk>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Lots of thanks to the folks at https://open-meteo.com.
Open Meteo API: https://open-meteo.com/en/docs#api_form
You can find documentation for this module with the perldoc command.
perldoc Weather::Meteo
You can also look for information at:
MetaCPAN
https://metacpan.org/release/Weather-Meteo
RT: CPAN's request tracker
https://rt.cpan.org/NoAuth/Bugs.html?Dist=Weather-Meteo
CPANTS
http://cpants.cpanauthors.org/dist/Weather-Meteo
CPAN Testers' Matrix
http://matrix.cpantesters.org/?dist=Weather-Meteo
CPAN Testers Dependencies
http://deps.cpantesters.org/?module=Weather-Meteo
Copyright 2023 Nigel Horne.
This program is released under the following licence: GPL2
To install Weather::Meteo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Weather::Meteo
CPAN shell
perl -MCPAN -e shell install Weather::Meteo
For more information on module installation, please visit the detailed CPAN module installation guide.