【发布时间】:2018-10-18 22:45:27
【问题描述】:
我正在拼命地尝试将一些地球静止数据从 GOES-16 netCDF 文件投影到不同的投影。我可以让背景图重新投影,但似乎无法让数据跟随。
我对此还不是很精通,但这是我目前所掌握的:
通过 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
这是我的相关代码的一个小sn-p:
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 的见解,问题似乎得到了解决,我想我可能有点不耐烦/不知道完整磁盘转换需要多长时间。
【问题讨论】:
-
你确定传入transform=proj就挂了?您正在使用的完整磁盘映像真的很大,并且 Cartopy 中的图像变形可能是计算密集型的。我敢打赌,这个操作很容易花费 10 分钟到一个小时。
-
我确实考虑过这一点,但我很确定当我尝试数据的子集时它会坐一会儿,我不能只做键盘中断,所以我认为它完全挂了。我今天早上用 CONUS lat/lon ax.extent 再次尝试,现在它似乎在几秒钟内运行。感谢您一如既往地提供 DopplerShift 输入,您在很多情况下都帮助了我。
-
@MethaneClouds 我遇到了同样的问题。你能扩展一下你的最终解决方案在几秒钟内运行的样子吗?或者您是说全盘转换需要很长时间,而您基本上只是切换到 CONUS?