小编Sha*_*kka的帖子

使用 matplotlib 在垂直截面上绘制风向量

我搜索了高低,但找不到这个问题的另一个答案。

我正在尝试将南极半岛上气象局统一模型的输出可视化。目前,我有一个纵向横截面,潜在温度绘制为填充轮廓。我想在此之上绘制风向量,使它们看起来更像:

Elvidge et al.s' (2014) 图 3

我试图调整 matplotlib 示例中给出的纬度/经度坐标示例(例如 quiver_demo),但没有运气(可能是因为我做错了一些显而易见的错误)。

我有风的 u、v 和 w 分量(虽然我不需要 v,因为我已经在一条纬度线上切了一片)。

我目前正在使用一个名为 iris (v1.7) 的模块,它允许我处理我拥有的文件(例如从旋转的极点投影转换并将纬度/经度转换为合理的坐标),所以请原谅我不熟悉的行我的代码。

我的代码如下:

import iris
import iris.plot as iplt
import matplotlib.pyplot as plt
import numpy as np

# Load variables from file
fname = ['/pathname/filename.pp']
theta= iris.load_cube(fname,'air_potential_temperature') #all data are 3D 'cubes' of dimensions [x,y,z] = [40,800,800]
U = iris.load_cube(fname, 'eastward_wind')
W = iris.load_cube(fname, 'upward_air_velocity')
lev_ht = theta.coord('level_height').points # for extracting z coordinate only - shape = (40,)

##SPATIAL COORDINATES
## rotate projection to account for …
Run Code Online (Sandbox Code Playgroud)

python matplotlib python-iris

5
推荐指数
1
解决办法
4897
查看次数

标签 统计

matplotlib ×1

python ×1

python-iris ×1