1.Unidata Python Gallery
基础库安装到位,运行脚本即可出图
脚本可点击文末阅读原文下载
页面链接:https://unidata.github.io/python-gallery/examples/index.html
2.Useful Python Tools
This is a list of useful and/or new Python tools that the Unidata Python Team and community are keeping an eye on or using.
Unidata Projects
- MetPy - General meteorological toolkit
- siphon - Remote data access
- netCDF4-python - netCDF4 API
Meteorology Specific
- PyART - Python ARM Radar Toolkit
Data Wrangling
- pandas - Easy tabular data manipulation
- xarray - Gridded/labeled multidimensional data
Plotting
- matplotlib - Beautiful publication quality graphics
- Bokeh - Interactive web graphics
- Cartopy - Plotting maps
Core Python/Interface
- iPython - Interactive Python shell
- Jupyter - Notebooks and the new Jupyter Lab
- pathlib - Easy file path manipulation
Education
- nbgrader - An automatic homework grader for notebooks
Performance
- Numba - JIT compiler
- Dask - Distributed computing
3.实例
1from datetime import datetime 2 3import matplotlib.pyplot as plt 4import metpy.calc as mpcalc 5from metpy.units import units 6import numpy as np 7from pyproj import Geod 8from scipy.interpolate import griddata 9from scipy.ndimage import gaussian_filter 10from siphon.simplewebservice.wyoming import WyomingUpperAir 11 12def vertical_interpolate(vcoord_data, interp_var, interp_levels): 13 """A function to interpolate sounding data from each station to 14 every millibar. Assumes a log-linear relationship. 15 16 Input 17 ----- 18 vcoord_data : A 1D array of vertical level values (e.g., pressure from a radiosonde) 19 interp_var : A 1D array of the variable to be interpolated to all pressure levels 20 vcoord_interp_levels : A 1D array containing veritcal levels to interpolate to 21 22 Return 23 ------ 24 interp_data : A 1D array that contains the interpolated variable on the interp_levels 25 """ 26 27 # Make veritcal coordinate data and grid level log variables 28 lnp = np.log(vcoord_data) 29 lnp_intervals = np.log(interp_levels) 30 31 # Use numpy to interpolate from observed levels to grid levels 32 interp_data = np.interp(lnp_intervals[::-1], lnp[::-1], interp_var[::-1])[::-1] 33 34 # Mask for missing data (generally only near the surface) 35 mask_low = interp_levels > vcoord_data[0] 36 mask_high = interp_levels