Saratoga meteoalarm error

Moved from PWS_dashboard to a new topic to get more attention

Hi Ken,
got these errors , has this to do with the new files ?
(At this moment my index page page is empty don’t know if this has to do with this problem )

[Sat Oct 21 07:07:54.099860 2023] [proxy_fcgi:error] [pid 30513:tid 140139858675456] [client 94.226.99.37:38624] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /var/www/vhosts/matar.be/httpdocs/weather/get-meteoalarm-warning-inc.php:393\nStack trace:\n#0 /var/www/vhosts/matar.be/httpdocs/weather/index.php(58): include_once()\n#1 {main}\n  thrown in /var/www/vhosts/matar.be/httpdocs/weather/get-meteoalarm-warning-inc.php on line 393'
[Sat Oct 21 07:14:39.589797 2023] [proxy_fcgi:error] [pid 41468:tid 140139959387904] [client 94.226.99.37:45820] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /var/www/vhosts/matar.be/httpdocs/weather/get-meteoalarm-warning-inc.php:393\nStack trace:\n#0 /var/www/vhosts/matar.be/httpdocs/weather/index.php(58): include_once()\n#1 {main}\n  thrown in /var/www/vhosts/matar.be/httpdocs/weather/get-meteoalarm-warning-inc.php on line 393'
[Sat Oct 21 07:14:41.825899 2023] [proxy_fcgi:error] [pid 41406:tid 140139883853568] [client 94.226.99.37:45848] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /var/www/vhosts/matar.be/httpdocs/weather/get-meteoalarm-warning-inc.php:393\nStack trace:\n#0 /var/www/vhosts/matar.be/httpdocs/weather/index.php(58): include_once()\n#1 {main}\n  thrown in /var/www/vhosts/matar.be/httpdocs/weather/get-meteoalarm-warning-inc.php on line 393'
[Sat Oct 21 07:15:08.250533 2023] [proxy_fcgi:error] [pid 41378:tid 140139833497344] [client 94.226.99.37:46072] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /var/www/vhosts/matar.be/httpdocs/weather/get-meteoalarm-warning-inc.php:393\nStack trace:\n#0 /var/www/vhosts/matar.be/httpdocs/weather/index.php(58): include_once()\n#1 {main}\n  thrown in /var/www/vhosts/matar.be/httpdocs/weather/get-meteoalarm-warning-inc.php on line 393'
[Sat Oct 21 11:42:58.530937 2023] [proxy_fcgi:error] [pid 4801:tid 140139841890048] [client 91.177.27.214:37884] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /var/www/vhosts/matar.be/httpdocs/weather/get-meteoalarm-warning-inc.php:393\nStack trace:\n#0 /var/www/vhosts/matar.be/httpdocs/weather/index.php(58): include_once()\n#1 {main}\n  thrown in /var/www/vhosts/matar.be/httpdocs/weather/get-meteoalarm-warning-inc.php on line 393', referer: https://www.matar.be/pwsWD/index.php

Kind regards
Patrick

It is night in California, so for now:
Script get-meteoalarm-warning-inc.php line 393 reads currently

if (!array_key_exists(‘warnings’, $array) || count($array[‘warnings’]) < 1) {

change that to

if (!is_array( $array ) || !array_key_exists(‘warnings’, $array) || count($array[‘warnings’]) < 1) {
that will solve it for now.

Wim

Thank you Wim to “act as a replacement” for Ken.
It solves the problem and the index page shows again the normal content.

Patrick

Your index page shows also

No current alerts for: “Antwerpen (BE002); Brabant (BE004); Limburg (BE007)”.

But for now the area codes used for Antwerpen and Limburg are BE21 and BE22
Add those other codes to your current settings

Page Check for updates list the used area codes for each country. Belgium is a mess to be honest. They use old and new codes.

Succes,
Wim

country code type last used areas
BE BE001 ktrue 0000-00-00 Luxembourg
BE BE002 ktrue 0000-00-00 Antwerpen
BE BE003 ktrue 0000-00-00 Oost Vlaanderen
BE BE004 EMMA_ID 2023-10-21 Brabant
BE BE005 ktrue 0000-00-00 Hainaut
BE BE006 ktrue 0000-00-00 Namur
BE BE007 ktrue 0000-00-00 Limburg
BE BE008 ktrue 0000-00-00 Liege
BE BE009 ktrue 0000-00-00 West Vlaanderen
BE BE21 NUTS2 2023-10-21 Antwerpen
BE BE22 NUTS2 2023-10-21 Limburg
BE BE23 NUTS2 2023-10-21 Ostflandern
BE BE25 NUTS2 2023-10-21 Westflandern
BE BE32 NUTS2 2023-10-21 Hennegau
BE BE33 NUTS2 2023-10-21 LĂźttich
BE BE34 NUTS2 2023-10-21 Luxemburg
BE BE35 NUTS2 2023-10-21 NamĂźr
BE BE801 EMMA_ID 2023-10-21 KĂźste

Problem is, these codes are not in Ken’s meteoalarm-codenames.json so the template doesn’t recognise the area names: “Name not available for”

The codes are in meteolarm-geocode-aliases.php:

  'BE21|NUTS2' => 'BE002',
  'BE22|NUTS2' => 'BE007',

but I don’t know what that means. :slightly_frowning_face:

WIm,
when I do that (use BE21 and BE22) I get some remarks :

Name not available forName not available for Name not available forName not available for

when I look at the page source

Name not available forName not available for<!-- get-meteoalarm-warning-inc: saved details to ./cache/meteoalarm-details.html file -->
Name not available forName not available for<!-- get-meteoalarm-warning-inc: saved summary to ./cache/meteoalarm-summary.html file -->
<!-- get-meteoalarm-warning-inc: begin ./cache/meteoalarm-summary.html -->

Apparently Antwerpen and Limburg are not recognized because the name is not diasplayed in the green line.

kr
Patrick

Hi Patrick,
Then you should not use BE21 and BE22

Regards,
Wim

Also i see a strange characters in that script in the line you added (392-396)

    $valid_data = true;
   
      // if (!array_key_exists('warnings', $array) || count($array['warnings']) < 1) { gives error PN
      
      if (!is_array( $array ) || !array_key_exists(�warnings�, $array) || count($array[�warnings�]) < 1) {

Better correct the strange characters in line line 396 from the old line 393 you commented as line 394.

My fault , I copy pasted from your message, probably not a good Idea, I corrected it manually.

Seems (?) ok now

I just looked at the spec for the CAP alerts from feeds.meteoalarm.org which says:

<geocode>
Info
Affected areas according to Meteoalarm specifications.
Syntax
<geocode>
<valueName>MeteoArea</valueName>
<value>{AreaCode}</value>
</geocode>
{AreaCode}
Affected areas according to Meteoalarm specifications (AreaKey).
The NUTS classification shall be used wherever possible. For other areas the "
[FIPS 10-4 region codes](http://www.meteoalarm.eu/mediawiki3/index.php/FIPS)" or the MeteoAlarm internal area codes(EMMA_ID) shall be used.

[Eurost at NUTS Nomenclature](http://epp.eurostat.ec.europa.eu/portal/page/portal/nuts_nomenclature/introduction)
Example Part Area
<area>
<areaDesc>Tirol</areaDesc>
<geocode>
<valueName>NUTS3</valueName>
<value>AT331</value>
</geocode>
</area>

Since they’re using a mix of NUTS and EMMA_ID codes in the alerts, the lookup in meteolarm-geocode-aliases.php does allow conversion of NUTS2/3 IDs in the alert to map to the (sometimes old) EMMA_IDs used by meteoalarm.org from the old instance of meteoalarm.eu. Whew…
The get-meteoalarm-warning-inc.php configuration should always use the EMMA_ID for the area and let the script do the conversion of NUTS2/3 to EMMA_ID.

I’ve done another update to remove the old UK0nn and UK1nn codes … they seem to be reporting only the UK2nn and UK3nn EMMA_ID codes now

https://discourse2.weather-watch.com/t/saratoga-meteoalarm-error/72495/12?u=bitsostring

Sorry, Ken, still seeing UK0nn and UK1nn codes on the map:



D’Oh… I had not removed the UK0nn, UK1nn codes from the data file driving the map…
Now fixed and UK shows in imperial Purple too :slight_smile:

Thanks for spotting the issue.

1 Like