gpt4 book ai didi

python - 将 GOES-16 对地静止数据投影到 Plate Carree Cartopy 中

转载 作者:行者123 更新时间:2023-12-01 08:54:13 26 4
gpt4 key购买 nike

我正在拼命尝试将 GOES-16 netCDF 文件中的一些对地静止数据投影到不同的投影。我可以获取背景 map 来重新投影,但似乎无法获取要跟踪的数据。

我对此还不是很精通,但到目前为止,这是我所掌握的:

通过NetCDF4读取数据:

from netCDF4 import Dataset
nc = Dataset('OR_ABI-L1b-RadF-
M3C13_G16_s20182831030383_e20182831041161_c20182831041217.nc')

data = nc.variables['Rad'][:]

这里我试图获取地球静止信息:

sat_h = nc.variables['goes_imager_projection'].perspective_point_height
X = nc.variables['x'][:] * sat_h
Y = nc.variables['y'][:] * sat_h

# Satellite longitude
sat_lon =
nc.variables['goes_imager_projection'].longitude_of_projection_origin

# Satellite sweep
sat_sweep = nc.variables['goes_imager_projection'].sweep_angle_axis

这里我从 .nc 文件中获取投影数据:

proj_var = nc.variables['goes_imager_projection']

sat_height = proj_var.perspective_point_height
central_lon = proj_var.longitude_of_projection_origin
semi_major = proj_var.semi_major_axis
semi_minor = proj_var.semi_minor_axis
print proj_var

<type 'netCDF4._netCDF4.Variable'>
int32 goes_imager_projection()
long_name: GOES-R ABI fixed grid projection
grid_mapping_name: geostationary
perspective_point_height: 35786023.0
semi_major_axis: 6378137.0
semi_minor_axis: 6356752.31414
inverse_flattening: 298.2572221
latitude_of_projection_origin: 0.0
longitude_of_projection_origin: -75.0
sweep_angle_axis: x
unlimited dimensions:
current shape = ()
filling on, default _FillValue of -2147483647 used

这是我的相关代码的一小段:

fig = plt.figure(figsize=(30,20))

globe = ccrs.Globe(semimajor_axis=semi_major, semiminor_axis=semi_minor)
proj = ccrs.Geostationary(central_longitude=central_lon,
satellite_height=sat_height, globe=globe)

ax = fig.add_subplot(1, 1, 1, projection=proj)

IR_img = ax.imshow(data[:,:],origin='upper',extent=(X.min(), X.max(), Y.min(), Y.max()),
cmap=IR_cmap,interpolation='nearest',vmin=162.,vmax=330.)

还有一张每个人都打得很好的图片: Data and map working

当我尝试获得 Plate Carree 投影时,我尝试:

proj = ccrs.PlateCarree(central_longitude=central_lon,globe=globe)

以及我失败的图片: Data and map not working

我尝试过弄乱 imshow 方法中的范围,我尝试添加一个

transform=proj 

在 imshow 中,没有运气,它只是挂起,我必须重新启动内核。

显然这是我缺乏理解。如果有人可以快速轻松地帮助/解释我想要改变对地静止投影的方式,我将不胜感激。

我正在运行古老的 python2。

感谢您的浏览。

编辑:由于 DopplerShift 和 ajdawson 的见解,问题似乎得到了解决,我想我可能有点不耐烦/不知道完整的磁盘转换需要多长时间。

最佳答案

看来您需要为 imshow 指定转换关键字。该关键字告诉 cartopy 您的数据所在的坐标,在本例中应该是对地静止的。

我没有你的数据集,所以我无法测试它,但下面的代码片段说明了这个概念。投影和变换是独立的,因此您应该定义两者。变换参数的值(下例中的 crs)对于数据集是固定的,但投影可以是您喜欢的任何值(包括与 crs 相同的值)。

请参阅重新投影地球静止图像的示例:https://scitools.org.uk/cartopy/docs/v0.16/gallery/geostationary.html#sphx-glr-gallery-geostationary-py 。另请参阅此处的投影和变换参数指南:https://scitools.org.uk/cartopy/docs/v0.16/tutorials/understanding_transform.html .

globe = ccrs.Globe(semimajor_axis=semi_major, semiminor_axis=semi_minor)
crs = ccrs.Geostationary(central_longitude=central_lon,
satellite_height=sat_height, globe=globe)
proj = ccrs.PlateCarree(central_longitude=central_lon, globe=globe)

ax = fig.add_subplot(1, 1, 1, projection=proj)

IR_img = ax.imshow(data[:,:], origin='upper',
extent=(X.min(), X.max(), Y.min(), Y.max()),
transform=crs,
cmap=IR_cmap,
interpolation='nearest', vmin=162., vmax=330.)

关于python - 将 GOES-16 对地静止数据投影到 Plate Carree Cartopy 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52883594/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com