Weather Forecast ML
Weather Forecast ML
Information Technology
By
PAVITHRAPRIYA K
38120056
SATHYABAMA UNIVERSITY
(Established under Section 3 of UGC Act, 1956)
Jeppiaar Nagar, Rajiv Gandhi Salai, Chennai - 600119
www.sathyabamauniversity.ac.in
_________________________________________________________________
SCHOOL OF COMPUTING
BONAFIDE CERTIFICATE
This is to certify that this Professional Training Report is the bonafide work of
PAVITHRAPRIYA.K (Reg. No. 38120056.) who underwent the professional
training in “WEATHER PREDICTION” under our supervision from JULY 2021 to
DEC 2021.
Internal Guide
Dr.G.Mathivanan M.E., Ph.D.,
DATE: 13/11/2021
PLACE: CHENNAI SIGNATURE OF THE CANDIDATE
ACKNOWLEDGEMENT
grateful to them.
Technology for providing me necessary support and details at the right time during
the Department of Information Technology who were helpful in many ways for the
Weather is a vital part of a person's life because it can tell us whether it will rain or
be sunny. Weather forecasting is meteorologists' attempt to predict weather
conditions in the future, as well as weather conditions that may be predicted.
Temperature, pressure, humidity, dew point, rainfall, precipitation, wind speed, and
dataset size are all used to calculate the climatic state parameters. To begin, the
data must be educated. We can use 75-90% of the data from the data collection to
train the data. User can predict daily weather report using the particular dataset
which is already imported like API. Here API is vital role for current data. Here one of
the main feature is Speech Recognition(like alexa). It will ask question and user can
ask query which will send result. Mainly this will helpful for blind people. Based on
this user can get output for weather without click anything. If user want to access
directly they can go with visualization. Using this project user can get current
weather report and only need the input of name of the city once enter the city name
full report will be generated for current situation. We can analyze the predict
temperature with original temperature and can predict future rain fall. We'll use the
Linear Regression Algorithm and the Nave Bayesian Classification Algorithm to
make this prediction. Python, NumPy, Jupiter Notebook, Spyder, and Panda will be
used in this project. The project is split into three separate Jupiter Notebooks: one to
collect the weather data, inspect it, and clean it; a second to further refine the
features and fit the data to a Linear Regression model and Naïve Bayesian model
and a third to train and evaluate our output.
TABLE OF CONTENTS
ABSTRACT vi
LIST OF FIGURES ix
LIST OF ABBREVIATIONS AND MODULES ix
1 INTRODUCTION
1.1 GENERAL 1
1.2 OBJECTIVE 1
1.3 OVERVIEW OF THE PROJECT 1
3 PROJECT DESCRIPTION
3.1 OVERVIEW 4
3.2 FEATURES OF THIS APPLICATION 4
3.3 FORECAST DATA 5
3.6 WEATHER PREDICTION 6
3.5 TEMPERATURE PREDICTION 6
3.6 ADVANTAGE AND DISADVANTAGE OF WEATHER 7
FORECASTING
3,7 PRACTICAL APPLICATION OF WEATHER 7
FORECASTING
3.8 APPLICATION IN VARIOUS FIELDS 8
3.9 SUMMARY 8
REFERENCES
6 APPENDIX
A. SOURCE CODE
B. SCREEN SHOTS
LIST OF FIGURE
INTRODUCTION
1.1 GENERAL
1.2 OBJECTIVE
The objective of this application is that it saves time, simple and efficient. It is
mainly to avoid scared about weather related problems. The blind people can also
handle this application.
We have developed the system in such a way that it can be used efficiently by all
the users. Let’s Assume all the webpages and logics related to admin and users
as separate modules. We have two modules and each of these modules have
their own unique functions. Important thing is that it is not designed for particular
type peoples. This application can help all the users to access the weather report
details through internet or intranet that means anytime and anywhere. We wanted
to create a tool that fits into modern age, but still stays true to the “concepts of
studying”. So, this process also helps in maintaining consistency and integrity.
This system helps the user to generate the dynamic legwork.
CHAPTER 2
2.1 AIM
The main aim of this project is predict the weather report and should be useful for
all kind of peoples. Based on this type of application we can avoid unwanted
weather related problem. The Linear Regression algorithm, which is used to
forecast weather using these data, is at the center of this project, the higher the
precision, the more parameters considered. This project has the potential to assist
a large number of people in predicting tomorrow's weather. Temperature, dew,
pressure, and humidity are simply used to train the data in this project. These data
are then used to train a prediction model using Linear Regression.
2.3 PROBLEM STATEMENT
The peoples cannot know rainfall, snow etc.., and they couldn’t be able to prevent
from that natural disaster. Though using this application one can easily find out
their current weather situation in live location.
The people cannot know the current weather situation. So that the people face many
issues (like people going for outside purchase during the rain fall). Abstract weather
problem is defined in many areas and it’s hard to solve, because it includes many
constraints that should be solved. Its doesn’t have analysing process.
SYSTEM IMPLEMENTATION
3.1 OVERVIEW
The fundamental idea behind my project is to create a website that would make
greater this easier. I wanted to create a tool that fits into modern age, but still stays
true to the concepts of studying. Following is the detail of different modules of my
project.
Using this application we comes to know the weather situation in live locations.
This application dashboard contains speech recognition, current weather report for
specific city, Analyze average rainfall for every month in India, Rainfall predict the
Tomorrow, Predict the temperature for year, comparing original temperature vs
predict temperature.
Speech Recognition
The blind people can also access this project using this features.
Its option features the user can take this option once if need.
Current weather report for specific city
Using this feature the people can know current weather report for
live location and specific city. Its contains humidity, temperature, etc…,
Analyze average rainfall for every month
Using this feature one can analyse the monthly fall rain level.
Based on this we can analyse the rainfall and predict the rainfall for next
year.
Rainfall predict the tomorrow
Using this feature one can predict the rainfall will happen for
tomorrow or not
Get the current weather report for a location by city name. Using this we can get
the temperature for current location get to know temperature, humidity, chill, cold
etc…, The OpenWeatherMap API currently provides a wide variety of weather
data including current weather, forecasts, historical, weather stations and weather
alerts. The API documentation is comprehensive, easy to follow and includes
many examples of API requests and the responses returned.
We will work on forecasting the average global land and ocean temperature using
over 100 years of historical weather data. We’ll pretend that we don’t have access
the any weather forecasts. Through a comparative study of weather data
collected in Central Kerala from 2007 to 2015. We propose a system for
temperature prediction using three machine learning models. Multiple Linear
Regression (MLR), Artificial Neural Network (ANN), and Support Vector Machine
(SVM). We still have a century's worth of historical global temperature averages,
including global maximum and minimum temperatures, as well as global land and
ocean temperatures. Having all of this, we know that this is a supervised,
regression machine learning problem. Mean Error (ME), Mean Absolute Error
(MAE), and other metrics are used to assess the experimental outcomes.
3.6 ADVANTAGE AND DISADVANTAGE OF WEATHER FORECASTING
WEATHER FORECASTING
ADVANTAGES DISADVANTAGES
Farmers can know when to Weather is extremely difficult to
plant or harvest their crops forecast correctly
People can choose where and It is expensive to monitor-so
when to take their holidays to many variables from so many
take advantages of good sources
weather
Surfers known when large The computers needed to
waves are expected perform the millions of
calculations necessary are
expensive
Regions can be evacuated if The weather forecasters get
hurricanes or floods are blamed if the weather is
expected different from the forecast
Aircraft and shipping rely Weather is extremely difficult to
heavily on accurate weather forecast correctly
forecasting
Systematic weather records were kept after the invention of the instruments
for measuring atmospheric conditions during the 17th century. Undoubtedly,
these early records were employed mainly by those engaged in agriculture.
Planting and harvesting can be planned better and carried out more
efficiently if all the long-term weather patterns are estimated in advance.
Weather warnings are a special kind of short-range forecasts. It is needed
for the protection of human life from weather extremes. Weather warnings
are issued by government and military organizations throughout the world
for all kinds of threatening weather events like tropical storms which are
called as hurricanes, typhoons, or tropical cyclones, depending on location.
3.8 APPLICATIONS IN VARIOUS FIELDS
There are a number of sectors with their own specific needs for weather forecasts
and specialist services are provided to these users.
AIR TRAFFIC:
MARINE
Wind direction and intensity, wave periodicity and heights, tides, and
precipitation can all restrict commercial and recreational use of
waterways. Any of these factors may have an effect on the safety of
marine transportation.
As a result, a number of codes have been developed to effectively
transmit comprehensive marine weather forecasts to vessel pilots via
radio, such as the MAFOR (marine forecast) code.
RTTY, Navtex, and Radiofax can all be used to receive standard
weather forecasts at sea.
AGRICULTURE
FORESTRY
Wind, precipitation, and humidity forecasting are critical for
preventing and managing wildfires.Various indices have been
created, such as the Forest fire weather index and the Haines
Index, to predict which areas are more likely to experience fire
due to natural or human causes.
UTILITY COMPANIES
3.9 SUMMARY
The prediction method is in good working order. Many of the attribute values had
been correctly preprocessed. So all kinds of can use this application and get to
know the weather report easily without knowing the technical knowledge. This
application is very useful for professionals to analyse the temperature and rainfall
for monthly or yearly level. Blind people can handle this efficiently using speech
recognition.
CHAPTER 4
4.1 GENERAL
4.1.1 PYTHON
Python IDLE
Python 3.7
Linear Algorithm
Regression is a method of modeling a target value based on independent
prediction. This method is mostly used for forecasting and finding out cause and
effect relationship between variables. Regression techniques mostly differ based
on the member of independent variables and the type of relationship between the
independent and dependent variable.
Naïve Bayes Classification
Features selection
Normalization
Machine Learning
The data of weather forecast was obtained from Kaggle. We took about 4000
trained data and 800 test data.
Parameters are:
Temperature
Pressure
Humidity
Dew point
Rainfall
Precipitation
The project aim is to show the weather report for everyone. This project used to
show the report for all attributes and user can easily know about the weather
forecast, chillness, sunset, sunrise etc…, According to that the user comes to
know weather problems. Here speech recognition also included for extra one
feature. Despite of the blind people also able to work with it. Using the API
included all kinds of weather attributes. From the data collection, we know the
weather report either current or specific city which is defined by users. The
Government can analyze every year or every month wise rainfall level in order to
that we can predict rainfall for future year or month. Based on comparing the
original versus predicted temperature the developers can find the difference of the
temperature.
4.4 WORKFLOW DIAGRAM
4.1 FIGURE
4.4.1 DATA FLOW DIAGRAM
4.2 FIGURE
4.4.2 FLOW DIAGRAM FOR SPEECH RECOGNITION
4.3 FIGURE
STEP 2: Using API can predict the weather report for current specific city once
enter the city name.
"https://api.openweathermap.org/data/2.5/weather?q="+city+"&appid=06c921750b
9a82d8f5d1294e1586276f“
STEP 1: Load the dataset into the python and import the libraries
Step 2.2: Delete all values from te pressure which has a value -9999
Step 2.3: Taking all the features into x variable and y for prediction
Step 2.4: Set the dummies value as a level for the weather classification
Step 2.7: Created the new dataset after apply the preprocess
Step 3.1: Splitting Dataset into train set and test set
STEP 7: Output
4.5 FIGRUE
4.4.5 ALGORITHM FOR RAINFALL PREDICTION
STEP 2:Replace the value for ‘RainToday’ and ‘RainTomorrow’ columns with
(No:0, yes:1)
STEP 4: Output
4.6 FIGURE
4.5.2 DATASET FOR RAINFALL
4.7 FIGURE
CHAPTER 5
A weather prediction goal is show the weather report for everyone. This project
used to show the report for all attributes and user can easily know about the
weather forecast, chillness, sunset, sunrise etc…, According to that the user
comes to know weather problems. Here speech recognition also included for
extra one feature. Despite of the blind people also able to work with it. Using the
API included all kinds of weather attributes.
5.2 CONCLUSION
Weather forecasting using the linear regression algorithm and the Naïve Bayes
algorithm is critical for improving people’s future results. The linear regression
algorithm and the Naïve Bayes algorithm were used to forecast the weather using
weather datasets. Using some selected input variables obtained from kaggle,
GitHub we created a model to predict the weather. The issue with the current
weather situation is that we are unable to organize ourselves and complete
essential tasks. As a result, this model was developed in order to know the
weather scenario with high precision while taking into account all of the factors that
influence the weather scenario.
REFERENCES
Grid.py
[1] from tkinter import *
[2] #import speech
[3] import speech_recognition as sr
[4] import pyttsx3
[5]
[6] def weather():
[7] import Api
[8] Api.mains()
[9] def tomorrow():
[10] import rainfall
[11] rainfall.possible_rain()
[12] def analyze():
[13] import rainfall
[14] rainfall.analyze()
[15] def pred():
[16] import temp
[17] temp.predict()
[18] def ori():
[19] import temp
[20] temp.original()
[21]
[22]
[23]
[24] def main():
[25] root = Tk() #makes a blank popup, under the variable name 'root'
[26]
[27] topFrame = Frame(root,bg="#837E7C")
[28] root.geometry("1000x900")
[29] topFrame.pack()
[30] bottomFrame = Frame(root)
[31] bottomFrame.pack(side=BOTTOM)
[32] root.title("Weather App")
[33] root.configure(bg='#2C3539')
[34] f = ("poppins", 15, "bold")
[35] t = ("poppins", 35, "bold")
[36] label1 = Label(topFrame,borderwidth = 1,font = t)
[37] label1.pack()
[38] title = "\n" + "WEATHER REPORT " + "\n"
[39] label1.config(text = title,foreground = "white",bg="#837E7C",width = 20)
[40]
[41] button3 = Button(topFrame, text='Analyze avarage rainfall every month
for india', fg='green',command = analyze,font = f,bg='#0C090A')
[42] button1 = Button(topFrame, text='Current weather report for specific
city..........',command = weather, fg='red',font = f,bg='#0C090A')
[43] button2 = Button(topFrame, text='Do you need to predict rainfall
tomorrow......?', fg='blue',command = tomorrow,font = f,bg='#0C090A')
[44] button4 = Button(topFrame, text='Predict the temparature for
year....................', fg='pink',command = pred,font = f,bg='#0C090A')
[45] button5 = Button(topFrame, text='original vs prected
temparature....................', fg='yellow',command = ori,font = f,bg='#0C090A')
[46]
[47]
[48] button5.pack(side=BOTTOM,padx=20, pady=20)
[49] button4.pack(side=BOTTOM,padx=20, pady=20)
rainfall.py
[289]
df.dtypes.value_counts().plot.pie(explode=[0.1,0.1],autopct='%1.1f%%',shadow
=True,ax=axarr[1])
[290] axarr[1].set_title("type of our data ", fontsize=18)
[291]
[292] df.dtypes.value_counts().plot(kind='bar',ax=axarr[0])
[293] plt.title('type of our data');
[294] axarr[0].set_title("type of our data ", fontsize=18)
[295] plt.show()
[296]
[297] def analyze():
[298] data = pd.read_csv("Weather Data in India from 1901 to 2017.csv")
[299] # Average monthly rainfall in India
[300] ax=data[['JAN', 'FEB', 'MAR', 'APR','MAY', 'JUN', 'AUG', 'SEP',
'OCT','NOV','DEC']].mean().plot.bar(width=0.5, linewidth=2, figsize=(16,10))
[301] plt.xlabel('Month',fontsize=30)
[302] plt.ylabel('Monthly Rainfall (in mm)', fontsize=30)
[303] plt.title('Monthly Rainfall in Subdivisions of India', fontsize=25)
[304] ax.tick_params(labelsize=10)
[305] plt.grid()
[306] plt.show()
OUTPUT
6.1 FIGURE
FOR NORMAL USER
6.2 FIGURE
DASHBOARD
6.3 FIGURE
WEATHER REPORT
6.4 FIGURE
6.5 FIGURE
RAINFALL PROBABILITY
6.6 FIGURE
TEMPERATURE PREDICTION
6.7 FIGURE
6.8 FIGURE