Satpy基礎系列教程(1)-FY4A AGRI L1數據處理

Satpy[1]目前支持的衛星數據[2]有50種(MSG, Himawari 8, GOES-R, MODIS, Sentinel- 1/2/3/5, SNPP等)。html

本文以最近朝曦dawn[3]添加的風雲4A(FY4A) AGRI L1數據爲例。python

Notebook[4]已放在GitHub上,供你們學習。 
git


FY4A AGRI L1數據有兩種類別:github

1.全圓盤微信

FY4A-_AGRI--_N_DISK_1047E_L1-_FDI-_MULT_NOM_20190807060000_20190807061459_4000M_V0001.HDFapp

2.中國區學習

FY4A-_AGRI--_N_REGC_1047E_L1-_FDI-_MULT_NOM_20190807045334_20190807045750_1000M_V0001.HDFflex

全圓盤標識:DISK , 中國區標識:REGC.ui


風雲數據連接spa

1.實時數據[5](30天內)及文檔

2.歷史數據[6] (2018-03-12 -- )

3.FY4A官方應用平臺[7]

安裝

推薦經過conda安裝,簡單快捷。

$ conda install -c conda-forge satpy

定標

FY4A AGRI L1有如下三種定標方式:

1.原始數字量化值 (全部通道)

2.反射率 (C01 - C06)

3.輻射率和亮溫 (C07 - C14)

讀取數據

只需幾行便可讀取數據:

import os, globfrom satpy.scene import Scene
# 加載FY4A文件filenames = glob.glob('/xin/data/FY4A/20190807/FY4A-_AGRI*4000M_V0001.HDF')
# 建立scene對象scn = Scene(filenames, reader='agri_l1')
# 查看可用的通道scn.available_dataset_names()

輸出結果:

['C01', 'C02', 'C03', 'C04', 'C05', 'C06', 'C07', 'C08', 'C09', 'C10', 'C11', 'C12', 'C13', 'C14', 'satellite_azimuth_angle', 'satellite_zenith_angle', 'solar_azimuth_angle', 'solar_glint_angle', 'solar_zenith_angle']


讀取指定通道數據:

# 以紅外通道爲例ir_channel = 'C12'scn.load([ir_channel])

繪圖

全圓盤圖

一行命令便可保存或顯示圖片:

# 保存到文件# scn.save_dataset(ir_channel, \ filename='{sensor}_{name}.png')
# 在notebook中顯示scn.show(ir_channel)

全圓盤真彩色圖

首先查看可用的合成選項:

scn.available_composite_names()

輸出結果顯示,支持真彩圖:

['ash', 'dust', 'fog', 'green', 'green_snow', 'ir108_3d', 'ir_cloud_day', 'natural_color', 'natural_color_sun', 'night_background', 'night_background_hires', 'overview', 'overview_sun', 'true_color']


因而咱們能夠直接加載真彩色數據並繪圖

# 注:這步須要大內存 (取決於cpu核數)# 可查看FAQ關於內存的討論:# https://satpy.readthedocs.io/en/latest/faq.html
composite = 'true_color'scn.load([composite])scn.show(composite)
# scn.save_dataset(composite, \ filename='{sensor}_{name}.png')

特定區域圖

如下以颱風利奇馬爲例。

首先,咱們須要定義地圖投影和區域,而後將數據投影到該區域上。

方式一

Pyresample[8]來定義區域。

from pyresample import get_area_def
area_id = 'lekima'
x_size = 549y_size = 499area_extent = (-1098006.560556, -967317.140452, \ 1098006.560556, 1026777.426728)projection = '+proj=laea +lat_0=19.0 +lon_0=128.0 +ellps=WGS84'description = "Typhoon Lekima"proj_id = 'laea_128.0_19.0'
areadef = get_area_def(area_id, description, proj_id, projection,x_size, y_size, area_extent)

方式二

coord2area_def.py[9]程序來直接生成區域定義。

好比用python coord2area_def.py lekima_4km laea 10 28 118 138 4,便可獲得以前定義的利奇馬區域:

lekima_4km: description: lekima_4km projection: proj: laea ellps: WGS84 lat_0: 19.0 lon_0: 128.0 shape: height: 499 width: 549 area_extent: lower_left_xy: [-1098006.560556, -967317.140452] upper_right_xy: [1098006.560556, 1026777.426728]


而後將該定義拷貝到$PPP_CONFIG_DIR/areas.yaml中,便可直接調用

# 若是你已經添加區域到areas.yaml中,可直接調用:os.environ['PPP_CONFIG_DIR'] = '/yin_raid/xin/satpy_config/'lekima_scene = scn.resample('lekima_4km')
# 不然須要使用以前定義的區域:# lekima_scene = scn.resample(areadef)
lekima_scene.show(composite)# lekima_scene.save_dataset(composite, \ filename='{sensor}_{name}_resampled.png')

若是想利用自定義的colormap來生成圖像(以下圖),請參閱關於enhancement的notebook(正在忍餓趕稿中)。


References

[1] Satpy: https://satpy.readthedocs.io/en/latest/
[2] 支持的衛星數據: https://satpy.readthedocs.io/en/latest/index.html#reader-table
[3] 朝曦dawnhttps://dreambooker.site/
[4] Notebookhttps://github.com/zxdawn/FY-4/tree/master/satpy/examples
[5] 實時數據: https://fy4.nsmc.org.cn/data/en/data/realtime.html
[6] 歷史數據: http://satellite.nsmc.org.cn/PortalSite/Data/Satellite.aspx
[7] FY4A官方應用平臺: http://rsapp.nsmc.org.cn/geofy/
[8] Pyresample: http://pyresample.readthedocs.org/
[9] coord2area_def.py: https://github.com/pytroll/satpy/blob/master/utils/coord2area_def.py


本文分享自微信公衆號 - 氣象雜貨鋪(meteogs)。
若有侵權,請聯繫 support@oschina.cn 刪除。
本文參與「OSC源創計劃」,歡迎正在閱讀的你也加入,一塊兒分享。

相關文章
相關標籤/搜索