Welcome to the Cumulus Support forum.

Latest Cumulus MX release v3.3.0 build 3063 - 10 January 2020.
    Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014

    See the Wiki for downloading either version.

    Yet Another Dayfile Reader (PHP)

    Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

    Moderator: daj

    Post Reply
    User avatar
    joewith
    Posts: 29
    Joined: Fri 18 May 2012 4:33 am
    Weather Station: Davis Vantage Pro2
    Operating System: Windows 10 Pro
    Location: Aurora, Colorado, USA
    Contact:

    Re: Yet Another Dayfile Reader (PHP)

    Post by joewith » Thu 06 Feb 2014 4:18 pm

    Hi Barry,

    Thanks, for the reply. ;) I had made the necessary changes to lines 44 thru 47 to reflect the the correct uom
    for my data, but that didn't do the trick. :(

    Code: Select all

                'temp' => (isset($SITE['uomTemp']) ? substr($SITE['uomTemp'], -1) : 'F'), // CJW
                'rain' => (isset($SITE['uomRain']) ? substr($SITE['uomRain'], 1) : 'in'), // CJW
                'wind' => (isset($SITE['uomWind']) ? substr($SITE['uomWind'], 1) : 'mph'), // CJW
                'baro' => (isset($SITE['uomBaro']) ? substr($SITE['uomBaro'], 1) : 'inHg') // CJW
    So still looking. I'm fairly new to coding php ( or for that matter anything else) :roll: so I'm still puzzled why it seems to work for everyone else except for me. :? :?

    Thanks again,

    User avatar
    beteljuice
    Posts: 2806
    Joined: Tue 09 Dec 2008 1:37 pm
    Weather Station: None !
    Operating System: ex XP SP3 - now W10 laptop grr
    Location: Dudley, West Midlands, UK

    Re: Yet Another Dayfile Reader (PHP)

    Post by beteljuice » Thu 06 Feb 2014 8:53 pm

    Baro inHg = my problem :o - single occurence of a single character not capitalised ...

    Solar irradiance 'correctly' upped to 1500 together with contrasting text.

    New beta V1.2 available.
    Last edited by beteljuice on Thu 06 Feb 2014 11:55 pm, edited 1 time in total.
    Image
    ......................Imagine, what you will KNOW tomorrow !

    User avatar
    joewith
    Posts: 29
    Joined: Fri 18 May 2012 4:33 am
    Weather Station: Davis Vantage Pro2
    Operating System: Windows 10 Pro
    Location: Aurora, Colorado, USA
    Contact:

    Re: Yet Another Dayfile Reader (PHP)

    Post by joewith » Thu 06 Feb 2014 10:30 pm

    Hi Beetlejuice,
    Baro inHg = my problem :o - single occurence of a single character not capitaised ...
    Thanks, that took care of the problem. :clap: You wouldn't believe how many times I probably looked at that line without it registering with me that that was the problem... :oops:

    Thanks again,

    User avatar
    beteljuice
    Posts: 2806
    Joined: Tue 09 Dec 2008 1:37 pm
    Weather Station: None !
    Operating System: ex XP SP3 - now W10 laptop grr
    Location: Dudley, West Midlands, UK

    Re: Yet Another Dayfile Reader (PHP)

    Post by beteljuice » Thu 06 Feb 2014 10:54 pm

    As an aside ....

    In php
    Although variables ARE case sensitive ....
    function names are NOT ie. DoSomething() is the same as dosomething()

    plus the beteljuice is rather stressed ATM - that's my excuse anyway !
    Image
    ......................Imagine, what you will KNOW tomorrow !

    User avatar
    beteljuice
    Posts: 2806
    Joined: Tue 09 Dec 2008 1:37 pm
    Weather Station: None !
    Operating System: ex XP SP3 - now W10 laptop grr
    Location: Dudley, West Midlands, UK

    Re: Yet Another Dayfile Reader (PHP)

    Post by beteljuice » Fri 07 Feb 2014 10:16 am

    PROBLEM !

    Looking at others implementations the beteljuice can see a logic bug for T diff when 'native' UOM is F.

    I'll fix it later - I hope !

    Over the weekend I may also have an experiment for some to try ...
    Image
    ......................Imagine, what you will KNOW tomorrow !

    User avatar
    laulau
    Posts: 532
    Joined: Tue 13 Oct 2009 10:52 pm
    Weather Station: WeatherDuino Pro2
    Operating System: Win 7
    Location: Meyenheim, Alsace, FR
    Contact:

    Re: Yet Another Dayfile Reader (PHP)

    Post by laulau » Fri 07 Feb 2014 1:37 pm

    I added 'Heating/Cooling degree days' (DJU+, DJU-) here : http://meteo.laurentmey.fr/betel/basic.php
    beteljuice wrote:Over the weekend I may also have an experiment for some to try ...
    I'm ready! 8-)
    Laurent

    Image

    User avatar
    beteljuice
    Posts: 2806
    Joined: Tue 09 Dec 2008 1:37 pm
    Weather Station: None !
    Operating System: ex XP SP3 - now W10 laptop grr
    Location: Dudley, West Midlands, UK

    Re: Yet Another Dayfile Reader (PHP)

    Post by beteljuice » Sat 08 Feb 2014 12:44 am

    Update beta V1.3

    Total rewrite of T Diff - very flawed logic :oops:
    Image
    ......................Imagine, what you will KNOW tomorrow !

    User avatar
    laulau
    Posts: 532
    Joined: Tue 13 Oct 2009 10:52 pm
    Weather Station: WeatherDuino Pro2
    Operating System: Win 7
    Location: Meyenheim, Alsace, FR
    Contact:

    Re: Yet Another Dayfile Reader (PHP)

    Post by laulau » Sat 08 Feb 2014 9:11 am

    Code: Select all

    }
    missing after line 351
    Laurent

    Image

    User avatar
    beteljuice
    Posts: 2806
    Joined: Tue 09 Dec 2008 1:37 pm
    Weather Station: None !
    Operating System: ex XP SP3 - now W10 laptop grr
    Location: Dudley, West Midlands, UK

    Re: Yet Another Dayfile Reader (PHP)

    Post by beteljuice » Sat 08 Feb 2014 10:21 am

    Exactly like Laurent says !

    Edit for yourself or new download v1.3.1
    Image
    ......................Imagine, what you will KNOW tomorrow !

    User avatar
    beteljuice
    Posts: 2806
    Joined: Tue 09 Dec 2008 1:37 pm
    Weather Station: None !
    Operating System: ex XP SP3 - now W10 laptop grr
    Location: Dudley, West Midlands, UK

    Re: Yet Another Dayfile Reader (PHP)

    Post by beteljuice » Sat 08 Feb 2014 8:23 pm

    Experiment

    The following experiment does two things:
    • Uses a seperate languages file to assist with future modifications.
      Does a best guess at a defined list of data types to change zeros to null - so averages etc. are more sensible
    Comments from within the file:

    Code: Select all

    // Cumulus provides 0 or 0.0 for missing or invalid data - this can make a nonsense of minimum and average values.
    // The best thing to do is to edit your dayfile.txt and nullify (,,) any false data.
    // However; depending upon your location, some datasets can reasonably be expected to be > 0 (remember these are daily values)
    // These could include:
    // ... 'windspd', 'windgust', 'windrun', 'HoursSun', 'Solar', 'HighUV'
    
    $SANITIZE = true; // attempt to ignore zero in the following datasets:
    $zero_as_null = array('windspd', 'windgust', 'windrun', 'HoursSun', 'Solar', 'HighUV'); // datasets to 'fix'
    
    
    Edit: download removed - no longer relevant
    Let me know if this is a serious replacement for the current stuff please.
    Last edited by beteljuice on Fri 14 Feb 2014 4:01 pm, edited 1 time in total.
    Image
    ......................Imagine, what you will KNOW tomorrow !

    User avatar
    laulau
    Posts: 532
    Joined: Tue 13 Oct 2009 10:52 pm
    Weather Station: WeatherDuino Pro2
    Operating System: Win 7
    Location: Meyenheim, Alsace, FR
    Contact:

    Re: Yet Another Dayfile Reader (PHP)

    Post by laulau » Sat 08 Feb 2014 9:58 pm

    New test page herehttp://meteo.laurentmey.fr/btnew/basicN.php
    I noticed that if you rename the script there is a problem here :oops:

    Code: Select all

        function doesforme(detail){ // ajax content get for subsequent calls
            $("#gilliam").html("<h1>'.$translit[$lang]['loading'].'</h1>");
            betel_url = "betel_readDayfile.php"+detail+"&pane="+pane;
            grab = $.get(betel_url, function(php){
               $("#tableData").html(php);
            })
            .fail(function(){
                $("#gilliam").html("<h1><font-color=\"red\">'.$translit[$lang]['fail'].'</font></h1>");
            });
        }
    
    because the script uses its own hardcoded name :o !
    Laurent

    Image

    User avatar
    beteljuice
    Posts: 2806
    Joined: Tue 09 Dec 2008 1:37 pm
    Weather Station: None !
    Operating System: ex XP SP3 - now W10 laptop grr
    Location: Dudley, West Midlands, UK

    Re: Yet Another Dayfile Reader (PHP)

    Post by beteljuice » Sat 08 Feb 2014 10:09 pm

    laulau wrote: ...because the script uses its own hardcoded name :o !
    ;) http://sandaysoft.com/forum/viewtopic.p ... 7&start=68 - although it was an afterthought edit, So I forgive you :lol:

    But ... does it do what it says on the tin.

    Are all figures correct in all tables ?
    Does it crash and burn anywhere ?
    Am I talking to myself again doctor ? :geek:
    Last edited by beteljuice on Sat 08 Feb 2014 10:57 pm, edited 2 times in total.
    Image
    ......................Imagine, what you will KNOW tomorrow !

    Graham64
    Posts: 74
    Joined: Mon 23 Aug 2010 5:04 pm
    Weather Station: Davis Vantage Pro 2
    Operating System: Windows XP
    Location: Cornwall, England
    Contact:

    Re: Yet Another Dayfile Reader (PHP)

    Post by Graham64 » Sat 08 Feb 2014 10:37 pm

    Yes it works.
    http://poundstockpacket.org.uk/weather/basic700.php
    See 2013 October wind values but sun hours are sometimes genuinely zero!
    Will test later today (I am in Australia with family at present - testing on an ipad is difficult)

    Excellent mods

    User avatar
    laulau
    Posts: 532
    Joined: Tue 13 Oct 2009 10:52 pm
    Weather Station: WeatherDuino Pro2
    Operating System: Win 7
    Location: Meyenheim, Alsace, FR
    Contact:

    Re: Yet Another Dayfile Reader (PHP)

    Post by laulau » Sat 08 Feb 2014 10:40 pm

    Comparing http://meteo.laurentmey.fr/btnew/basicN.php
    to http://meteo.laurentmey.fr/betel/basic.php
    For "Solaire" (i've no solar sensor), in the new version it's blank where in precedent version was '0'
    So 'something' ;) is working with 'null' values :clap:
    Laurent

    Image

    Graham64
    Posts: 74
    Joined: Mon 23 Aug 2010 5:04 pm
    Weather Station: Davis Vantage Pro 2
    Operating System: Windows XP
    Location: Cornwall, England
    Contact:

    Re: Yet Another Dayfile Reader (PHP)

    Post by Graham64 » Sun 09 Feb 2014 11:11 am

    Beteljuice
    Experiment:
    The number_format problem has returned for apparent temps and DP. I solved it by adding a (float) to DoTemp at approx line 393

    Code: Select all

    } else { // no change
            return number_format((float)$value, $temp_dec, '.' , '');
        }
    
    The problem I had with missing wind speed values has been solved, see Oct 2013 at
    http://poundstockpacket.org.uk/weather/basic700.php
    The values recorded as zero when the anemometer was being repaired are shown as blank and ignored in calculating averages.
    However the wind direction for the period is shown as E. I think this is the default value set by Cumulus when the anemometer was down. I can't see what can be done about this because E is a frequent valid value.

    You included sun hours in the sanitize routine but zero is a frequent valid value for sun hours and so I have removed it from the $zero_as_null array.

    Thanks for the excellent work on the experiment to deal with zeroes/nulls but I don't think it provides a fool-proof solution. For example, the wind direction problem and also I notice that there was one day in 2012 when my wind speed was genuinely (I think) zero but your routine has set it to blank. I suppose that the only way will be to either alter the DayFile values to null Using Cumulus or use a database.

    Once again thanks for an excellent program, I will incorporate it into my website when I get home.

    EDIT See later posts for more on wind direction values
    Last edited by Graham64 on Sun 09 Feb 2014 12:45 pm, edited 1 time in total.

    Post Reply