Instructor: Rebekah Esmaili
A crash course in Python focusing on reading and visualizing data-sets used in Earth sciences.
Access materials via GitHub: https://ter.ps/noaapy
Day 1 will cover:
- Launching Jupyter Notebooks
- Working with arrays using the Numpy package
- Importing text datasets using the Pandas package
- Creating simple graphics with Matplotlib
Day 2 will cover:
- Importing scientific data formats, such as netCDF and GRIB2
- Creating maps from datasets
- Running python scripts
Installation requirements
"I am really new to Python!"
"I have used Python before!"
- If you wish to run the examples locally, I recommend installing Anaconda. If you are having trouble with your installation, contact the instructor before the course or use binder.
- Download the contents of the GitHub repository to your computer.
- Launch Jupyter Notebooks from the Anaconda Navigator. This will open a window in your default browser. Navigate to the folder that contains the notebooks (*.ipynb) and click on the tutorial for the day.
- Additional packages:
- Day 1: If you installed Anaconda, you will not need any additional packages
- Day 2: Launch the Anaconda Prompt (Windows) or Terminal (MacOS/Linux). Then copy/paste and hit enter:
conda install -c conda-forge cartopy conda install -c conda-forge netCDF4 conda install -c conda-forge pygrib
- If there are no errors, then you are set-up!
- Alternatively, if you are familiar with environments, you can use the environments.yml to install the necessary packages.
I do not recommend:
- Using Python on a remote server for this tutorial (I cannot help troubleshoot)
- Using your operating system's Python or a shared Python installations unless you are advanced!
Pandas
- Short Introduction: https://pandas.pydata.org/pandas-docs/stable/getting_started/10min.html
- Cookbook for more details: https://pandas.pydata.org/pandas-docs/stable/user_guide/cookbook.html#cookbook
Matplotlib
- Pyplot Tutorial: https://matplotlib.org/3.1.1/tutorials/introductory/pyplot.html
Reading self describing file
- NETCDF
- Detailed tutorial https://unidata.github.io/netcdf4-python/netCDF4/index.html.
- HDF files
- The package h5py is similar to netcdf4.
- User manual at http://docs.h5py.org/en/stable/.
- GRIB/GRIB2 files
- World Meteorology Association standard format, e.g. commonly used with weather-related models like ECMWF and GFS.
- Can be opened using pygrib.
- Example usage at https://jswhit.github.io/pygrib/docs/.
- BUFR
- Another common model format.
- Open with python-bufr, part of the pytroll project.
Beginner Tutorials
- Youtube series for absolute beginners CS Dojo
- Research Software Engineering with Python Free eBook to enhance your workflow
Intermediate Tutorials
- Learn more about Python for Atmosphere and Ocean Scientists using Software Carpentry lesson plans.
- I have a longer workshop on Python for Earth Science with Rebekah
- Earth Observation using Python builds on the content of the workshop above.
- Python for Climate and Meteorology Another tutorial taught at AMS, a little more advanced.
Advanced tutorials Tutorials * May offer advanced workshop in spring