Using Python for Weather Analysis Part I
Background
The videos below will walk through the steps needed to configure a campus PC computer for this hands-on activity. All commands will be executed in the python command prompt.
Basic Conda commands to know:
Machine configuration and package install - activate proper python environment and install packages
- conda env list - lists all available conda environments loaded to a particular machine
- conda activate <environment> - activate a specific conda environment
- conda install <package name> - install a package to activated conda environment
- conda list -n <activated environment> - returns a list of all the packages installed to a conda environment
Managing your work - set your working folder and launch Jupyter
- cd C:\work space
- jupyter notebook
Jupyter Basics:
https://unidata.github.io/python-training/workshop/Jupyter_Notebooks/jupyter-notebooks-introduction/
Helpful Keyboard Shortcuts:
https://yoursdata.net/jupyter-lab-shortcut-and-magic-functions-tips/
Understanding Python Libraries
Unidata is an education and research institution consortium that share geoscience data, analysis and visualization tools. They have created custom python libraries for analyzing meteorological data.
The key Unidata library is:
- MetyPy - https://unidata.github.io/python-training/workshop/Metpy_Introduction/introduction-to-metpy/
- Cartopy - https://unidata.github.io/python-training/workshop/CartoPy/cartopy/
For a complete list of Atmospheric Science & Meteorology Packages and Applications Python libraries; click here.
Example of the library calls from a Python analysis:
In this hands-on example; the above code will be used to do the following:
- cartopy - this Unidata library will be used to create a reference map for overlaying pertinent weather and other information
- pandas - this is not a Unidata library. This library will be used to manipulate the imported data
- geopandas - this is not a Unidata library. This library specializes in the manipulation of geospatial datasets in the python environment
- matplotlib - this is not a Unidata library. The main function of this library is to create data visualizations in the Python environment.
Importing & Mapping Storm Report Data
Background:
In this activity, you will construct a Jupyter notebook that will perform two main functions using the libraries previously described:
- Import NOAA Storm Report Data
- Geo-code a location of your choosing
- Create a map plot of your location and downloaded Storm Report Data
NOAA Storm Report Data: https://www.spc.noaa.gov/climo/reports/190730_rpts.html
Activity:
1. Watch the video above and work through the steps to make a map overlay of the weather reports and a location of your choosing.
Jupyter Resources
Jupyter notebook resources:
Keyboard shortcuts and other tricks:https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/
Pandas resources:
Display all rows option - https://dev.to/chanduthedev/how-to-display-all-rows-from-data-frame-using-pandas-dha
Cartopy resources:
https://rabernat.github.io/research_computing_2018/maps-with-cartopy.html
https://scitools.org.uk/cartopy/docs/latest/gallery/index.html
MatPlotLib resources:
Solution Code Jupyter Notebook: