Skip to content

beee33/weatherCLI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

weatherCLI

weatherCLI is a Linux command line UI based application that shows the user the weather and sun information from the National Weather Service written in Python. Because of this, weatherCLI is only available in the United States, and its territories, However, the sun calculation is worldwide.

AI Statment

NO AI was used in making this program

Application for generating weather using data from NOAA

https://www.noaa.gov/
https://weather.gov/

API for sun information from Astronomical Applications Department

https://aa.usno.navy.mil/data/api
https://aa.usno.navy.mil/api/

Geocoding for latitude and longitude using data from OpenStreetMap

https://nominatim.openstreetmap.org/
https://openstreetmap.org/copyright

What kind of data can the application show:

Human readable worded weather from NOAA's API (example: Partly cloudy, with a low around 32. West wind 5 to 14 mph):

  • Both day and night are unique
  • Up to one week forecast

Graphs:

  • Precipitation type & Probability
  • Daily low
  • Daily high

Sun data:

  • Sunrise
  • Sunset
  • Solar noon
  • Moon info

Live data from the location’s nearest weather station:

  • Temperature
  • Humidity
  • Visibility
  • Dew point
  • Name of station
  • Wind direction
  • Sustained wind speed
  • Wind gusts (will show NA knots if no gusts)
  • Local station url if you want to get more information:

weather warnings (example: Frost Advisory, Winter Storm Warning or Severe Thunderstorm Warning)

How does weatherCLI get its data?

The National Weather Service allows you to generate XML files showing weather data from a specific longitude and latitude. This program reads those XML files and presents them to the user as readable data. To get the sun positions, the program uses the US Navy's API for getting sun info expressed in json, and prints the result out on terminal.

Supported operating systems

OS Supported?
Debian
Ubuntu
Fedora
Arch
Mint 🔶
Pop OS 🔶
EndeavourOS 🔶
Windows

✅: Supported
🔶: Untested
❌: Broken

Install

Option 1: Installation script.

This script allows you to:

  • Compile it into one single program with pyinstaller using the latest release version or directly from github and installing the compiled version.

  • Use the pre-bundeled program compiled on the latest release and installing it.

  • Uninstall the program and or configuration files.

These paths are used by weatherCLI

(only for the users that used the Installation script)

Program location:

~/.local/bin/weather-machine/weatherCLI

Configuration location:

~/.config/weatherCLI/

Dependencies:

  • python3
  • git
  • curl

Installation Script:

curl https://raw.githubusercontent.com/beee33/weatherCLI/master/install-non-root.sh  -o install-non-root.sh 

Read script, this is optional. However, you should always review programs before you give them access to your computer:

less install-non-root.sh 

Make Executable:

chmod +x install-non-root.sh 

Run Script

This script gives you a choice on either to compile it yourself or just download the binary. Try compiling it if you are on a non Intel based processor.

./install-non-root.sh 

Option 2: Run in a virtual environment and compile it yourself.

Dependencies:
  • python3
  • git

Download this git:

git clone https://github.com/beee33/weatherCLI
cd weatherCLI

Make Virtual Environment

python3 -m venv <name>

Enter Virtual Environment

source <name>/bin/activate

Install Dependencies

python3 -m pip install -r requirements.txt

Prepare the Configuration locations

Your system may not have ~/.config folder, and you may need to make it.

mkdir ~/.config/weatherCLI

Run the Program

The program should work as expected, but you may want to compile it into a binary using pyinstaller

python main.py

Compiling this program

I used pyinstaller to make this python program into a binary that has all dependencies bundled in, and this is how I make the releases for this project. For this step to work you need to have created your virtual environment and installed all the dependencies from the previous steps.

pip install pyinstaller

Compile the Program:

pyinstaller main.py --onefile

Your binary should be ./dist/main

mv dist/main weatherCLI

make executable with:

chmod +x weatherCLI

leaving the virtual enviorment

deactivate

How does weatherCLI know the location?

WeathterCLI uses OpenStreetMaps’s geocoding API to get latitude and longitude positions from user input. It converts the latitude and longitude into a url that has the XML data. This url is stored in “~/.config/weatherCLI/<towns/zipcode/places>/<queryname>/url.txt” an example is: “~/.config/weatherCLI/towns/Boston\ MA/url.txt”. The data for the sun positions are only calculated once per day per location, and the output is put in a file so that the user doesn't have to recalculate the same sun data for each day. All of the urls and sun data is stored in “~/.config/weatherCLI/”

CLI examples:


weatherCLI "city:Boston MA" -t most -s 

weatherCLI "poi:Rochester Institute of Technology" -t most

weatherCLI "zip:10001" -t most -s 

weatherCLI "city:Palm Beach FL" -t all -s 

weatherCLI "city:Seattle WA" -t24 -t onlysun

weatherCLI "city:Salt Lake City UT" -t onlyworded

About

Get verbose weather from NOAA through the command line!

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •