[go: up one dir, main page]

0% found this document useful (0 votes)
167 views23 pages

Mini Project Report On: Computer Science and Engineering

The document describes a weather forecasting app that uses Python. It will take in current temperature, humidity, and wind data from a user and predict the weather, specifically estimated rainfall in inches, based on historical data stored in a database. The admin adds past weather data to the database so the system can analyze it and make reliable predictions by applying a linear regression algorithm. The app would be useful for industries like agriculture, transportation, and energy production by allowing them to better prepare for upcoming weather conditions.

Uploaded by

Saikumar Yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
167 views23 pages

Mini Project Report On: Computer Science and Engineering

The document describes a weather forecasting app that uses Python. It will take in current temperature, humidity, and wind data from a user and predict the weather, specifically estimated rainfall in inches, based on historical data stored in a database. The admin adds past weather data to the database so the system can analyze it and make reliable predictions by applying a linear regression algorithm. The app would be useful for industries like agriculture, transportation, and energy production by allowing them to better prepare for upcoming weather conditions.

Uploaded by

Saikumar Yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

A

MINI PROJECT REPORT


On

WEATHER FORECASTING APP USING


PYTHON

BACHELOR OF TECHNOLOGY
in
COMPUTER SCIENCE AND ENGINEERING
Submitted by
(MIP-C30)
Student Name : 197Y1A05G6 & 197Y1A05E1
Under the Guidance
of

Professor/Associate/Assistant Professor

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 1


ABSTRACT

Weather forecasting is the application of science


and technology to predict the state of the
atmosphere for a given location.Ancient weather
forecasting methods usually relied on observed
patterns of events, also termed pattern recognition.
For example, it might be observed that if the sunset
was particularly red, the following day often brought
fair weather.However, not all of these predictions
prove reliable.

Here this system will predict weather based on


parameters such as temperature, humidity and wind.
User will enter current temperature; humidity and
wind, System will take this parameter and will
predict weather(rainfall in inches) from previous
MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 2
data in database(dataset). The role of the admin is to
add previous weather data in database, so that
system will calculate weather(estimated rainfall in
inches) based on these data. Weather forecasting
system takes parameters such as temperature,
humidity, and wind and will forecast weather based
on previous record therefore this prediction will
prove reliable. This system can be used in Air
Traffic, Marine, Agriculture, Forestry, Military, and
Navy etc.

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 3


1 INTRODUCTION

 Data Warehousing

Data Warehouse is electronic storage of a large amount


of information by a business which is designed for query and
analysis instead of transaction processing. It is a process of
transforming data into information and making it available to
users for analysis.

 Data Mining

Data mining is looking for hidden, valid, and potentially


useful patterns in huge data sets. Data Mining is all about
discovering unsuspected/ previously unknown relationships
amongst the data.It is a multi-disciplinary skill that uses machine
learning, statistics, AI and database technology.

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 4


1.1. Introduction
1.2. Weather forecasting is the application of science and
technology to predict the amount of temperature over a
region. It is important to exactly determine the rainfall for
effective use of water resources, crop productivity and pre-
planning of water structures.

In this project, we used Linear Regression to predict the amount


of rainfall. Linear Regression tells us how many inches of
rainfall we can expect.

1.2 Problem Definition

It is important to exactly determine the rainfall for effective use


of water resources, crop productivity and pre-planning of water
structures.

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 5


1.3 Scope
It tells us how many temperature,humidity we can expect.
1.4 Purpose
There are several reasons why weather forecasts are important.
They would certainly be missed if they were not there. It is a
product of science that impacts the lives of many people. The
following is a list of various reasons why weather forecasts are
important:

1. Helps people prepare for how to dress (i.e. warm weather,


cold weather,windy,weather,rainy,weather)
2. Helps businesses and people plan for power production and
how much power to use (i.e. power companies, where to set
thermostat)
3. Helps people prepare if they need to take extra gear to prepare
for the weather (i.e. umbrella, rain coat, sun screen)
4. Helps people plan outdoor activities (i.e. to see if
rain/storms/cold weather will impact outdoor event)
5. Helps curious people to know what sort of weather can be
expected (i.e. a snow on the way, severe storms)

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 6


6. Helps businesses plan for transportation hazards that can
result from the weather (i.e. fog, snow, ice, storms, clouds as it
relates to driving and flying for example)
7. Helps people with health related issues to plan the day (i.e.
allergies,asthma,heatstress)
8. Helps businesses and people plan for severe weather and
other weather hazards (lightning, hail, tornadoes, hurricanes, ice
storms)
9. Helps farmers and gardeners plan for crop irrigation and
protection (irrigation scheduling, freeze protection)
1.5 Problem and Existing Technology

The traditional forecast process employed by most NMHSs


involves forecasters producing text-based, sensible, weather-
element forecast products (e.g. maximum/minimum
temperature, cloud cover) using numerical weather prediction
(NWP) output as guidance. The process is typically schedule-
driven, product-oriented and labour-intensive. Over the last
decade, technological advances and scientific breakthroughs

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 7


have allowed NMHSs’ hydrometeorological forecasts and
warnings to become much more specific and accurate.

As computer technology and high-speed dissemination systems


evolved (e.g. Internet), National Weather Service (NWS)
customers/partners were demanding detailed forecasts in
gridded, digital and graphic formats. Traditional NWS text
forecast products limit the amount of additional information that
can be conveyed to the user community. The concept of digital
database forecasting provides the capability to meet
customer/partner demands for more accurate, detailed
hydrometeorological forecasts. Digital database forecasting also
offers one of the most exciting opportunities to integrate PWS
forecast dissemination and service delivery, which most
effectively serves the user community.

1.6 Proposed System

User will enter current temperature; humidity and wind, System


will take this parameter and will predict weather from previous
data in database. The role of the admin is to add previous
weather data in database, so that system will calculate weather
based on these data. Weather forecasting system takes
MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 8
parameters such as temperature, humidity, and wind and will
forecast weather based on previous record therefore this
prediction will prove reliable

2.REQUIREMENTS

2.1. Platform Requirements

Hardware/ Specification
Hardware / Software element
Software /version

Hardware Processor i3

RAM 2GB

Hard Disk 2
50GB

Software OS Windows,Li
nux.Jupyter
Python IDE
NoteBook.
Microsoft Azure
Python3.

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 9


MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 10
2.2. Modules Description

In this project we have Two modules

1)Data gathering and pre - processing.

2)Applying Algorithm for prediction .

Explanation:
1) In this module we first gather the data(dataset) for our
prediction model.Data comes in all forms, most of it being very
messy and unstructured. They rarely come ready to use.
Datasets, large and small, come with a variety of issues- invalid
fields, missing and additional values, and values that are in
forms different from the one we require. In order to bring it to
workable or structured form, we need to “clean” our data, and
make it ready to use. Some common cleaning includes parsing,
converting to one-hot, removing unnecessary data, etc.
2) In our case, our data has some days where some factors
weren’t recorded. And the rainfall in cm was marked as T if
there was trace precipitation. Our algorithm requires numbers,
so we can’t work with alphabets popping up in our data. so we
need to clean the data before applying it on our model.
MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 11
2)Once the data is cleaned, In this module that cleaned data can
be used as an input to our Linear regression model. Linear
regression is a linear approach to form a relationship between a
dependent variable and many independent explanatory
variables. This is done by plotting a line that fits our scatter plot
the best, ie, with the least errors. This gives value predictions, ie,
how much,  by substituting the independent values in the line
equation.

We will use Scikit-learn’s linear regression model to train our


dataset. Once the model is trained, we can give our own inputs
for the various columns such as temperature, dew point,
pressure, etc. to predict the weather based on these attributes.

Module Outcomes:
1) By the end of the first module the fully cleaned and useful
data is available for the apply the algorithm for the prediction.
1) By the end of the second module the actual prediction will be
happen the outcome is the amount of rainfall in inches based
upon the users input.

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 12


Algorithm:

Linear Regression is a machine learning algorithm based


on supervised learning. It performs a regression task.
Regression models a target prediction value based on
independent variables. It is mostly used for finding out the
relationship between variables and forecasting. Different
regression models differ based on – the kind of relationship
between dependent and independent variables, they are
considering and the number of independent variables being
used.

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 13


Linear regression performs the task to predict a dependent
variable value (y) based on a given independent variable (x). So,
this regression technique finds out a linear relationship between
x (input) and y(output). Hence, the name is Linear Regression.
In the figure above, X (input) is the work experience and Y
(output) is the salary of a person. The regression line is the best
fit line for our model.

Hypothesis function for Linear Regression :

y=mx+c

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 14


Where

y is the response variable.

x is the predictor variable.

m and c are constants which are called the


coefficients.

3.1 Flow charts and diagrams

3.2 Sequence diagram for weather forecasting

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 15


MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 16
3.3 Use Case diagram for weather forecast

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 17


3.DESIGN AND IMPLEMENTATION

3.1 Algorithms:
Linear Regression:
Module-1 :Data gathering and pre - processing.

Module-2: Applying Algorithm for prediction .

3.2 Source code


from tkinter import *

import requests

import json

from datetime import datetime

# Initialize Window

root = Tk()

root.geometry("400x400") # size of the window by default

root.resizable(0, 0) # to make the window size fixed

# title of our windowroot.title("Weather App - AskPython.com")

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 18


# ----------------------Functions to fetch and display weather info

city_value = StringVar()

def time_format_for_location(utc_with_tz):

local_time = datetime.utcfromtimestamp(utc_with_tz)

return local_time.time()

city_value = StringVar()

def showWeather():

# Enter you api key, copies from the OpenWeatherMap


dashboard

api_key = "5be7fdb24b0e829e6a5ec295bc3cd52a"

# sample API

# Get city name from user from the input field (later in the
code)

city_name = city_value.get()

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 19


# API url weather_url=
'http://api.openweathermap.org/data/2.5/weather?q=' +
city_name + '&appid=' + api_key

# Get the response from fetched url

response = requests.get(weather_url)

# changing response from json to python readable

weather_info = response.json()

tfield.delete("1.0", "end") # to clear the text field for every new


output

# as per API documentation, if the cod is 200, it means that


weather data was successfully fetched

if weather_info['cod'] == 200:

kelvin = 273 # value of kelvin

# -----------Storing the fetched values of weather of a city

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 20


temp = int (weather_info['main']['temp'] - kelvin) #
converting default kelvin value to Celcius

feels_like_temp = int(weather_info['main']['feels_like'] -
kelvin)

pressure = weather_info['main']['pressure']

humidity = weather_info['main']['humidity']

wind_speed = weather_info['wind']['speed'] * 3.6

sunrise = weather_info['sys']['sunrise']

sunset = weather_info['sys']['sunset']

timezone = weather_info['timezone']

cloudy = weather_info['clouds']['all']

description = weather_info['weather'][0]['description']

sunrise_time = time_format_for_location(sunrise + timezone)

sunset_time = time_format_for_location(sunset +
timezone)

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 21


# assigning Values to our weather varaible, to display as output

weather = f"\nWeather of: {city_name}\nTemperature


(Celsius): {temp}°\nFeels like in (Celsius): {feels_like_temp}°\
nPressure: {pressure} hPa\nHumidity: {humidity}%\nSunrise at
{sunrise_time} and Sunset at {sunset_time}\nCloud: {cloudy}
%\nInfo: {description}"

else:

weather = f"\n\tWeather for '{city_name}' not found!\n\


tKindly Enter valid City Name !!"

tfield.insert(INSERT, weather) # to insert or send value in our


Text Field to display output

# ------------------------------Frontend part of code – Interface

city_head = Label(root, text='Enter City Name', font='Arial 12


bold').pack(pady=10) # to generate label heading

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 22


inp_city = Entry(root, textvariable=city_value, width=24,
font='Arial 14 bold').pack()

Button(root, command=showWeather, text="Check Weather",


font="Arial 10", bg='lightblue', fg='black',

activebackground="teal", padx=5, pady=5).pack(pady=20)

# to show output

weather_now = Label(root, text="The Weather is:", font='arial


12 bold').pack(pady=10)

tfield = Text(root, width=46, height=10)

tfield.pack()

root.mainloop()

outputs

MINI PROJECT REPORT (2019-2023 Batch) Dept. of CSE, MLRITM 23

You might also like