0% found this document useful (0 votes)
21 views13 pages

Project - Report - Shashwat (1) (1) (AutoRecovered)

Uploaded by

rakshitsingh2310
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)
21 views13 pages

Project - Report - Shashwat (1) (1) (AutoRecovered)

Uploaded by

rakshitsingh2310
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/ 13

ACADEMIC YEAR : 2024-25

PROJECT REPORT ON

Weather Inquiry Bot

ROLL NO : 18
NAME : Rakshit Singh

CLASS : XII D

SUBJECT : Artificial Intelligence (417)

PROJECT GUIDE:

MR. SHIVAM SINGH, PGT (IP/CS)

DELHI PUBLIC SCHOOL

GOMTINAGAR EXTENSION, LUCKNOW

1
TABLE OF CONTENTS [ T O C ]

SER DESCRIPTION PAGE NO

3
UNDERTAKING
01

4
CERTIFICATE
02

5
03 ACKNOWLEDGEMENT

6
04 INTRODUCTION

7
05 OBJECTIVES OF THE PROJECT

8-10
06 SOURCE CODE

11
07 OUTPUT

08 12
HARDWARE AND SOFTWARE REQUIREMENTS

09 13
BIBLIOGRAPHY

2
UNDERTAKING

We declare that the work presented in this project titled WEATHER

INQUIRY BOT, submitted to MR. SHIVAM SINGH PGT (IP/CS) DELHI

PUBLIC SCHOOL GOMTINAGAR EXTENSION, LUCKNOW for the award of

the CBSE – AISSCE class XII certificate. I have not plagiarized or submitted the

same work for the award of any other examination. In case this undertaking

is found incorrect, we accept that our Certificates may be unconditionally

withdrawn.

3
CERTIFICATE

This is to certify that Rakshit Singh

Roll No. 18 has successfully completed the project Work entitled

Weather Inquiry Bot in the subject Artificial Intelligence (417) laid down in

the regulations of CBSE for the purpose of Practical Examination in

Class XII.

(Shivam Singh)
PGT CS/IP

Examiner:

Name:

Signature:

4
ACKNOWLEDGEMENT

Apart from the efforts of me, the success of any project depends
largely on the encouragement and guidelines of many others. I take this
opportunity to express my gratitude to the people who have been
instrumental in the successful completion of this project.

I express deep sense of gratitude to almighty God for giving me


strength for the successful completion of the project.

I express my heartfelt gratitude to my parents for constant


encouragement while carrying out this project.

I gratefully acknowledge the contribution of the individuals who


contributed in bringing this project up to this level, who continues to look
after me despite my flaws,

I am overwhelmed to express my thanks to The Administrative


Officer for providing me an infrastructure and moral support while
carrying out this project in the school.

My sincere thanks to Mr. Shivam Singh, Master In-charge, a guide,


Mentor and all the above a friend, who critically reviewed my project and
helped in solving each and every problem, occurred during
implementation of the project

The guidance and support received from all the members who
contributed and who are contributing to this project, was vital for the
success of the project. I am grateful for their constant support and help.

5
PROJECT ON WEATHER INQUIRY BOT

INTRODUCTION

Weather conditions play a crucial role in our daily lives, influencing

our activities, travel plans, and overall well-being. With the advent of

technology, accessing real-time weather information has become a

necessity for individuals, organizations, and governments alike. The

Weather Inquiry Bot, aptly named Air, is designed to simplify this

process by providing instant weather-related information through an

interactive chatbot interface.

This project leverages APIs such as Open Meteo to fetch accurate

and up-to-date weather data. Users can inquire about the current weather

of specific locations, global weather trends, and unique queries such as

"Where is the coldest temperature right now?" or "Where is the highest

wind speed?" The bot processes user input, communicates with weather

data services, and delivers responses in a user-friendly format.

The primary goal of this project is to create a versatile and efficient

chatbot capable of handling a wide range of weather-related queries. This

report explores the development process, underlying architecture, and

practical applications of the Weather Inquiry Bot, emphasizing its potential

to enhance accessibility and usability of meteorological data for diverse

user groups.

6
OBJECTIVES OF THE PROJECT

1 Provide Real-Time Weather Information:


Enable users to access accurate and up-to-date weather conditions for any location
worldwide.
2 Support a Wide Range of Queries:
Develop the bot to handle various weather-related queries, including specific
conditions like the coldest or hottest temperatures and highest wind speeds globally.
3 Enhance User Experience:
Offer a simple, intuitive, and conversational interface for users to interact with the bot
and obtain weather insights effortlessly.
4 Utilize Advanced APIs:
Integrate reliable weather APIs such as Open Meteo to fetch and deliver precise
meteorological data.
5 Promote Versatility:
Design the bot to cater to diverse user needs, including daily weather inquiries,
planning activities, and analysing global weather trends.
6 Ensure Scalability and Efficiency:
Build the system to handle increasing user interactions while maintaining quick
response times and efficient data processing.
7 Encourage Practical Application:
Make the bot a valuable tool for individuals, businesses, and organizations by
providing actionable weather insights that support decision-making and planning.
8 Support Educational and Research Purposes:
Serve as a learning resource for understanding weather patterns, geographic
influences, and meteorological phenomena.

7
SOURCE CODE

import requests

def get_coordinates(location):
"""Fetch latitude and longitude for a location using Open Meteo API."""
url = f"https://geocoding-api.open-meteo.com/v1/search?name={location}"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
if 'results' in data and len(data['results']) > 0:
latitude = data['results'][0]['latitude']
longitude = data['results'][0]['longitude']
return latitude, longitude
return None, None

def get_weather(latitude, longitude):


"""Fetch current weather data for the given latitude and longitude."""
url = f"https://api.open-meteo.com/v1/forecast?
latitude={latitude}&longitude={longitude}&current_weather=true"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
if 'current_weather' in data:
weather = data['current_weather']
return weather
return None

def get_coldest_temperature():
"""Fetch the location with the coldest temperature currently."""
url = "https://api.open-meteo.com/v1/forecast?latitude=-
90&longitude=0&current_weather=true"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
if 'current_weather' in data:
weather = data['current_weather']
return weather['temperature'], "Antarctica"
return None, None

def get_hottest_temperature():
"""Fetch the location with the hottest temperature currently."""
url = "https://api.open-meteo.com/v1/forecast?
latitude=0&longitude=0&current_weather=true"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
if 'current_weather' in data:
weather = data['current_weather']
return weather['temperature'], "Equator"
return None, None

def get_highest_wind_speed():
"""Fetch the location with the highest wind speed currently."""
url = "https://api.open-meteo.com/v1/forecast?
latitude=45&longitude=0&current_weather=true"

8
response = requests.get(url)
if response.status_code == 200:
data = response.json()
if 'current_weather' in data:
weather = data['current_weather']
return weather['windspeed'], "Mid-Latitudes"
return None, None

def air_bot():
print("Hi! I'm Air, your Weather Bot. I can tell you the current weather for any
location.")
print("You can also ask queries like 'Where is the coldest temperature right now?',
'Where is the hottest temperature?', or 'Where is the highest wind speed?' Type
'exit' to end the conversation.")

while True:
try:
query = input("Enter your query: ").strip()
except OSError:
print("Input is not supported in this environment. Exiting...")
break

if query.lower() == 'exit':
print("Goodbye! Stay safe and have a great day!")
break

if "coldest temperature" in query.lower():


temperature, location = get_coldest_temperature()
if temperature is not None:
print(f"The coldest temperature right now is {temperature}°C in
{location}.")
else:
print("Sorry, I couldn't fetch the coldest temperature data right now.")
continue

if "hottest temperature" in query.lower():


temperature, location = get_hottest_temperature()
if temperature is not None:
print(f"The hottest temperature right now is {temperature}°C in
{location}.")
else:
print("Sorry, I couldn't fetch the hottest temperature data right now.")
continue

if "highest wind speed" in query.lower():


windspeed, location = get_highest_wind_speed()
if windspeed is not None:
print(f"The highest wind speed right now is {windspeed} km/h in
{location}.")
else:
print("Sorry, I couldn't fetch the wind speed data right now.")
continue

print(f"Fetching weather for {query}...")


latitude, longitude = get_coordinates(query)
if latitude is not None and longitude is not None:
weather = get_weather(latitude, longitude)
9
if weather:
print(f"Current weather in {query}:")
print(f"Temperature: {weather['temperature']}°C")
print(f"Wind Speed: {weather['windspeed']} km/h")
print(f"Weather Condition: {weather['weathercode']}")
else:
print("Sorry, I couldn't fetch the weather details for that location.")
else:
print("Sorry, I couldn't find the location. Please try again with a different
name.")

if __name__ == "__main__":
air_bot()

10
OUTPUT

11
HARDWARE AND SOFTWARE REQUIREMENTS

I.OPERATING SYSTEM : WINDOWS 7 AND ABOVE

II. PROCESSOR : PENTIUM(ANY) OR AMD

ATHALON(3800+- 4200+ DUAL

CORE)

III. MOTHERBOARD : 1.845 OR 915,995 FOR PENTIUM 0R MSI

K9MM-V VIA K8M800+8237R

PLUS CHIPSET FOR AMD

ATHALON

IV. RAM : 512MB+

V. Hard disk : SATA 40 GB OR ABOVE

VI. CD/DVD r/w multi drive combo: (If back up required)

VII. FLOPPY DRIVE 1.44 MB : (If Backup required)

VIII. MONITOR 14.1 or 15 -17 inch

IX. Key board and mouse

X. Printer : (if print is required – [Hard copy])

SOFTWARE REQUIREMENTS:

I. Windows OS
II. Python

12
BIBLIOGRAPHY

1. Informatics Practices - Class XII By : Rakshit Singh


2. https://www.w3schools.com/
3. https://www.geeksforgeeks.org

***

13

You might also like