Near Real Time 檔案處理
Table of contents
背景
- 歐洲近程預報中心(ecmwf)是位在英國雷丁的國際機構,組織如圖。其中哥白尼空氣監測服務(Copernicus Atmosphere Monitoring Service)為提供會員國有關空氣品質服務的整合系統,詳見官網及wiki說明。
- 其資料來源包括衛星觀測(如下圖)、地面觀測、以及模式模擬的結果,為一同化後的結果,因此會有比較高的參考價值。
資料下載
- CAMS NRT數據必須使用python module下載,雖然提供了點選的網頁,但是為產生程式碼,實際下載是使用python 的WEBAPI程式,在OS的命令列環境執行下載程序的。
1.註冊、登入(密碼必須含有特殊字元)
2.點選月份、時間、步階、測項,之後可以選擇預覽及格式,如下圖:
- 由於NRT數據並不是傳統直角座標、或等間距(經緯度)的網格系統,netCDF的NCO程式(除了ncdump)並不能幫上什麼,因此還是選擇GRIB格式。
3.ecmwfapi python installation: pip install ecmwf-api-client
4.python execution
- 需要token
export ECMWF_API_URL="https://api.ecmwf.int/v1" export ECMWF_API_KEY=$TOKEN export ECMWF_API_EMAIL=$EMAIL python get.py
5.get.py code(eg)
#!/usr/bin/env python
from ecmwfapi import ECMWFDataServer
server = ECMWFDataServer(url="https://api.ecmwf.int/v1",key="...",email="...")
server.retrieve({
"class": "mc",
"dataset": "cams_nrealtime",
"date": "2019-09-01/to/2019-09-30",
"expver": "0001",
"levtype": "sfc",
"param": "4.218/6.218/13.218/16.218/27.218/30.218/45.218/47.218/72.210/74.210/125.210/126.210/127.210/128.210/137.128/208.210/211.210/212.210/250.210",
"step": "6",
"stream": "oper",
"time": "00:00:00/12:00:00",
"type": "fc",
"target": "output",
})
Warning: Key有其效期,必須每次確認。param為測項,需另查表(如下)
直接在python階段切割經緯度(How to download the CAMS Reanalysis data via the ECMWF Web API)(未測試)
If you do not want global data, you can add ”area” as N/W/S/E in lat/lon degrees. Southern latitudes and western longitudes must be given as negative numbers, e.g., ”area”: ”75/-20/10/60”. If you set “area”, you should also add a lat/lon grid, e.g., “grid”: “1.0/1.0”, as shown in c. For more details about “area”, see this link
內插到直角座標系統
由於CAMS檔案的空間座標系統並不是等間距系統,而是Reduced Gaussian Grids系統,因此在內插時採用scipy.interpolate的griddata功能。
1. The ECMWF Model Grids
- 可以用指令:
grib_dump -D output |more
找到92-92 latlonvalues latLonValues = (1045584,0) [latitudeLongitudeValues] {} - 可以看到北極之座標原點(89.7311, 0~89.7311, 340)
- 對照到N32~N640的第一圈緯度,只有N256是一樣的。
- 詳參https://confluence.ecmwf.int/display/EMOS/N256
2. griddata內插
- 定出各層範圍,篩選範圍內的RGG點,轉換成直角座標,然後進行griddata內插,得到範圍內grid mesh的值。
- 程式範例如int_spd1D.py
- 輸入檔案
- arguments
spnm0=sys.argv[1]
yrmo=sys.argv[2]
dt=int(sys.argv[3])
- $ROOT/camxruns/2019/ICBC/ecmwf/near_real_time/sys.argv[1]/file*.txt
- cat grib2的逐時結果
- 格式為lat,lon,value (FF)
- arguments
- xy_d1348528.csv、xy_d188838.csv、或xy_d13380.csv
- 各種RGG座標與轉換成LCP之xy座標
- 橙色數字為RGG在d1範圍的點數
- 輸出檔nc檔案:spnm0+’_d1.nc’
3.注意
- griddata在應用時不允許外插情況發生,因此mesh 需要向內縮小一個delta x(y)距離,來保證只發生內插。
- twd97 模組應用在中國大陸或太平洋範圍可能會出錯。改用pyproj較為可靠。
grb2m3.py
new and updated, see evernote
Reference
- CAMS再分析數據說明https://www.ecmwf.int/en/elibrary/18885-new-cams-global-reanalysis-atmospheric-composition
- 再分析逐日空品數據之應用https://www.ecmwf.int/en/elibrary/19028-use-sentinel-5p-air-quality-data-cams
- Accessing ECMWF data servers in batch,https://confluence.ecmwf.int/display/WEBAPI/Accessing+ECMWF+data+servers+in+batch
- Reduced Gaussian Grid systems, https://confluence.ecmwf.int/display/EMOS/Reduced+Gaussian+Grids Here 全球空品模擬結果之下載與格式轉換 parent:Dr. Kuang’s Evernotes_Grid Models
分析結果項目與編號表
地面變數項
short name | parameter ID | name |
---|---|---|
z | 129 | Geopotential |
lsm | 172 | Land-sea mask |
tcno2 | 210125 | Total column Nitrogen dioxide |
tcso2 | 210126 | Total column Sulphur dioxide |
tcco | 210127 | Total column Carbon monoxide |
tchcho | 210128 | Total column Formaldehyde |
gtco3 | 210206 | GEMS Total column ozone |
tc_ch4 | 218004 | Total column methane |
tc_hno3 | 218006 | Total column nitric acid |
tc_pan | 218013 | Total column peroxyacetyl nitrate |
tc_c5h8 | 218016 | Total column isoprene |
tc_no | 218027 | Total column nitrogen monoxide |
tc_oh | 218030 | Total column hydroxyl radical |
tc_c2h6 | 218045 | Total column ethane |
tc_c3h8 | 218047 | Total column propane |
定壓層變數項
short name | parameter ID | name |
---|---|---|
aermr01 | 210001 | Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio |
aermr02 | 210002 | Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio |
aermr03 | 210003 | Sea Salt Aerosol (5 - 20 um) Mixing Ratio |
aermr04 | 210004 | Dust Aerosol (0.03 - 0.55 um) Mixing Ratio |
aermr05 | 210005 | Dust Aerosol (0.55 - 0.9 um) Mixing Ratio |
aermr06 | 210006 | Dust Aerosol (0.9 - 20 um) Mixing Ratio |
aermr07 | 210007 | Hydrophobic Organic Matter Aerosol Mixing Ratio |
aermr08 | 210008 | Hydrophilic Organic Matter Aerosol Mixing Ratio |
aermr09 | 210009 | Hydrophobic Black Carbon Aerosol Mixing Ratio |
aermr10 | 210010 | Hydrophilic Black Carbon Aerosol Mixing Ratio |
aermr11 | 210011 | Sulphate Aerosol Mixing Ratio |
no2 | 210121 | Nitrogen dioxide |
so2 | 210122 | Sulphur dioxide |
co | 210123 | Carbon monoxide |
hcho | 210124 | Formaldehyde |
go3 | 210203 | GEMS Ozone |
ch4 | 217004 | Methane |
hno3 | 217006 | Nitric acid |
pan | 217013 | Peroxyacetyl nitrate |
c5h8 | 217016 | Isoprene |
no | 217027 | Nitrogen monoxide |
oh | 217030 | Hydroxyl radical |
c2h6 | 217045 | Ethane |
c3h8 | 217047 | Propane |
定比例層變數項
short name | parameter ID | name |
---|---|---|
lnsp | 152 | Logarithm of surface pressure |
aermr01 | 210001 | Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio |
aermr02 | 210002 | Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio |
aermr03 | 210003 | Sea Salt Aerosol (5 - 20 um) Mixing Ratio |
aermr04 | 210004 | Dust Aerosol (0.03 - 0.55 um) Mixing Ratio |
aermr05 | 210005 | Dust Aerosol (0.55 - 0.9 um) Mixing Ratio |
aermr06 | 210006 | Dust Aerosol (0.9 - 20 um) Mixing Ratio |
aermr07 | 210007 | Hydrophobic Organic Matter Aerosol Mixing Ratio |
aermr08 | 210008 | Hydrophilic Organic Matter Aerosol Mixing Ratio |
aermr09 | 210009 | Hydrophobic Black Carbon Aerosol Mixing Ratio |
aermr10 | 210010 | Hydrophilic Black Carbon Aerosol Mixing Ratio |
aermr11 | 210011 | Sulphate Aerosol Mixing Ratio |
no2 | 210121 | Nitrogen dioxide |
so2 | 210122 | Sulphur dioxide |
co | 210123 | Carbon monoxide |
hcho | 210124 | Formaldehyde |
go3 | 210203 | GEMS Ozone |
ch4 | 217004 | Methane |
hno3 | 217006 | Nitric acid |
pan | 217013 | Peroxyacetyl nitrate |
c5h8 | 217016 | Isoprene |
no | 217027 | Nitrogen monoxide |
oh | 217030 | Hydroxyl radical |
c2h6 | 217045 | Ethane |
c3h8 | 217047 | Propane |
預報結果項目與編號表
地面變數項
short name | parameter ID | name |
---|---|---|
pm1 | 210072 | Particulate matter d < 1 um |
pm2p5 | 210073 | Particulate matter d < 2.5 um |
pm10 | 210074 | Particulate matter d < 10 um |
tcno2 | 210125 | Total column Nitrogen dioxide |
tcso2 | 210126 | Total column Sulphur dioxide |
tcco | 210127 | Total column Carbon monoxide |
tchcho | 210128 | Total column Formaldehyde |
gtco3 | 210206 | GEMS Total column ozone |
aod550 | 210207 | Total Aerosol Optical Depth at 550nm |
ssaod550 | 210208 | Sea Salt Aerosol Optical Depth at 550nm |
duaod550 | 210209 | Dust Aerosol Optical Depth at 550nm |
omaod550 | 210210 | Organic Matter Aerosol Optical Depth at 550nm |
bcaod550 | 210211 | Black Carbon Aerosol Optical Depth at 550nm |
suaod550 | 210212 | Sulphate Aerosol Optical Depth at 550nm |
aod469 | 210213 | Total Aerosol Optical Depth at 469nm |
aod670 | 210214 | Total Aerosol Optical Depth at 670nm |
aod865 | 210215 | Total Aerosol Optical Depth at 865nm |
aod1240 | 210216 | Total Aerosol Optical Depth at 1240nm |
uvbed | 214002 | UV biologically effective dose |
uvbedcs | 214003 | UV biologically effective dose clear-sky |
tc_ch4 | 218004 | Total column methane |
tc_hno3 | 218006 | Total column nitric acid |
tc_pan | 218013 | Total column peroxyacetyl nitrate |
tc_c5h8 | 218016 | Total column isoprene |
tc_no | 218027 | Total column nitrogen monoxide |
tc_oh | 218030 | Total column hydroxyl radical |
tc_c2h6 | 218045 | Total column ethane |
tc_c3h8 | 218047 | Total column propane |
定壓層變數項
short name | parameter ID | name |
---|---|---|
aermr01 | 210001 | Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio |
aermr02 | 210002 | Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio |
aermr03 | 210003 | Sea Salt Aerosol (5 - 20 um) Mixing Ratio |
aermr04 | 210004 | Dust Aerosol (0.03 - 0.55 um) Mixing Ratio |
aermr05 | 210005 | Dust Aerosol (0.55 - 0.9 um) Mixing Ratio |
aermr06 | 210006 | Dust Aerosol (0.9 - 20 um) Mixing Ratio |
aermr07 | 210007 | Hydrophobic Organic Matter Aerosol Mixing Ratio |
aermr08 | 210008 | Hydrophilic Organic Matter Aerosol Mixing Ratio |
aermr09 | 210009 | Hydrophobic Black Carbon Aerosol Mixing Ratio |
aermr10 | 210010 | Hydrophilic Black Carbon Aerosol Mixing Ratio |
aermr11 | 210011 | Sulphate Aerosol Mixing Ratio |
no2 | 210121 | Nitrogen dioxide |
so2 | 210122 | Sulphur dioxide |
co | 210123 | Carbon monoxide |
hcho | 210124 | Formaldehyde |
go3 | 210203 | GEMS Ozone |
ch4 | 217004 | Methane |
hno3 | 217006 | Nitric acid |
pan | 217013 | Peroxyacetyl nitrate |
c5h8 | 217016 | Isoprene |
no | 217027 | Nitrogen monoxide |
oh | 217030 | Hydroxyl radical |
c2h6 | 217045 | Ethane |
c3h8 | 217047 | Propane |
定比例層變數項
short name | parameter ID | name |
---|---|---|
lnsp | 152 | Logarithm of surface pressure |
aermr01 | 210001 | Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio |
aermr02 | 210002 | Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio |
aermr03 | 210003 | Sea Salt Aerosol (5 - 20 um) Mixing Ratio |
aermr04 | 210004 | Dust Aerosol (0.03 - 0.55 um) Mixing Ratio |
aermr05 | 210005 | Dust Aerosol (0.55 - 0.9 um) Mixing Ratio |
aermr06 | 210006 | Dust Aerosol (0.9 - 20 um) Mixing Ratio |
aermr07 | 210007 | Hydrophobic Organic Matter Aerosol Mixing Ratio |
aermr08 | 210008 | Hydrophilic Organic Matter Aerosol Mixing Ratio |
aermr09 | 210009 | Hydrophobic Black Carbon Aerosol Mixing Ratio |
aermr10 | 210010 | Hydrophilic Black Carbon Aerosol Mixing Ratio |
aermr11 | 210011 | Sulphate Aerosol Mixing Ratio |
no2 | 210121 | Nitrogen dioxide |
so2 | 210122 | Sulphur dioxide |
co | 210123 | Carbon monoxide |
hcho | 210124 | Formaldehyde |
go3 | 210203 | GEMS Ozone |
ch4 | 217004 | Methane |
hno3 | 217006 | Nitric acid |
pan | 217013 | Peroxyacetyl nitrate |
c5h8 | 217016 | Isoprene |
no | 217027 | Nitrogen monoxide |
oh | 217030 | Hydroxyl radical |
c2h6 | 217045 | Ethane |
c3h8 | 217047 | Propane |