-->
Page 1 of 2

How do I Predict Weather?

PostPosted: Sat Mar 19, 2022 6:49 am
by Inq720
Later in the spring and again this summer, I'll be teaching an introductory course in Arduino programming with an emphasis on IoT and web servers. It will also focus on using a browser based client application so one doesn't have to write an iPhone app, an Android app, a Windows app... etc.

I decided on doing a Weather Station https://www.esp8266.com/viewtopic.php?f=11&t=23581 to be simple to wire, and program, yet have all the fundamentals needed for the class.
  • It's important to have a practical / usable project for the student to take home.
  • Shows dynamic data generated by the ESP8266 Server
  • Has server variables that need to be adjusted by the browser clients.
  • Needs to persist data between boots
  • Has browser, client-side configuration to optionally show Centigrade / Fahrenheit
  • Does some trivial AI to derive a prediction of coming weather

The station will have Temperature, Humidity and Pressure data. I kind of knew that a pressure rate is necessary and I researched that at least one standard is to use the change in pressure over a 3 hour period. That is also calculated on the server. Can anyone point me to information on how to use those values to arrive at a weather prediction like these type of stations do?

Re: How do I Predict Weather?

PostPosted: Sat Mar 26, 2022 5:16 am
by rpiloverbd
Till now, how accurate is the weather forecasting of InqWeather?

Re: How do I Predict Weather?

PostPosted: Sat Mar 26, 2022 5:56 am
by Inq720
rpiloverbd wrote:Till now, how accurate is the weather forecasting of InqWeather?


I don't know if it's true, but I once heard/read that if you just use the prediction, that tomorrows weather will be the same as today's you'll have a better success rate than the weather station.

Re: How do I Predict Weather?

PostPosted: Sat Mar 26, 2022 6:18 am
by Inq720
rpiloverbd wrote:Till now, how accurate is the weather forecasting of InqWeather?

As of now, I have only found the chart below that I got from this web page https://www.artofmanliness.com/lifestyle/gear/fair-or-foul-how-to-use-a-barometer/
Below the chart is the coding logic the InqWeather's changing.html page uses. I tried to translate that chart into this code. InqWeather has no ability to get wind direction yet. It only uses two variables so far.

_P = the current pressure.
delta = the 3-hour pressure change calculation.

The problem is, I don't know anything about weather prediction and I don't know if the constants are bad or the if/then logic. Just don't know where to start. All I know, is the cheap electronic weather stations, using the same three pieces of information (temperature, humidity and pressure) can do a pretty-good job. I'm hoping someone can help or even point me to some good Internet pages for me to study.

VBR,
Inq


Image

Code: Select allfunction predict(delta)
{
    const MID_HIGH = 0.18;
    const LOW_MID  = 0.04;
    const SLOW_MID = 0.01;
    const DFLT_CONDITION = "Same ole - Same ole";

    if (_P < 29.8)
    {
        if (delta < -MID_HIGH)
        {
            setBackground('Gale.jpg', 'orchid');
         return "Severe northeast gales and heavy rain or snow,  followed in winter by cold wave.";
        }
        else if (delta > MID_HIGH)
        {
            setBackground('ClearCold.jpg', 'navy');
         return "Clearing and colder.";
        }
        else
         return DFLT_CONDITION;
    }
    else if (_P < 30)
    {
        if (delta < -MID_HIGH)
        {
            setBackground('RainWind.jpg', 'grey');
         return "Rain with high-wind, followed with 2 days by clearing, colder.";
        }
        else if (delta < -SLOW_MID)
        {
            setBackground('RainComing.jpg', 'teal');
         return "Rain within 18 hours that will continue for a day or two.";
        }
        else if (delta < SLOW_MID)
         return DFLT_CONDITION;
        else    // delta > SLOW_MID
        {
            setBackground('ClearCold.jpg', 'navy');
         return "Clearing and colder within 12 hours.";
        }
    }
    else if (_P < 30.2)
    {
        if (delta < -MID_HIGH)
        {
            setBackground('WarmRain.jpg', 'lime');
         return "Warmer, and rain with 24 hours";
        }
        else if (delta < MID_HIGH)
        {
            setBackground('FareStable.jpg', 'white');
         return "Fair, with slight changes in temperature for 1 to 2 days.";
        }
        else    // delta > MID_HIGH
        {
            setBackground('FairRainComing.jpg', 'navy');
         return "Fair, followed within 2 days by warmer and rain.";
        }
    }
    else    // _P >= 30.2
    {
        if (delta < -MID_HIGH)
        {
            setBackground('ClearCold.jpg', 'navy');
         return "Cold and clear, quickly followed by warmer and rain.";
        }
        else
         return "No early change.";
    }
};