Weather Forecasting

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 38

Datafication

Real time research project/societal research projects


Submitted to

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD,


KUKATPALLY, HYDERABAD – 500 085.
In partial fulfillment of the requirements for
The award of the degree of
BACHELOR OF TECHNOLOGY
(COMPUTER SCIENCE and ENGINEERING)
By
STUDENT NAME:
AFIYA NAAZ - 22L51A0501
HURIYA AMBER - 22L51A0539
ISMATH JAHAN - 22L51A0543
MAHVEEN SULTANA - 22L51A0550
Under the guidance of
Ms.SHAISTA NAUSHEEN
Asst.professor, department of cse

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

SHADAN WOMEN’S COLLEGE OF ENGINEERING & TECHNOLOGY

KHAIRATABAD, HYDERABAD – 500 004.

JULY 2024
SHADAN WOMEN’S COLLEGE OF ENGINEERING AND TECHNOLOGY
(Approved by AICTE, New Delhi & Affiliated to JNTUH,
Hyderabad) Khairatabad, Hyderabad – 500 004

Department of computer science and engineering


Real-time Project Assessment Sheet(R22) for IIyr-Sem-2

 Recommendations & Comments

Max Faculty Dat


Week.No Activity Score
Score Signatur e of
e Eval
uatio
n

1 Abstract 10

2&3 Survey
10

4&5 Analysis

6 Design 10

7 Seminar- 20
1+Report

Mid-1Total 50

8,9&10 Implementation 10

11 Testing 10

12 Execution 10

13 Seminar-2+ 20
Report

Mid-2Total 50

Incharge HOD
TABLE OF CONTENTS

CHAPTE PAGE
TITLE
R NO. NO.

ABSTRACT 1

1 INTRODUCTION 2

1.1 General 2

1.2 Objective 2

1.3 Existing System 2

1.4 Proposed System 3

2 LITERATURE SURVEY 4

2.1 General 4

2.2 Greedy Perimeter Stateless Routing 4

2.3 A Cross_Layer Protocol 5

3 REQUIREMENT ANALYSIS 6

3.1 General 6

3.2 Hardware Requirement 6

3.3 Software Requirement 6


3.4 Functional Requirement 7

3.5 Non Functional Requirement 7

4 METHODOLOGY AND MODULES 8

4.1 System Architecture 8

4.2 Data Flow Diagram 9

5 SYSTEM DESIGN 10

5.1 General 10

5.2 UML Notation 10

5.3 Use Case Diagram 12

5.4 Activity Diagram 13

5.5 Sequence Diagram 14

5.6 Data Flow Diagram 15

5.7 State Chart Diagram 15

5.8 Class Diagram 16

6 TESTING 17

6.1 General 17

6.2 Unit Testing 18

6.3 Integration Testing 18


6.4 Functional Testing 18

6.5 User Interface (UI) Testing 18

6.6 Performance Testing 18

6.7 Security Testing 18

6.8 Test Cases 19

7 IMPLEMENTATION 20

7.1 General 20

7.2 Code Snippets 20

7.3 Screenshots 29

8 APPLICATION AND FUTURE ENHANCEMENT 31

CONCLUSION 32

REFERENCES 33
LIST OF FIGURES

FIGURE NO. FIGURE NAME PAGE NO

4.1 Architecture of a Complete System 8

4.2 Data flow Diagram 9

5.4 Activity Diagram 13

5.5 Sequence Diagram 14

5.6 Data flow Diagram 15

5.7 State chart Diagram 15

5.8 Class Diagram 16


ABSTRACT

In today's fast-paced world, access to accurate and timely weather information is


essential for planning daily activities and making informed decisions. This project focuses on
the development of a weather forecast application using Python for the backend functionality
and HTML/CSS for the fronted interface. The application utilizes open-access weather API s
to retrieve real-time weather data for various locations worldwide. The backend of the
application is built using Python, leveraging libraries such as Flask for creating a lightweight
web server and requests for making API calls to fetch weather data. The application fetches
weather information such as temperature, humidity, wind speed, and weather conditions for a
specified location. Additionally, it provides features like daily and hourly forecasts, enabling
users to plan their activities accordingly.

On the fronted, HTML and CSS are employed to design an intuitive and user-friendly
interface. The design prioritizes simplicity and clarity, ensuring that users can easily interpret
the weather information displayed. This ensures that users can access weather forecasts
conveniently regardless of the device they are using. Overall, this project demonstrates a
robust and user-friendly weather forecast application. By providing accurate and accessible
weather information, the application aims to enhance users' ability to plan their activities
effectively based on current and forecasted weather conditions.

Chapter 1

INTRODUCTION
1.1 GENERAL

Current weather apps lack simplicity and speed, making it challenging for users
to quickly access accurate information for specific cities. There is a need for streamlined web
application that prioritizes user-friendly interfaces, delivering real-time, precise weather
details for informed decision-making in travel, planning, and daily activities.

1.2 OBJECTIVE

The objective of this weather project is to design and implement an efficient and
user-friendly system that helps user to know about weather details of any city using its name
only.

Primary Goals of this project:

 User-friendly Interface
 Accurate weather Details
 Fast data Fetching

Warehousin
g
electronic
storage of a
large
amount of
information
by
1.3 EXISTING SYSTEM

A weather forecast is made up of three steps: observation and analysis, extrapolation to


determine the state of the atmosphere in the future, and estimation of specific variables. One
method of qualitative extrapolation is to conclude the weather features will continue to travel
in the same direction as they have been.
Observation and Analysis
1. While data-access policies differ by country, all of these reports are sent to regional and
global centers through the World Meteorological Organization's (WMO) Global
Telecommunications System (GTS).
2. The data is then compiled, redistributed in the GTS, and used in various numerical
forecasting models. Typically, these numerical models begin with data collected between
the hours of 0000 and 1200 UTC (7 A.M. and 7 P.M. Eastern Standard Time,
respectively).
3. To aid the forecaster, the data is printed, mapped, and graphed in several ways.
Furthermore, some "initialization" routines slightly change the data when it enters a
prediction model only for that model.

1.4 PROPOSED SYSTEM

RB Multicast is a receiver-based protocol, which means that the relay node of a packet
transmission is decided by the potential receivers of the packet in a distributed manner.
In RB Multicast, the multicast routing uses the concepts of “virtual node” and “multicast region” for
forwarding packets closer to the destination multicast members and determining when
packets should be split into separate routes to finally reach the multicast members.
These networks are dynamic due to the mobility of the nodes in the network and/or the
random sleep/awake cycles that are often utilized to minimize energy dissipation of the devices the
performance of RB Multicast is compared to that of the unicast protocol to show the
performance gain achieved by the proposed multicast routing protocol.
The results show that RB Multicast achieves much better performance in terms of latency and
network traffic.
RB Multicast includes a list of the multicast members’ locations in the packet header, which
prevents the overhead of building and maintaining a multicast tree at intermediate sensor
nodes, because all the necessary information for routing the packet is included with in the
packet header

Chapter 2

LITERATURE SURVEY

2.1 GENERAL

This chapter gives the literature survey about the various important techniques and
algorithms such as robust active shape model approach and local shape analysis method
needed to carry out the project. It also gives the information about drawbacks in the existing
robust active shape model approach and the advantages of local shape analysis.
2.2 GPSR: GREEDY PERIMETER STATELESS ROUTING
FOR WEATHER FORECASTING

Weather forecasting has been one of the most challenging difficulties around the world
because of both its practical value in popular scope for scientific study and meteorology.
Weather is a continuous, dynamic ,multidimensional chaotic process, and data-intensive and
these properties make weather forecasting a stimulating challenge. It is one of the most
imperious and demanding operational responsibilities that must be carried out by many
meteorological services all over the globe. Various organizations / workers in India and
abroad have done demonstrating using supported time series data manipulation. The various
methodologies viz. statistic decomposition models, Exponential smoothing models, ARIMA
models and their dissimilarities like seasonal ARIMA models, vector ARIMA models using
flexible time series, ARMAX models i.e. ARIMA with following informative variables etc.,
which has been used for forecasting purposes. Many training have taken place within the
analysis of pattern and circulation of rainfall in many regions of the world. Totally altered
time series methods with different purposes are used to investigate weather information in
many different literatures. Accurate and timely weather forecasting is a major challenge for
the scientific research.

2.3 A CROSS-LAYER PROTOCOL


Weather prediction modelling involves a combination of many computer models,
observations and acquaintance of trends and designs. Using these methods, practically
accurate forecasts can be made up. Regression is a statistical experimental technique and it
must be widely used in many business, the behaviour sciences, social and climate recasting
and many other areas. Agrawal et al. (1980) explained the phenomena for time series
regression models for forecasting the yield of rice in Raipur district on weekly data using
weather parameters [1]. In [2] the author Kuo and Sun, (1993) was used to Associate in
having intervention model for average10 days stream flow forecast and synthesis that was
investigated by to effect the extraordinary phenomena caused by typhoons and different
serious irregularities of the weather of the Tanshui geographical area in Taiwan. In [3] Chiew
et al, (1993) conducted a comparison of six rainfall-runoff modeling approaches to pretend
daily, monthly and annual flows in eight tolerant catchments. They concluded that time-series
approaches will agreement adequate estimates of monthly and annual yields within the water
capitals of the catchments. In [4] Langu, (1993) is another approach which used statistical
analysis to observe changes in weather and runoff patterns to go and look for important
changes inside the parts of variety of weather statistic. Box and Jenkins (1994), in early
1970's, pioneered in developing methodologies for statistic indicating within the uni variate
case often known to Univariate Box-Jenkins (UBJ) ARIMA modeling in this approach of
author[5].The variables which describes weather conditions vary continuously with time in
this explanation we found that the author [6], describing time series of each and every
parameter and can be used to develop a forecasting model either statistically or using some
new means that uses this time series data (Chatfield 1994; Montgomery and Lynwood 1996).
Several authors have discussed the fuzziness associated with the weather systems.
In [7] Chaotic features are associated with the atmospheric phenomena also have fascinated
the attention of the modern scientists (Sivakumar 2001; Sivakumar et al. 1999; Men et al.
2004). At present, the valuation of the nature and causes of seasonal climate variability is still
formation. Since, it is a complicated phenomenon that includes many specialized fields of
know-how to work for weather prediction (Guhathakurata, 2006); therefore, in the field of
meteorology all assumptions are to be taken in the visage of uncertainty connected with local
of and global climatic variablesexplained that the modelled weather parameter using some of
the random methods.

Chapter 3

REQUIREMENT ANALYSIS

3.1 GENERAL

This chapter provides details about the system requirements. The functional, non-
functional, hardware and software requirements are explained in detail. The functional
requirements define a function of system. The function is described as a set of input, the
behaviour and outputs. The non-functional requirement is a requirement that specifies criteria
that can be used to judge the operation of a system, rather than specific behaviors. The
hardware and software requirements describe about the tool and the languages used to build
the system.
3.2 HARDWARE REQUIREMENTS

Processor : Intel core i5


RAM : 4 GB
Hard Disk Drive : 80 GB
Monitor : 17" Color Monitor

3.3 SOFTWARE REQUIREMENTS

Front End/GUI Tool : Visual studio Code


Operating System : Windows 10
Language : Python, HTML&CSS, Bootstrap
Application : Window Application
Back End : SQL SERVER

3.4 FUNCTIONAL REQUIREMENTS

 The operator shall be able to input the weather periods to the system to view the
desired weather parameters within the particular periods.
 The system shall be able to produce minimum, maximum and the average data of
a particular weather parameter when it is requested by an operator.
 The system shall provide the following weather parameters: temperature,
pressure, wind speed & direction, rainfall, and humidity.

3.5 NON FUNCTIONAL REQUIREMENTS


 The weather system shall be ready by 31 November 2017.
 It shall not exceed the budget that has been stated in the MOU ($1.3 million).
 System’s operational and location of remote station and central station shall not
violate the current Government regulations of environment and
 The weather sensors shall be able to be upgraded every 5 years.

Chapter 4

METHODOLOGY
4.2 SYSTEM ARCHITECTURE

Let’s Draw an ER Diagram for our Weather Application:

Fig 4.1 -ER Diagram

4.2 DATA FLOW DIAGRAM:


Fig 4.2 Data flow Diagram
Chapter 5

SYSTEM DESIGN

5.1 GENERAL

This chapter deals with unified modelling language. UML is a language for
visualizing, specifying, constructing and documenting artefacts of software intensive systems.
The UML has emerged as the de facto and de jure standard diagramming notation for object-
oriented modelling. UML includes a set of graphic notation techniques to create visual
model of object-oriented software-intensive systems.

5.2 UML NOTATION

UML notations are the most important elements in modelling. Efficient and
appropriate use of notations is very important for making a complete and meaningful model.
Different notations are available for things and relationships. And the UML diagrams are
made using the notations of things and relationships.

NAME SYMBOL DESCRIPTION


Internal or external entity that interacts with
Actor the system

Use case is used to capture high level


Use Case functionalities of a system.

A semantic relationship between two


Dependency elements in which a change to one element
may affect the meaning of other
Association A structural relationship describing a set of
links connected between objects.
A relationship in which objects of a
Generalization specialized element are substitutable for
objects of a generalized element (parent).
A classifier describes a set of instances that
Classifier have common behavioural and structural
Role features.

This action send message and wait for a


Call Action reply. The reply message is send back to
that message.
Send Action Create message is sent to a lifeline to create
itself.
Return Action Send message and proceed immediately
without waiting for return value.

Classifier A classifier describes a set of instances that


Role have common behavioural and structural
features.
Initial State It shows the starting point of a process.

Final State It shows the end of a process.

Choice Collection of operation that specifies a


service of class.
Junction A diamond represents a decision with
alternate paths.

A synchronization bar helps illustrate


Fork parallel transitions

A synchronization bar helps illustrate


Join parallel transitions

States represent situations during the life of


State an object.

Action states represent the noninterruptible


Action actions of objects.
A node represents a physical component of
Node the system. Node is used to represent
physical part of a system like server,
network etc.
Component is used to represent any part of
Component a system for which UML diagrams are
made.
The top section is used to name the class.
The second one is used to show the
Class attributes of the class. The third section is
used to describe the operations performed
by the class.

Aggregation It is a special type of association depicting


whole part relationship.
Composition Composition is a special type of
aggregation that denotes a strong ownership
between Classes, the whole and its part.

5.2 Table 2- Uml notation

5.3 USE CASE DIAGRAM

Use case diagrams describe the functional behaviour of the system as seen by the user.
It shows a set of actors and use cases and their relationships. It is important for organizing and
modelling the external behaviour of the system. In the Fig.5.1 CT image and learning database
act as an external entity that interacts with the system. Ellipse drawn with a solid line,
represent the use case. An include relationship is that the base use case explicitly incorporates
the behaviour of another use case at a location specified in the base. An exclude relationship is
that the base use case implicitly incorporates the behaviour of another use case at a location
specified by the extending use case.
5.4 ACTIVITY DIAGRAM
Activity Diagrams model the dynamic behaviour of a system, in particular the work
flow. Activity diagrams can be used to describe the business and operational step-by-step
workflows of components in a system. An activity diagram shows the overall flow of control.
The rounded rectangles represent activities,diamonds represent decisions,bars represent the
start (split) or end (join) of concurrent activities black circle represents the start (initial state)
of the workflow and an encircled black circle represents the end (final state).Arrows run from
the start towards the end and represent the order in which activities happen. Fig.5.2 represents
the activity diagram.

Fig. 5.4 Activity Diagram

5.5 SEQUENCE DIAGRAM


Sequence diagrams describe the dynamic behaviour between actors and the system and
between objects of the system. A sequence diagram shows, as parallel vertical lines (lifelines),
different processes or objects that live simultaneously, and, as horizontal arrows, the messages
exchanged between them, in the order in which they occur. This allows the specification of
simple runtime scenarios in a graphical manner.

Fig. 5.5 Sequence Diagram


5.6 DATA FLOW DIAGRAM

5.7 STATE CHART DIAGRAM

State chart diagrams describe the dynamic behaviour of an individual object. This
behaviour is analyzed and represented in series of events, that could occur in one or more
possible states. Hereby "each diagram usually represents objects of a single class and track the
different states of its objects through

Fig 5.7-State chart diagram

5.8 CLASS DIAGRAM

Class diagrams describe the static structure of the system: Objects, Attributes,
Associations. It shows a set of classes, interfaces and collaborations and their relationships.
Address static design view of a system.

The upper part holds the name of the class


The middle part contains the attributes of the class
The bottom part gives the methods or operations the class can take or undertake

In the design of a system, a number of classes are identified and grouped together in a class
diagram which helps to determine the static relations between those objects. With detailed
modelling, the classes of the conceptual design are often split into a number of subclasses.
Fig. 5.8 Class Diagram

Chapter 6

TESTING

6.1 GENERAL

Testing can never completely identify all the defects within software. Instead, it
furnishes a criticism or comparison that compares the state and behaviour of the product
against oracles, principles or mechanisms by which someone might recognize a problem.
These oracles may include (but are not limited to) specifications, contracts, comparable
products, past versions of the same product, inferences about intended or expected purpose,
user or customer expectations, relevant standards, applicable laws, or other criteria.
Every software product has a target audience. For example, the audience for video game
software is completely different from banking software. Therefore, when an organization
develops or otherwise invests in a software product, it can assess whether the software product
will be acceptable to its end users, its target audience, its purchasers, and other stakeholders.
Software testing is the process of attempting to make this assessment.

A primary purpose of testing is to detect software failures so that defects may be


discovered and corrected. This is a non-trivial pursuit. Testing cannot establish that a product
functions properly under all conditions but can only establish that it does not function properly
under specific conditions. The scope of software testing often includes examination of code as
well as execution of that code in various environments and conditions as well as examining
the aspects of code: does it do what it is supposed to do and do what it needs to do. In the
current culture of software development, a testing organization may be separate from the
development team. There are various roles for testing team members. Information derived
from software testing may be used to correct the process by which software is developed.

Not all software defects are caused by coding errors. One common source of expensive
defects is caused by requirement gaps, e.g., unrecognized requirements that result in errors of
omission by the program designer. A common source of requirements gaps is non-functional
requirements such as testability, scalability, maintainability, usability, performance and
security.

6.2 UNIT TESTING

 Test individual modules or components of the system in isolation to ensure they


function as intended.
 We have a major weather details module which uses api to fetch the weather data,
in this testing step we take we make sure proper functionality of each component.

6.3 INTEGRATION TESTING

 Verify that different modules and components of the Todays weather application
work together seamlessly.
 Test data flow and interactions between various parts of the system.

6.4 FUNCTIONAL TESTING


 Validate that the weather forecasting details its intended functions accurately and
efficiently.

6.5 USER INTERFACE (UI) TESTING

 Ensure that the user interface is user-friendly, intuitive, and visually appealing.
 Check for consistency in design elements and responsiveness across different
devices.

6.6 PERFORMANCE TESTING

 Assess the system’s performance under normal and peak load conditions.
 Check response times, scalability, and overall system stability.

6.7 SECURITY TESTING

 Identify and rectify any security vulnerabilities in the system.


 Ensure that user data is handled securely, and unauthorized access is prevented
specially in case of location.

6.8 TEST CASES:

S..NO City State Country Expected result

Tc1 Hyderabad Telangana India desc,icon,temp

Tc2 Toronto Ontario Canada desc,icon,temp

TC3 Mahabubnagar Telangana India desc,icon,temp

Table 2- Test cases


Chapter 7

IMPLEMENTATION

7.1 GENERAL

This chapter provides detail about the implementation of the system. It gives a detailed
view about the steps in implementation of the project.

7.2 CODE SNIPPETS:

1. Weather Data Class and Utility Functions

weather.py
@dataclass

class WeatherData:

main: str

description: str

icon: str

temperature: int

def get_current_weather(lat, lon, API_key):

resp = requests.get(fhttps://api.openweathermap.org/data/2.5/weather?
lat={lat}&lon={lon}&appid={API_key}&units=metric').json()

data = WeatherData(

main = resp.get('weather')[0].get('main'),

description = resp.get('weather')[0].get('description'),

icon = resp.get('weather')[0].get('icon'),

temperature = int(resp.get('main').get('temp'))
)

return data

def main(city_name, state_name, country_name):

lat, lon = get_lat_lon(city_name, state_name, country_name, api_key)

weather_data = get_current_weather(lat, lon, api_key)

return weather_data

2. Flask Application

app.py

@app.route('/', methods=['GET', 'POST'])

def index():

data = None

if request.method == 'POST':

city = request.form['cityName']

state = request.form['stateName']

country = request.form['countryName']

data = get_weather(city, state, country)

return render_template('index.html', data=data)

3. .env File

API_KEY=your_openweathermap_api_key
@dataclass
class WeatherData:
main : str
description : str
icon : str
temperature : int

def
get_lat_lon(cityName,stateCode,countryCo
de,APIkey):

resp=requests.get(f'http://api.openweath
ermap.org/geo/1.0/direct?q={cityName},
{stateCode},
{countryCode}&appid={APIkey}').json()
data = resp[0]
lat,lon = data.get('lat'),
data.get('lon')
return lat, lon
try:

1
# Make the API request
resp =
requests.get(f'http://api.openweathermap
.org/geo/1.0/direct?q={cityName},
{stateCode},
{countryCode}&appid={APIkey}').json()

# Checking if the response list


is not empty
if resp:
data = resp[0]
lat, lon = data.get('lat'),
data.get('lon')
return lat, lon
else:
print(f"No results found for
{cityName}, {stateCode}, {countryCode}")
return None, None

except
requests.exceptions.RequestException as
e:

2
# Handling any request
exceptions (e.g., network errors)
print(f"Request error: {e}")
return None, None
except (KeyError, IndexError) as e:
# Handling any key/index errors
print(f"Data error: {e}")
return None, None

3
app.py

from flask import Flask,


render_template, request
from weather import main as get_weather

app = Flask(__name__)

@app.route('/', methods=['GET', 'POST'])


def index():
data = None
if request.method == 'POST':
city = request.form['cityName']
state =
request.form['stateName']
country =
request.form['countryName']
data =
get_weather(city,state,country)

return
render_template('index.html',data=data)
if __name__ == '__main__':
4
app.run(debug=True)
index.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-
scale=1.0">
<title>My Weather App</title>
<link
href="https://cdn.jsdelivr.net/npm/boots
[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-
QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNl
yT2bRjXh0JMhjY6hW+ALEwIH"
crossorigin="anonymous">
</head>
<body class="bg-warning text=white">
<div class = "text-center">

5
<h1 class="mt-5">Weather
Website</h1>
<form action="/" method="post">
<div class="container">
<div class="row">
<div class="col-sm">
<input type="text" id="cityName"
name="cityName" placeholder="City"
class="form-control">
</div>
<div class="col-sm">
<input type="text"
id="stateName" name="stateName"
placeholder="State" class="form-
control">
</div>
<div class="col-sm">
<input type="text
id=countryName" name="countryName"
placeholder="Country" class="form-
control">
</div>
<div >

6
<button style="margin:30px"
class="submit btn btn-
light">Find</button>
</div>
</div>
</div>
</form>
{% if data %}
<!-- {{data.main}}:{{
data.description }}<br> -->
<img
src="https://openweathermap.org/img/wn/1
[email protected]" alt="Icon">
{{data.temperature}} C
{% endif %}

</div>

<script
src="https://cdn.jsdelivr.net/npm/bootst
[email protected]/dist/js/bootstrap.bundle.min.j
s"

7
integrity="sha384-
YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDz
Oxhy9GkcIdslK1eN7N6jIeHz"
crossorigin="anonymous"></script>"

</body>
</html>

7.3 SCREENSHOTS

7.3.1 Front End Screenshot

8
Fig.7.3.1 Front end page

7.3.2 Back End Screenshot

Fig.7.3.2 Back end page

You might also like