Author Topic: wxstatus, NOAA Reports and Meteobridge.  (Read 1056 times)

0 Members and 1 Guest are viewing this topic.

Offline ConligWX

  • Forecaster
  • *****
  • Posts: 839
  • #conligwx
    • conligwx.org
wxstatus, NOAA Reports and Meteobridge.
« on: May 18, 2020, 05:45:39 PM »
Probably not possible, but here goes....

Using Ken's Saratoga Template (BASE+Meteobridge Plugin)

I have Meteobridge template create Monthly/Yearly NOAA styled reports in the same filename format as Cumulus. The wxnoaareports.php script works fine and I keep to the same format as Cumulus Filenames.

My question is, is it possible for a "php script" to check a file timestamp based on the latest file within a directory and use this to add to wxstatus, so I can check the NOAA reports status is current?

I know wxstauts.php and include-wxstatus.php check for specific filenames in the NOAA checking of CU, WD, VWS etc however Meteobridge does not create this type of standard file to be checked.

The only thing MB has created is the

/NOAA-reports/NOAAMO[MM][YY].txt and  /NOAA-reports/NOAAYR[YYYY].txt

So, is it possible with some type of php code to just look for the latest timestamp and then use this as a way of reporting a "current" NOAA Monthly file?

I'm just curious.
Regards Simon
Davis Vantage Pro2 Plus (6162UK) • Daytime FARS • WeatherLink Live • AirLink • PurpleAir PA-II-SD • CumulusMX •


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #1 on: May 18, 2020, 07:30:33 PM »
That's the scheme used for Cumulus NOAA reports in include-NOAA-reports.php.

// Cumulus naming format
//    NOAAMOmmyy.txt for month  (e.g. NOAA0811.txt for August, 2011 monthly report)
//    NOAAYRyyyy.txt for year   (e.g. NOAA2011.txt for 2011 yearly report)

You can get this behavior (I think) by 'tricking' the script into searching for it by changing wxnoaaclimatereports.php from
Code: [Select]
<div id="main-copy">
 
<h1><?php langtrans('NOAA-Style Climate Reports'); ?></h1>
   
    <?php include_once("include-NOAA-reports.php"?>
   
</div><!-- end main-copy -->
to
Code: [Select]
<div id="main-copy">
 
<h1><?php langtrans('NOAA-Style Climate Reports'); ?></h1>
   
    <?php 
$saveWXType 
$SITE['WXsoftware'];
$SITE['WXsoftware']     = 'CU';
$SITE['NOAAdir']        = './NOAA-reports//';   // relative location of the NOAA report files
include_once("include-NOAA-reports.php"
$SITE['WXsoftware']     = $saveWXType;

?>

   
</div><!-- end main-copy -->

Give that a try...
« Last Edit: May 18, 2020, 07:32:40 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline ConligWX

  • Forecaster
  • *****
  • Posts: 839
  • #conligwx
    • conligwx.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #2 on: May 19, 2020, 02:37:28 AM »
I dont appear to have that file.

only wxnoaareports.php and NOAA-reports.php

the version on your website doesnt seem to include CU.  this one I have is from here: https://cumulus.hosiene.co.uk/viewtopic.php?f=14&t=5754 (I think)

in include-wxstatus.php there is code for checking the NOAA reports.

Code: [Select]
// checks for optional NOAA-style report updates
  if($SITE['WXsoftware'] == 'CU' and isset($WX['LatestNOAAMonthlyReport']) and
file_exists($SITE['NOAAdir'].$WX['LatestNOAAMonthlyReport'])) {
do_check($SITE['WXsoftwareLongName']." ".langtransstr("NOAA report"),
  $SITE['NOAAdir'].$WX['LatestNOAAMonthlyReport'],24*60*60+10*60,'file');
  }

  if($SITE['WXsoftware'] == 'VWS' and file_exists($SITE['NOAAdir'].'noaamo.txt')) {
do_check($SITE['WXsoftwareLongName']." ".langtransstr("NOAA report"),
  $SITE['NOAAdir'].'noaamo.txt',60*65+15,'file');
  }

  if($SITE['WXsoftware'] == 'WD' and
file_exists($SITE['HistoryFilesDir'].'dailynoaareport.htm')) {
do_check($SITE['WXsoftwareLongName']." ".langtransstr("NOAA report"),
  $SITE['HistoryFilesDir'].'dailynoaareport.htm',24*60*60+15*60,'file');
  }
 
  $MYYYYfile = date('FY') . '.htm'; // generates the <Monthname><YYYY>.htm filename used by WD
  if($SITE['WXsoftware'] == 'WD' and file_exists($SITE['HistoryFilesDir'].$MYYYYfile)) {
do_check($SITE['WXsoftwareLongName']." ".langtransstr("Month report"),
  $SITE['HistoryFilesDir'].$MYYYYfile,24*60*60+15*60,'file');
  }

  if($SITE['WXsoftware'] == 'WL' and file_exists($SITE['NOAACurDir'].'NOAAMO.TXT')) {
do_check($SITE['WXsoftwareLongName']." ".langtransstr("NOAA report"),
  $SITE['NOAACurDir'].'NOAAMO.TXT',60*5+15,'file');
  }

  if($SITE['WXsoftware'] == 'WLCOM') {
$uoms = $SITE['uomTemp'].$SITE['uomBaro'].$SITE['uomWind'].$SITE['uomRain'].
          $SITE['uomSnow'].$SITE['uomDistance'].$SITE['uomPerHour'];
$from = array('/',' ','&deg;','.php');
$to = '';
$testFile = $SITE['cacheFileDir'].
str_replace ($from, $to,
'weatherlinkcom-yday-'.$SITE['WLCOMdid'].'_'.$uoms.'.txt');  // add uoms to filename


    do_check($SITE['WXsoftwareLongName']." ".langtransstr("Yesterday Data").
  ' [ <a href="'.$SITE['cacheFileDir'].'LOG_saveYesterday.php.txt">'.langtransstr('View Log').']</a> ]',
    $testFile,1440*60+15,'file');
  }

  if($SITE['WXsoftware'] == 'AWN') {
$uoms = $SITE['uomTemp'].$SITE['uomBaro'].$SITE['uomWind'].$SITE['uomRain'].
          $SITE['uomSnow'].$SITE['uomDistance'].$SITE['uomPerHour'];
$from = array('/',' ','&deg;','.php');
$to = '';
  $did = str_replace(':','',$SITE['AWNdid']);
    $testFile = $SITE['cacheFileDir'].
    str_replace ($from, $to,
       'ambientweathernet-yday-'.$did.'_'.$uoms.'.txt');  // add uoms to filename

    do_check($SITE['WXsoftwareLongName']." ".langtransstr("Yesterday Data").
  ' [ <a href="'.$SITE['cacheFileDir'].'LOG_saveYesterday.php.txt">'.langtransstr('View Log').']</a> ]',
    $testFile,1440*60+15,'file');
  }
« Last Edit: May 19, 2020, 03:30:19 AM by ConligWX »
Regards Simon
Davis Vantage Pro2 Plus (6162UK) • Daytime FARS • WeatherLink Live • AirLink • PurpleAir PA-II-SD • CumulusMX •


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #3 on: May 19, 2020, 10:57:57 AM »
The include-NOAA-reports.php and wxnoaaclimatereports.php scripts are in the CU-plugin.zip distribution.. You can download and extract them from there.  I'd not added that feature to the MB-plugin.zip as that capability (producing NOAA-style reports) wasn't in the version of Meteobridge when the plugin was written.  If it's now a standard feature for Meteobridge, I'll add it to the plugin :)

Looking through the Meteobridge Wiki and Forum, it looks like the NOAA reports feature is only available to Meteobridge PRO and NANO/SD versions, not to the plain Meteobridge version .. is that correct?
« Last Edit: May 19, 2020, 11:47:56 AM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline ConligWX

  • Forecaster
  • *****
  • Posts: 839
  • #conligwx
    • conligwx.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #4 on: May 19, 2020, 11:13:11 AM »
The feature is a Template you can export to anywhere and has been since Nov 2018.

There are two templates files by default in the \\MB.IP.ADDRESS\data\templates
I created my own UK one too.

NOAA-monthly-imp.exp
NOAA-monthly-iso.exp
NOAA-monthly-uk.exp

The NOAA Reports filenames exported and ftp'd can be named anything, though I used the same filename convention as CU as I came from CumulusMX and had some old reports already.

NOAAMO[MM][YY].txt
NOAAYR[YYYY].txt


I've attached a screenshot of my NOAA setup in MB as an example.

 [ You are not allowed to view attachments ]


« Last Edit: May 19, 2020, 11:14:45 AM by ConligWX »
Regards Simon
Davis Vantage Pro2 Plus (6162UK) • Daytime FARS • WeatherLink Live • AirLink • PurpleAir PA-II-SD • CumulusMX •


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #5 on: May 19, 2020, 11:54:12 AM »
Hmmm.. is that a MB Pro or NANO/SD screen?

My just updated plain Meteobridge doesn't show a 'Data Export' option in the Services tab.

Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #6 on: May 19, 2020, 12:24:57 PM »
Hi,
data export:
apparently only for Meteobridge PRO & NANO SD:
see https://meteobridge.com/wiki/index.php/Forum
released in January  2020
Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be

Offline ConligWX

  • Forecaster
  • *****
  • Posts: 839
  • #conligwx
    • conligwx.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #7 on: May 19, 2020, 12:43:06 PM »
2020? I'm looking on the same page but  November 2018 when it was released. I requested this feature with boris in an email then and he kindly implemented it.

Yes you are right for meteobrige nano SD and pro only.

I have noaa reportss working with MB set as CU so not an issue. Just really needed a way of getting nooa reports to show current data into the wxstatus page.

anyway not a deal breaker really.

Sent from my GM1913 using Tapatalk
« Last Edit: May 19, 2020, 12:54:18 PM by ConligWX »
Regards Simon
Davis Vantage Pro2 Plus (6162UK) • Daytime FARS • WeatherLink Live • AirLink • PurpleAir PA-II-SD • CumulusMX •


Offline zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #8 on: May 19, 2020, 12:57:07 PM »
Hi,
you're correct my error 2018
page is somehow difficult to interpret for me, I have a meteobridge since beginning of this month, still have to learn all possibilities and search how to use them.
Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be

Offline ConligWX

  • Forecaster
  • *****
  • Posts: 839
  • #conligwx
    • conligwx.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #9 on: May 19, 2020, 12:59:09 PM »
Hmmm.. is that a MB Pro or NANO/SD screen?

My just updated plain Meteobridge doesn't show a 'Data Export' option in the Services tab.
Ken,

 your nano does not have a SD card installed. When it does, you can do data exports. the data is moved to the  \data\export\ folder, then FTP it to your web server.

SD card needs to be one of the recommended ones listed here:
https://meteobridge.com/wiki/index.php/Meteobridge_NANO_SD

Sent from my GM1913 using Tapatalk
« Last Edit: May 19, 2020, 01:02:43 PM by ConligWX »
Regards Simon
Davis Vantage Pro2 Plus (6162UK) • Daytime FARS • WeatherLink Live • AirLink • PurpleAir PA-II-SD • CumulusMX •


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #10 on: May 19, 2020, 02:09:20 PM »
I have a Meteobridge (running on a TL-MR3020   (no USB hub)) V 4.3 (May 14 2020, build 13486), FW 1.5 that runs (TCP/IP connected to VirtualVP) from my main Davis VP1+ wired system.  Since it's just a plain Meteobridge, it doesn't have that expansion feature for Data Export.

I also have a Meteobridge NANO/SD running wirelessly from my secondary Davis VP2+ and I do see the History/Graph options, and Data Export option on the Services area.  I've not played much with the Nano/SD outputs.. guess I'll have to start a test site with that one to explore the additional capabilities.  Meanwhile, you can try out the two NOAA files from the CU-plugin with the 'trick' code to see if that works for you.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline ConligWX

  • Forecaster
  • *****
  • Posts: 839
  • #conligwx
    • conligwx.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #11 on: May 19, 2020, 02:48:59 PM »
Thanks Ken, however I get a HTTP 500 error.  apache error log states:

Code: [Select]
[Tue May 19 18:45:47.105581 2020] [php7:error] [pid 9302:tid 139724823791360] [client x.x.x.x:2100] PHP Parse error:  syntax error, unexpected '$SITE' (T_VARIABLE) in /share/htdocs/wxnoaaclimatereports.php on line 107
that relates to:

Code: [Select]
$SITE['WXsoftware']     = $saveWXType;
I have tried adding ' ' either side of the $saveWXType too.  removing that line, shows the noaa reports, but I already have noaa reports, its just the wxstatus.php page isnt showing then current time on noaa reports, that has be baffled.

oh well never mind its one line on a page I can do without.  thanks for all the help btw.
« Last Edit: May 19, 2020, 02:56:25 PM by ConligWX »
Regards Simon
Davis Vantage Pro2 Plus (6162UK) • Daytime FARS • WeatherLink Live • AirLink • PurpleAir PA-II-SD • CumulusMX •


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #12 on: May 19, 2020, 02:51:53 PM »
Ok, that's odd.. you tried this in a copy of wxnewpage.php?
Code: [Select]
<div id="main-copy">
 
<h1><?php langtrans('NOAA-Style Climate Reports'); ?></h1>
   
    <?php 
$saveWXType 
$SITE['WXsoftware'];
$SITE['WXsoftware']     = 'CU';
$SITE['NOAAdir']        = './NOAA-reports/';   // relative location of the NOAA report files
include_once("include-NOAA-reports.php");
$SITE['WXsoftware']     = $saveWXType;

?>

   
</div><!-- end main-copy -->
« Last Edit: May 19, 2020, 03:04:17 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline ConligWX

  • Forecaster
  • *****
  • Posts: 839
  • #conligwx
    • conligwx.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #13 on: May 19, 2020, 02:59:11 PM »
I get the same.

PHP Parse error:  syntax error, unexpected '$SITE' (T_VARIABLE) in /share/htdocs/wxnewpage.php on line 57

no worries ken. leave it, its not to be.  I have noaa reports working. the wxstatus.php page can wait.
Regards Simon
Davis Vantage Pro2 Plus (6162UK) • Daytime FARS • WeatherLink Live • AirLink • PurpleAir PA-II-SD • CumulusMX •


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #14 on: May 19, 2020, 03:05:33 PM »
D'Oh.. was missing the semi-colon after the include_once() .. Corrected above.

(perils of manually typing code without trying it out first)  :oops: #-o
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline ConligWX

  • Forecaster
  • *****
  • Posts: 839
  • #conligwx
    • conligwx.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #15 on: May 19, 2020, 06:33:03 PM »
Ok that seemed to load the noaa reports here:

https://www.conligwx.org/wxnoaaclimatereports.php

However I am not sure how this is going to fix the wxstatus.php page that I said in the OP though? 

sorry I am lost as what this fix about is going to do in listing the NOAA report as being current here:

https://www.conligwx.org/wxstatus.php

when looking at the wxstatus and include-wxstatus php files there is a NOAA file check. but it does not work.

here is the example (WD install)

 [ You are not allowed to view attachments ]
« Last Edit: May 19, 2020, 06:44:25 PM by ConligWX »
Regards Simon
Davis Vantage Pro2 Plus (6162UK) • Daytime FARS • WeatherLink Live • AirLink • PurpleAir PA-II-SD • CumulusMX •


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #16 on: May 19, 2020, 07:08:59 PM »
NOAA reports for Cumulus and Meteobridge are a phenomenon more recent than when the respective plugins were done, so the basic wxstatus.php doesn't include them.

You can add (in the custom checks area) to wxstatus.php
Code: [Select]
do_check($SITE['WXsoftwareLongName']." ".langtransstr("NOAA report"),
   $SITE['NOAACurDir'].'NOAAMO'.date('my').'.TXT',24*60*60+15,'file');
which should check for daily upload (24*60*60) with a 15 second grace period.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline ConligWX

  • Forecaster
  • *****
  • Posts: 839
  • #conligwx
    • conligwx.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #17 on: May 19, 2020, 07:40:05 PM »
NOAA reports for Cumulus and Meteobridge are a phenomenon more recent than when the respective plugins were done, so the basic wxstatus.php doesn't include them.

You can add (in the custom checks area) to wxstatus.php
Code: [Select]
do_check($SITE['WXsoftwareLongName']." ".langtransstr("NOAA report"),
   $SITE['NOAACurDir'].'NOAAMO'.date('my').'.TXT',24*60*60+15,'file');
which should check for daily upload (24*60*60) with a 15 second grace period.

we are nearly there lol

Meteobridge NOAA report   NOT Current   unknown   > 24:00:15
file not found


apache log shows Undefined index: NOAACurDir

I am guessing it need to know what path NOAACurDir is?
Regards Simon
Davis Vantage Pro2 Plus (6162UK) • Daytime FARS • WeatherLink Live • AirLink • PurpleAir PA-II-SD • CumulusMX •


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #18 on: May 19, 2020, 07:49:23 PM »
Yep..

Try using
Code: [Select]
$SITE['NOAAdir']        = './NOAA-reports/';   // relative location of the NOAA report files
do_check($SITE['WXsoftwareLongName']." ".langtransstr("NOAA report"),
   $SITE['NOAAdir'].'NOAAMO'.date('my').'.TXT',24*60*60+15,'file');
instead in the custom checks area.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline ConligWX

  • Forecaster
  • *****
  • Posts: 839
  • #conligwx
    • conligwx.org
Re: wxstatus, NOAA Reports and Meteobridge.
« Reply #19 on: May 19, 2020, 07:55:23 PM »
nope, no error at all now. but file not found.

ahhh.  txt instead of TXT.

we got there.

once again Ken, you save the day.  Much appreciated all your help.
Regards Simon
Davis Vantage Pro2 Plus (6162UK) • Daytime FARS • WeatherLink Live • AirLink • PurpleAir PA-II-SD • CumulusMX •