This project retrieves weather forecast data from an OpenWeather API request. For now it only reads data from .csv
files containing IATA codes or cities and display their weather forecast information on a simple-human-comprehensible terminal app
Currently working on an GUI so you can search places and, overall, have a prettier data visualization.
Since this app is all made with Python
you're going to need some python-libraries and utilities listed below.
- First check that your current
Python
version isPython 3.6
or above, by running the following command on your terminal:
python --version
Python 3.8+
is recommended
Note that in some linux distros you'll need to run it as:
python3 --version
- You migth as well check if you have PyPI as your Python package installer:
Since this process vary for every Linux distro, I'll link you to an article explanning how to set PyPI up.
-
Get a free
OpenWeather
API Key at https://openweathermap.org/appid -
Clone the repo
git clone https://github.com/DiXap/WeatherForecastApp.git
-
Verify or install Python packages For all the packages listed bwlow, run the following command where
<pkg>
is the name of the package.pip install <pkg>
requests
unidecode
pandas
-
Enter your API Key in
main.py
API = 'ENTER_YOUR_API_KEY'
As mentioned before, the app only reads csv files, although you can modify the functions in main.py
in order to request for a specific location forecast.
Don't delete Data
/ resources
directories or its child directories for they're used in the main excecution of the app.
Once you're ready, whether you modify something or not, go to your terminal and in the main directory of the project run the following:
python main.py
python3
in some distros
It should output something like:
Aviá Terai
Weather: Clouds as overcast clouds
Current temp: 19.28°C
but feels like: 18.73°C
Max temp: 19.28°C Min temp: 19.28°C
Humidity: 76% Pressure: 1011Pa
Badung
Weather: Rain as light rain
Current temp: 30°C
but feels like: 32.34°C
Max temp: 30°C Min temp: 30°C
Humidity: 74% Pressure: 1009Pa
Baidoa
Weather: Clouds as overcast clouds
Current temp: 25.88°C
but feels like: 26.68°C
Max temp: 25.88°C Min temp: 25.88°C
Humidity: 74% Pressure: 1013Pa
--- 0.6180081367492676 seconds ---
If you searched for a place
George Bush Intercontinental Huston Airport
Houston, United States
Weather: Clouds as overcast clouds
Current temp: 25.99°C
but feels like: 23.11°C
UVI: 7.83
Humidity: 69% Pressure: 1004Pa
Bahías de Huatulco International Airport
Huatulco, Mexico
Weather: Clouds as broken clouds
Current temp: 28.94°C
but feels like: 33.16°C
UVI: 11.83
Humidity: 74% Pressure: 1009Pa
John F Kennedy International Airport
New York, United States
Weather: Clouds as few clouds
Current temp: 18.31°C
but feels like: 15.8°C
UVI: 4.43
Humidity: 63% Pressure: 1020Pa
--- 0.1079430580191602 seconds ---
If you searched an IATA code
Since OpeWeather
only admits limitted API calls per minute, the main program is set to make under 60 requests so it doesn't get yourself in trouble.
If you want to remove this limit go to main.py
and change the following:
future = asyncio.ensure_future(get_data_iata(d1_list, states))
future = asyncio.ensure_future(get_data_place(d2_list, states))
By doing this the program will fetch data for all the places contained in the .csv
files.
Alternatively, you can fiddle around with the list slices:
d1_coords = d1_list[:20:-1]
call = d2_list[200:210]
In order to get the tests running you'll need to enter your API Key in tests.py
:
API = 'ENTER_YOUR_API_KEY'
These test cases were coded to demostrate functions' error handling. Feel free to play around with them.
If you want to contribute to this project please read the following steps. Any feedback or contributions are greatly appreciated.
- Fork the project
- Create your branch
git checkout -b ideas/MyFeature
- Commint the changes
git commit -m "Some awesome ideas"
- Push
git push origin ideas/MyFeature
- Open a pull request
You can open an issue anytime you want.
Refer to the section open issues for a list of known ones.
- airport-codes
- Best-README-Template
- Some cool badges for your README
- ForTheBadge
- Badges 4 README.md Profile