Author Topic: WxReports - From WEEWX source  (Read 1045 times)

0 Members and 1 Guest are viewing this topic.

Offline dengland

  • Member
  • *
  • Posts: 9
WxReports - From WEEWX source
« on: August 19, 2023, 08:06:11 PM »
Anyone running the Wxreports by Murry Conarroe at Wildwood Weather using WeeWX as a source?  I have not seemed to of cracked the changes needed yet to be successful.  I recently switched from Weather Display to WeeWx.

I have the path I think set correctly in wx-report-settings"
Code: [Select]
$path_dailynoaa = $SITE['NOAAdir'];   // path to NOAA reports
which resolves to "./NOAA/" 
Code: [Select]
$locmc = $path_dailynoaa;
echo "the NOAA path is " . $locmc;
echo "<BR>the software is " . $SITE['WXsoftware'];
adding the echos above in wxraindetail.php gets me
Code: [Select]
the NOAA path is ./NOAA/
the software is WEEWX

In wxreportinclude.php, I made an entry for what I believe is the right filenaming format for WEEWX:

Code: [Select]
#Added for WEEWX - dae 08/06/2023
              if($wxsoftware == 'WEEWX') {
                $filename = "NOAA" . "-" .$year . "-" . str_pad(($m + 1), 2, "0", STR_PAD_LEFT) . ".txt";
              }

in context here:
Code: [Select]
function get_noaa_filename ($year, $m, $wxsoftware, $current_month){

             if($wxsoftware == 'CU') {
                $filename = "NOAAMO" . str_pad(($m + 1), 2, "0", STR_PAD_LEFT) . substr($year,2,2) . ".txt";
              }
              if($wxsoftware == 'WL') {
                  $now = getdate();
print "<!-- now \n" . print_r($now,true) . " -->\n";
$now_month = sprintf("%02d",$now['mon']);
$now_year = $now['year'];
$prior_month = $now['mon'] - 1;
$prior_year = $now['year'];
$last_year = $prior_year -1;
if ($prior_month < 1) {$prior_month = 12; $prior_year--;}
$prior_month = sprintf("%02d",$prior_month);
global $path_dailynoaa;
$NOAAdir = $path_dailynoaa;
$LastMonthFile = $path_dailynoaa.'NOAAPRMO.TXT';
$now_hour = $now['hours'];


  if(! file_exists("$path_dailynoaa/NOAA$prior_year-$prior_month.TXT") and
       file_exists($LastMonthFile) and
       $now_hour >= 6) {
       print "<!-- copying $LastMonthFile to $NOAAdir/NOAA$prior_year-$prior_month.TXT -->\n";
       if (copy($LastMonthFile,"$NOAAdir/NOAA$prior_year-$prior_month.TXT")) {
         print "<!-- copy successful -->\n";
       } else {
         print "<!-- unable to copy -->\n";
       }
       }
                 if ($current_month){
                     $filename = "NOAAMO.TXT";
                 } else {                 
                     $filename = "NOAA" . $year . "-" . str_pad(($m + 1), 2, "0", STR_PAD_LEFT) . ".TXT";
                 }
              }
              if($wxsoftware == 'VWS') {
                $filename = $year . "_" . str_pad(($m + 1), 2, "0", STR_PAD_LEFT) . ".txt";
              }
              if($wxsoftware == 'WV') {
                $filename = "NOAA" . "-" .$year . "-" . str_pad(($m + 1), 2, "0", STR_PAD_LEFT) . ".txt";
              }
#Added for WEEWX - dae 08/06/2023
              if($wxsoftware == 'WEEWX') {
                $filename = "NOAA" . "-" .$year . "-" . str_pad(($m + 1), 2, "0", STR_PAD_LEFT) . ".txt";
              }
              if ($wxsoftware == "WD"){           
                if ($current_month){             
                    $filename = "dailynoaareport.htm";                                           
                } else {
                    $filename = "dailynoaareport" . ( $m + 1 ) . $year . ".htm";
                }                                                       
              }
              return ($filename);
}

./NOAA directory contains files with a naming format of NOAA-2023-08.txt for the dailies and NOAA-2023.txt for the annuals.

So, If someone already has this working, I would be grateful if you shared.  It feels like I am missing something obvious, but it eludes me.

Offline Murry Conarroe

  • Contributor
  • ***
  • Posts: 143
    • Wildwood Weather
Re: WxReports - From WEEWX source
« Reply #1 on: August 20, 2023, 06:17:57 AM »
Just out of curiosity, did you try to contact Murry Conarroe and provide some NOAA report samples created by WeeWX?
Murry

Offline dengland

  • Member
  • *
  • Posts: 9
Re: WxReports - From WEEWX source
« Reply #2 on: August 20, 2023, 07:29:57 AM »
I thought that would be too forward of me!

Attached are the July 2023 and August 2023 files.  There are about 3 years' worth of data imported so far.

https://dougengland.com/tabular.html?report=NOAA/NOAA-2023-08.txt

https://dougengland.com/tabular.html?report=NOAA/NOAA-2023.txt

I am seeing the default range in the menus, not something based on the files found in the directory if that is a clue.
Code: [Select]
<div id="main-copy">
    <div id="report">
        <center><h1>Rainfall Reports (in)</h1>
 <h3>Report for Year 2022</h3>Data last updated 08/20/2023 07:22.<br /><br />   </center>

            <div class="getreportdtbx doNotPrint">Other Years:<br/>
                <form  method="get" action="/wxraindetail.php" >
                    <select name="year">
<option value="2023">2023 </option>
<option value="2022">2022 </option>
<option value="2021">2021 </option>
<option value="2020">2020 </option>
<option value="2019">2019 </option>
<option value="2018">2018 </option>
<option value="2017">2017 </option>
<option value="2016">2016 </option>
<option value="2015">2015 </option>
<option value="2014">2014 </option>
<option value="2013">2013 </option>
<option value="2012">2012 </option>
<option value="2011">2011 </option>
<option value="2010">2010 </option>
<option value="2009">2009 </option>
<option value="2008">2008 </option>
<option value="2007">2007 </option>
<option value="2006">2006 </option>
<option value="2005">2005 </option>
<option value="2004">2004 </option>
<option value="2003">2003 </option>
<option value="2002">2002 </option>
<option value="2001">2001 </option>
<option value="2000">2000 </option>
<option value="1999">1999 </option>
<option value="1998">1998 </option>
                    </select>
                    <input type="submit" value="Go" />
                </form>

Thanks Murry for taking a look at this.

Offline Murry Conarroe

  • Contributor
  • ***
  • Posts: 143
    • Wildwood Weather
Re: WxReports - From WEEWX source
« Reply #3 on: August 20, 2023, 10:40:00 AM »
Try the attached updated wxreportinclude.txt (rename to wxreportinclude.php).

Regarding the years available listed in the dropdown menu, that is based on the
Code: [Select]
$first_year_of_noaadata = "1998";  # First year of dailynoaareport data that is availablesetting on about line 31 of the wxreport-settings.php. That is based on my settings. Change to whatever is applicable to you.
Murry

Offline dengland

  • Member
  • *
  • Posts: 9
Re: WxReports - From WEEWX source
« Reply #4 on: August 20, 2023, 12:33:25 PM »
Try the attached updated wxreportinclude.txt (rename to wxreportinclude.php).

Thanks.  There was no change in behavior.

Offline Murry Conarroe

  • Contributor
  • ***
  • Posts: 143
    • Wildwood Weather
Re: WxReports - From WEEWX source
« Reply #5 on: August 20, 2023, 04:56:22 PM »
I can not duplicate your problem even when I set my directories in the same configuration as yours.

You might want to add the current NOAA file to the same directory where you have your scripts and change the
Code: [Select]
$SITE['NOAAdir'] = './NOAA/'; setting to
Code: [Select]
$SITE['NOAAdir']           = './'; and see what happens.

If it then works, then there is something your server doesn't like about the path name to the NOAA directory.
Murry

Offline dengland

  • Member
  • *
  • Posts: 9
Re: WxReports - From WEEWX source
« Reply #6 on: August 20, 2023, 06:30:14 PM »
It did not work with that change either.

However - I started wondering about the version of PHP I was running.  When I bumped the version from 5.6 (5.6.40) to 8.0 (8.0.28), things look like they started working.  It looks like I caused you goose chase.  I am sorry about that.  I backed it down to 7.0 (7.0.33) and it still worked.  I was getting NOTHING in my error logs at 5.6 version.
« Last Edit: August 20, 2023, 06:48:45 PM by dengland »

Offline Murry Conarroe

  • Contributor
  • ***
  • Posts: 143
    • Wildwood Weather
Re: WxReports - From WEEWX source
« Reply #7 on: August 20, 2023, 08:04:49 PM »
Not sure what changing the PHP version did, but as long as it works.
Murry

 

anything