从GOES-16 Satellite L2文件中获取不正确的RGB值

时间:2019-07-18 20:11:45

标签: python unidata

我尝试了Brian Blaylock尝试通过增强的通道1、2和3从GOES-16卫星数据创建真彩色RGB图像的方法。

https://unidata.github.io/python-gallery/examples/mapping_GOES16_TrueColor.html

https://github.com/blaylockbk/pyBKB_v3/blob/master/BB_GOES/GOES16_TrueColor_Cartopy.ipynb

我尝试重新创建他们的方法,但是我的图像却大不相同...

nc = xarray.open_dataset("OR_ABI-L2-MCMIPC-M6_G16_s20191851801261_e20191851804034_c20191851804149.nc")

red = nc.variables['CMI_C01'][:]
green = nc.variables['CMI_C03'][:]
blue = nc.variables['CMI_C02'][:]

# for imshow, r,g, and b values need to be clipped
red = np.clip(red,0,1)
green = np.clip(green,0,1)
blue = np.clip(blue,0,1)

模仿平方根函数: enter image description here

red = np.power(red,(1/2))
green = np.power(green,(1/2))
blue = np.power(blue, (1/2))

# GOES doesn't have a true green band, so a little weighting will attempt to get a true green color from the red, blue, and near IR green (veggie)
green_true = 0.45*red + 0.1*green + 0.45*blue
green_true = np.clip(green_true,0,1)

fig, ([ax1, ax2, ax3, ax4]) = plt.subplots(1, 4, figsize=(16, 3))

ax1.imshow(red, cmap='Reds', vmax=1, vmin=0)
ax1.set_title('Red', fontweight='semibold')
ax1.axis('off')

ax2.imshow(green, cmap='Greens', vmax=1, vmin=0)
ax2.set_title('Veggie', fontweight='semibold')
ax2.axis('off')

ax3.imshow(green_true, cmap='Greens', vmax=1, vmin=0)
ax3.set_title('"True" Green', fontweight='semibold')
ax3.axis('off')

ax4.imshow(blue, cmap='Blues', vmax=1, vmin=0)
ax4.set_title('Blue', fontweight='semibold')
ax4.axis('off')

plt.subplots_adjust(wspace=.02)

enter image description here

预期:enter image description here

rgb = np.dstack([red,green_true,blue])
rgb_eh = np.dstack([red,green,blue])

fig, (ax1,ax2) = plt.subplots(1, 2, figsize=(16, 3))

ax1.imshow(rgb)
ax1.set_title('RGB?', fontweight='semibold')
ax1.axis('off')

ax2.imshow(rgb_eh)
ax2.set_title('RGB?', fontweight='semibold')
ax2.axis('off')

enter image description here

预期:enter image description here

我错过了任何明显的错误吗? 感谢您的帮助

1 个答案:

答案 0 :(得分:0)

我知道这个问题是一年以前的,但是如果对其他问题有用,我将保留我的答案。 您的代码加载的波段顺序错误。正确的顺序在香奈儿2(CMI C02)中为红色,在通道1(CMI C01)中为蓝色:

AppCompatActivity

感谢您放置有关图像增强的链接!我一直在寻找这个。