python interpolate_「实用」气象Python学习手册 by Unidata

​1.Unidata Python Gallery

基础库安装到位,运行脚本即可出图

脚本可点击文末阅读原文下载

页面链接:https://unidata.github.io/python-gallery/examples/index.html

e6f122f20d0545a9a4babb10c74e2e26
7b818eaf0bb34ff3a894b55ddc3e1b71
f7ed2cbb7cfc46888454c46b3e9bbabb
e674a673dd68407a82d7d9f6f5128ac6
a2cba2ace5b74652bd5f6fe7feace8f3
5c26845bb6ca4f7fb59e47c5c9fa5edc
689521c311704c6782a9b41f1d2a50a2

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.实例

69379ec1695b4222ba7ef599a254cd2a
  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 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值