Unix Report
Unix Report
REPORT ON
“WEATHER FETCHER”
Submitted in partial fulfilment of the requirements for the 5th Semester
INFORMATION SCIENCE AND ENGINEERING
Submitted by
HANSIKA S V 1BI22IS033
HARISH CHANDRA THAKUR 1BI22IS034
INDU GULAPALYAM 1BI22IS035
HEMANTH M P 1BI22IS036
DR. ROOPA H
Associate Professor
Department of ISE
BIT, Bangalore
CHAPTER PAGE
DESCRIPTION
NO. NO.
1 INTRODUCTION 1-2
1.2 Objectives 1
2 PROBLEM STATEMENT 3
4 IMPLEMENTATION 6-10
4.1 Methods 6
4.2.1 Implementation 6
4.3.1 Implementation 8
5 RESULTS 11-12
6 CONCLUSION 13
REFERENCES 14
LIST OF FIGURES
FIGURE PAGE
DESCRIPTION
NO. NO.
Figure 1.1 Weather Fetcher using UNIX 2
A Weather Fetcher is a tool or application designed to retrieve and display weather information
by connecting to online weather data providers. It typically integrates with APIs such as
OpenWeatherMap or WeatherAPI, fetching real-time or forecasted data like temperature,
humidity, wind speed, and precipitation. Users can input location details such as city names,
ZIP codes, or geographic coordinates, with advanced systems sometimes offering GPS or IP-
based location detection. The fetched data, usually in JSON or XML format, is parsed and
displayed in a user-friendly manner through various interfaces, ranging from web or mobile
apps to command-line tools. Weather fetchers often include features like unit conversion, error
handling for invalid inputs or network issues, and periodic updates to ensure current
information. They are widely used in personal projects, smart devices, travel applications, and
forecasting tools, offering valuable insights for daily activities and decision-making.
1.2 Objectives
The primary objectives of the Weather Fetcher are:
• To provide accurate and real-time weather data by connecting to reliable weather APIs.
• To provide support for diverse location inputs such as city names, ZIP codes, or
geographic coordinates.
• To provide processed and structured weather information that is easy to read and
understand.
• To provide actionable weather insights for informed decision-making in various
applications.
• To provide user-friendly features like unit conversion, language options, and
customizable settings.
2. WeatherAPI
• Premium features (like advanced historical data) require costly subscriptions.
• The free tier has a limited number of API requests per month.
• User interface for setup can be complex for beginners.
3. wttr.in
• Limited customization of the data format.
• Does not provide advanced features like weather alerts or historical data.
• Relies on other APIs (like OpenWeatherMap) for data, which might inherit their
limitations.
4. AccuWeather API
• Subscription costs are high, especially for commercial use.
• Complex API structure compared to simpler alternatives.
• Overwhelming for users seeking basic weather data.
5. NOAA Weather Service
• Limited to U.S. regions for detailed data.
• Outdated or less user-friendly API compared to modern alternatives.
• Lacks the convenience of advanced developer features, such as SDKs or client libraries.
#!/bin/bash
API_KEY="0434b123c3c1ede00e552fbea991f112"
echo "Enter your city:"
read CITY
RESPONSE=$(curl -s "http://api.openweathermap.org/data/2.5/weather?q=$CITY&appi>
if [ -z "$RESPONSE" ]; then
echo "Error: Failed to fetch weather data. Please check your internet conne>
exit 1
fi
if command -v jq > /dev/null; then
echo "Weather Information:"
echo "$RESPONSE" | jq -r '. | "City: \(.name)\nTemperature: \(.main.temp)°C>
else
echo "Error: jq is not installed. Please install jq for formatted output."
exit 1
fi
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#define BUFFER_SIZE 1024
int fd;
char buffer[BUFFER_SIZE];
fd = open("fetch_weather_shell.sh", O_RDONLY);
if (fd < 0) {
perror("Error opening shell script file");
exit(EXIT_FAILURE);
}
Applications
3. Weather Forecasting: Use weather fetchers to monitor and predict weather patterns,
helping to issue forecasts and warnings.
4. Travel and Tourism: Provide tourists with forecasts to help them plan activities based
on weather conditions.
5. Agriculture: Farmers use weather data to decide when to plant or harvest crops,
optimize irrigation schedules, and protect against extreme weather events.
Future Scope
• Real-Time and Hyperlocal Forecasting: The growing number of Internet of Things
(IoT) devices, such as smart weather stations, sensors, and drones, will provide real-
time data at a granular level, enabling hyperlocal weather predictions.
• Enhanced Climate Change Monitoring: Weather-fetching systems will increasingly
track and analyze long-term climate changes, providing actionable insights for climate
change mitigation and adaptation strategies.
• Blockchain and Weather Data Security: Blockchain could be used to authenticate
and secure weather data, ensuring its reliability for industries that depend on it, such as
agriculture, insurance, and logistics.
[2] Books like "The C Programming Language" by Brian W. Kernighan and Dennis M.
Ritchie are foundational for these concepts.
Page 14