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 available for most of the places that share the same timezones as the United States, examples: Canada, Mexico and parts of western South America.
https://www.noaa.gov/
https://weather.gov/
https://aa.usno.navy.mil/data/api
https://aa.usno.navy.mil/api/
https://nominatim.openstreetmap.org/
https://openstreetmap.org/copyright
weather warnings(eg: Frost Advisory, Winter Storm Warning or Severe Thunderstorm Warning)
Sun data:
- Sunrise
- Sunset
- Solar noon
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:
Temperature graphs:
- Daily low
- Daily high
12 hour Precipitation probability graphs
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.
OS | Supported? |
---|---|
Debian | ✅ |
Ubuntu | ✅ |
Fedora | ✅ |
Arch | ✅ |
Mint | 🔶 |
Pop OS | 🔶 |
EndeavourOS | 🔶 |
Windows | ❌ |
✅: Supported
🔶: Untested
❌: Broken
Can be installed from almost all package managers:
Debian/Ubuntu/Mint:
sudo apt install wget
Arch:
pacman -S wget
Fedora
sudo dnf install wget
*may already be installed
wget https://raw.githubusercontent.com/beee33/weatherCLI/main/installer.sh
sudo sh installer.sh
Follow Build from source instructuions until the end of step 4
python3 main.py
Instructions to install git are on: Git's website however you can just use:
Debian/Ubuntu/Mint:
sudo apt install git
Fedora
sudo dnf install git
git clone "https://github.com/beee33/weatherCLI"
cd weatherCLI
Create new virtual enviroment using python's venv
python3 -m venv <name>
Enter venv
source <name>/bin/activate
*Note: if venv works, your shell should have (<name>) in prompt Install dependencys
python3 -m pip install -r requirements.txt
❗ some Operating Systems eg: Debian, dont like you to install packages in the default python environment, as it may override system packages that are needed. I have bricked a VM by doing this.
Install dependencys
python3 -m pip install -r requirements.txt
pip install pyinstaller
or
python3 -m pip install pyinstaller
*Note, you may have to use a virtual enviroment for some systems. You can use something like pyenv to create instances of python with diffrent versions: https://github.com/pyenv/pyenv
For this program I would reccomend using python 3.10, as that is what version this program is written for. If not, try to rename all instances of it to your python version
This adds the new venv site packages path to pyinstaller, so it can use it. You should replace python3.10 with your python version eg python3.11
pyinstaller main.py --onefile --paths "<name>/lib/python3.10/site-packages"
Leave virtual enviroment
deactivate
pyinstaller main.py --onefile
sudo cp dist/main /usr/bin/weatherCLI
sudo chmod 755 /usr/bin/weatherCLI
sudo mkdir /etc/weatherCLI
sudo chmod 777 -R /etc/weatherCLI
*note this directory and its subdirectorys is intended to be accessible for all users
sudo chmod 711 -R /etc/weatherCLI
if you get the error: "[PYI-1890462:ERROR] Failed to load Python shared library '/tmp/_MEIWYQO9N/libpython3.10.so': dlopen: /tmp/_MEIWYQO9N/libpython3.10.so: cannot open shared object file: No such file or directory"
This command fixes that so pyinstaller knows python's path. This should be replaced with your python version and the temp directory may be diffrent, I was using python 3.10.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/python3.10
WeahterCLI 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 “/etc/weatherCLI/<towns/zipcode/places>/<queryname>/url.txt” an example is: “/etc/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 “/etc/weatherCLI/”