Author Topic: saratoga template rain rate  (Read 844 times)

0 Members and 1 Guest are viewing this topic.

Offline txweather.org

  • Forecaster
  • *****
  • Posts: 1597
    • Texas Weather
saratoga template rain rate
« on: June 05, 2019, 07:46:10 AM »
Today I notice something not right and I am sure it has to do with my nano...

My template is showing the rain rate is not showing right...

Rain Rate (/hr):    0.299 in
https://www.txweather.org/index.php

Not sure why.

This was not happening before.

Any ideas?

Is it the nano sending bad data?

Thank you!
« Last Edit: June 05, 2019, 07:47:49 AM by txweather.org »

----
Davis Vantage Pro2 Plus +FARS|Meteobridge Nano SD|Meteohub|Meteobridge MR-3020|WU KTXSPRIN75/PWS JRARGWX75/CWOP EW2972/WBB TXWDVUE75/Blitzortung ID: 1142|AWEKAS: 12095
Donations are welcome: https://paypal.me/ffuentesb

Offline txweather.org

  • Forecaster
  • *****
  • Posts: 1597
    • Texas Weather
Re: saratoga template rain rate
« Reply #1 on: June 05, 2019, 09:03:26 AM »
So I did a MBtags dump and I can see that is sending the correct data but is not displaying right.

$WX['rain0rate-act'] = '0.31'; // rain rate most recent

Any ideas what is causing this?

----
Davis Vantage Pro2 Plus +FARS|Meteobridge Nano SD|Meteohub|Meteobridge MR-3020|WU KTXSPRIN75/PWS JRARGWX75/CWOP EW2972/WBB TXWDVUE75/Blitzortung ID: 1142|AWEKAS: 12095
Donations are welcome: https://paypal.me/ffuentesb

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9298
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: saratoga template rain rate
« Reply #2 on: June 05, 2019, 11:22:15 AM »
In MB-defs.php the
Code: [Select]
$currentrainratehr = $WX['rain0rate-act'];
takes that value and in ajax-dashboard.php it is displayed with
Code: [Select]
<span class="ajax" id="ajaxrainratehr">
                  <?php echo strip_units($currentrainratehr) . $uomRain?>
                  </span>

In ajaxMBwx.js the ajaxrainratehr tag is updated by
Code: [Select]
var rainratehr = convertRain(realtime[8]); // make per hour rate.
set_ajax_obs("ajaxrainratehr",rainratehr.toFixed(dpRain+1) + uomRain);

and
Code: [Select]
function convertRain ( inrawrain ) {
// function expects input in mm
var rawrain = cRainToMM(inrawrain);
if (useunits == 'E') { // convert mm to inches
   return (rawrain * .0393700787);
} else {
   return (rawrain * 1.0); // leave in mm
}
}
handles conversion of mm to inches.  The MBrealtime.txt has
Quote
05/06/2019 10:15:27 22.8 97 22.3 1.8 0.4 90.0 4.3 22.2 1011.7 E 1 m/s C hPa mm -- -0.5 22.2 505.2 0.0 33.8 41.0 22.8 0.1 25.1 00:57 22.7 09:11 3.1 06:47 5.4 07:09 1013.9 00:02 1011.3 05:25 4.0 2142 4.0 22.8 32.2 0.0 -- 12.0 120.0 6.1 -- 1 -- ESE -- m -- 14:00 -- -- 0.0
which did show correctly as 0.17 in/hr.

When the page is first loaded, the data from MBtags.php (updated every 5 minutes) is shown.  When the ajaxMBwx.js script activates, the value is updated from MBrealtime.txt which is updated more frequently.

As far as I can tell, Meteobridge and the template are working correctly on your site.
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 txweather.org

  • Forecaster
  • *****
  • Posts: 1597
    • Texas Weather
Re: saratoga template rain rate
« Reply #3 on: June 05, 2019, 12:12:59 PM »
Ken,

Edit: I understand now.
Thanks again!

Sucks getting OLD! LOL :P
« Last Edit: June 05, 2019, 12:24:13 PM by txweather.org »

----
Davis Vantage Pro2 Plus +FARS|Meteobridge Nano SD|Meteohub|Meteobridge MR-3020|WU KTXSPRIN75/PWS JRARGWX75/CWOP EW2972/WBB TXWDVUE75/Blitzortung ID: 1142|AWEKAS: 12095
Donations are welcome: https://paypal.me/ffuentesb

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9298
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: saratoga template rain rate
« Reply #4 on: June 05, 2019, 12:24:13 PM »
Umm, not quite.   When the page FIRST loads, the PHP value (from MBtags.php) is shown.  When the JavaScript begins execution, that PHP value is replaced by the value in MBrealtime.txt converted from mm to inches (and the update is shown with a 'green flash' of the value).   Yes, quite normal.
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 txweather.org

  • Forecaster
  • *****
  • Posts: 1597
    • Texas Weather
Re: saratoga template rain rate
« Reply #5 on: June 05, 2019, 12:24:57 PM »
Thanks Ken!

----
Davis Vantage Pro2 Plus +FARS|Meteobridge Nano SD|Meteohub|Meteobridge MR-3020|WU KTXSPRIN75/PWS JRARGWX75/CWOP EW2972/WBB TXWDVUE75/Blitzortung ID: 1142|AWEKAS: 12095
Donations are welcome: https://paypal.me/ffuentesb

Offline kc1fx

  • Member
  • *
  • Posts: 15
    • Local Weather
Re: saratoga template rain rate
« Reply #6 on: June 06, 2019, 06:56:04 AM »
Speaking of rain, How can rain yesterday be greater than month total? Actual values are Yesterday = .99, month = 2.14, today = .88.
My site kc1fx-weather.info is good. kc1fx-weather.info/index.php is not right. I noticed this 2 days ago.

Thanks for looking

Gary

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9298
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: saratoga template rain rate
« Reply #7 on: June 06, 2019, 11:27:55 AM »
In ajax-dashboard.php there is
Code: [Select]
              <?php if(isset($yesterdayrain)) { ?>
              <tr>
                <td class="data1" nowrap="nowrap"><?php langtrans('Rain Yesterday'?>: </td>
                <td style="text-align: right;" class="data1">
  <span class="ajax" id="ajaxrainydy">
                  <?php echo strip_units($yesterdayrain) . $uomRain?>
                  </span>
</td>
              </tr>
              <?php // end $yesterdayrain ?>
  <?php if (isset($vpstormrain)) { // Storm Rain is a Davis VP thing ?>
               <tr>
                <td class="data1" nowrap="nowrap"><?php langtrans('Storm Rain'); ?>: </td>
                <td style="text-align: right;" class="data1">
                  <?php echo strip_units($vpstormrain).$uomRain?>
</td>
              </tr>
  <?php // end of DavisVP specific variable ?>
             <tr>
                <td class="data1"><?php langtrans('This Month'); ?>:</td>
                <td style="text-align: right;" class="data1">
  <span class="ajax" id="ajaxrainmo">
                  <?php echo strip_units($monthrn) . $uomRain?>
                  </span>
</td>
              </tr>
              <tr>
                <td class="data1" nowrap="nowrap"><?php langtrans('Season Total'); ?>:</td>
                <td style="text-align: right;" class="data1">
  <span class="ajax" id="ajaxrainyr">
                    <?php echo strip_units($yearrn) . $uomRain?>
                  </span>
</td>
              </tr>
to display that rain section.

Rain Yesterday comes from $yesterdayrain and month rain from $monthrn.  Those variables are set in WXS-defs.php via
Code: [Select]
$monthrn = $WX['MTH_PM'];
$yesterdayrain = $WX['YD_PH'];
Looking in WXStags.php?sce=dump shows
Code: [Select]
$WX['MTH_PM'] = '2.15';
$WX['YD_PH'] = '2.25';

So the numbers shown are being reported by WXSolution software.
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 kc1fx

  • Member
  • *
  • Posts: 15
    • Local Weather
Re: saratoga template rain rate
« Reply #8 on: June 06, 2019, 06:45:06 PM »
I think I found the issue. The template I use for kc1fx-weather.info Uses a different tag for month.... Current.html supplied by WxSolution.

"<tr class="column-light">
<td height="31"><b>Rain</b></td>
<td><b>$PC$"</b> | Yesterday: <b>$YD_PM$"</b></td>
<td><span style="font-size: 10px;">$DAYS_SINCE_RAINFALL$ day(s) without rain.<br/><b>Month: </b>$MTH_PTTL$"  | <b>Year: </b>$YR_PTTL$"</span></td>
<td><span style="font-size: 10px;">$PC_RATE_NUM$" per hr<br/>$RAIN24$" last 24 hrs</span></td>
</tr>"

That's different than "$monthrn = $WX['MTH_PM'];" that you found in the php.

Maybe that's the issue.

Thanks Ken

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9298
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: saratoga template rain rate
« Reply #9 on: June 06, 2019, 10:03:12 PM »
Ahh, I'd put that tag list together in June, 2012 (and haven't updated it since) -- it's possible that WXSolution has modified tags over the intervening years.  You are the first to spot that anomaly.  I'm running 1.8.7.2 (2014) for my tests.. their site says 1.9 is current.

In his version release notes it says
Quote
Version 1.8.7.6: July 19 2015

    Updated help and User's Guide to include missing $MTH_PTTL$ and $YR_PTTL$ tags. Use these instead of $MTH_PM$ and $YR_PM$ tags.
    Added FORECAST tag for Davis stations.
    Modified 1YR_PM, YD_PM tags to show trace.
    Fixed MTH_PTTL for 1st of month, and YR_PTTL for January 1.
    Modified Publish WxServer to allow multiple IP addresses separated by semicolons.
Oops.. guess I missed that (since I'm a bit downlevel from there).

Try the attached update.  Just replace your tags template file WXStags.txt (or WXStags-comments.txt) for WXSolution, and upload the modified WXS-defs.php to your site.  It should fix the issue in the template.
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 kc1fx

  • Member
  • *
  • Posts: 15
    • Local Weather
Re: saratoga template rain rate
« Reply #10 on: June 07, 2019, 07:13:28 PM »
I double checked my work and the instructions and I do not see the change.  ](*,)

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9298
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: saratoga template rain rate
« Reply #11 on: June 07, 2019, 08:19:19 PM »
Looking at http://kc1fx-weather.info/WXStags.php?sce=dump shows that the $WX['YR_PTTL'] and $WX['MTH_PTTL'] tags are there
Code: [Select]
$WX['YR_PM'] = '19.41';
$WX['YR_PTTL'] = '19.41';

$WX['MTH_PM'] = '2.15';
$WX['MTH_PTTL'] = '2.15';
They just have the same values as the old _PM tags.  The WXS-defs.php does have the codes
Code: [Select]
$monthrn = isset($WX['MTH_PTTL'])?$WX['MTH_PTTL']:$WX['MTH_PM'];
$yearrn =  isset($WX['YR_PTTL'])?$WX['YR_PTTL']:$WX['YR_PM'];
to choose the _PTTL versions if they exist.  You can't see a difference now because the old and new tags have the same values.  Your install looks correct.
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 kc1fx

  • Member
  • *
  • Posts: 15
    • Local Weather
Re: saratoga template rain rate
« Reply #12 on: June 08, 2019, 06:22:10 PM »
Thanks for checking Ken.