Link Search Menu Expand Document

Near Real Time 檔案處理

Table of contents

背景

  • 歐洲近程預報中心(ecmwf)是位在英國雷丁的國際機構,組織如圖。其中哥白尼空氣監測服務(Copernicus Atmosphere Monitoring Service)為提供會員國有關空氣品質服務的整合系統,詳見官網wiki說明

cams_structure.png

  • 其資料來源包括衛星觀測(如下圖)、地面觀測、以及模式模擬的結果,為一同化後的結果,因此會有比較高的參考價值。

cams_specis.png

資料下載

  • CAMS NRT數據必須使用python module下載,雖然提供了點選的網頁,但是為產生程式碼,實際下載是使用python 的WEBAPI程式,在OS的命令列環境執行下載程序的。

1.註冊、登入(密碼必須含有特殊字元)

2.點選月份、時間、步階、測項,之後可以選擇預覽及格式,如下圖:

cams_slections.png

  • 由於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",
   })
  1. 直接在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)
  • 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

  1. CAMS再分析數據說明https://www.ecmwf.int/en/elibrary/18885-new-cams-global-reanalysis-atmospheric-composition
  2. 再分析逐日空品數據之應用https://www.ecmwf.int/en/elibrary/19028-use-sentinel-5p-air-quality-data-cams
  3. Accessing ECMWF data servers in batch,https://confluence.ecmwf.int/display/WEBAPI/Accessing+ECMWF+data+servers+in+batch 
  4. Reduced Gaussian Grid systems, https://confluence.ecmwf.int/display/EMOS/Reduced+Gaussian+Grids Here 全球空品模擬結果之下載與格式轉換 parent:Dr. Kuang’s Evernotes_Grid Models

分析結果項目與編號表

地面變數項

short nameparameter IDname
z129Geopotential
lsm172Land-sea mask
tcno2210125Total column Nitrogen dioxide
tcso2210126Total column Sulphur dioxide
tcco210127Total column Carbon monoxide
tchcho210128Total column Formaldehyde
gtco3210206GEMS Total column ozone
tc_ch4218004Total column methane
tc_hno3218006Total column nitric acid
tc_pan218013Total column peroxyacetyl nitrate
tc_c5h8218016Total column isoprene
tc_no218027Total column nitrogen monoxide
tc_oh218030Total column hydroxyl radical
tc_c2h6218045Total column ethane
tc_c3h8218047Total column propane

定壓層變數項

short nameparameter IDname
aermr01210001Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio
aermr02210002Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio
aermr03210003Sea Salt Aerosol (5 - 20 um) Mixing Ratio
aermr04210004Dust Aerosol (0.03 - 0.55 um) Mixing Ratio
aermr05210005Dust Aerosol (0.55 - 0.9 um) Mixing Ratio
aermr06210006Dust Aerosol (0.9 - 20 um) Mixing Ratio
aermr07210007Hydrophobic Organic Matter Aerosol Mixing Ratio
aermr08210008Hydrophilic Organic Matter Aerosol Mixing Ratio
aermr09210009Hydrophobic Black Carbon Aerosol Mixing Ratio
aermr10210010Hydrophilic Black Carbon Aerosol Mixing Ratio
aermr11210011Sulphate Aerosol Mixing Ratio
no2210121Nitrogen dioxide
so2210122Sulphur dioxide
co210123Carbon monoxide
hcho210124Formaldehyde
go3210203GEMS Ozone
ch4217004Methane
hno3217006Nitric acid
pan217013Peroxyacetyl nitrate
c5h8217016Isoprene
no217027Nitrogen monoxide
oh217030Hydroxyl radical
c2h6217045Ethane
c3h8217047Propane

定比例層變數項

short nameparameter IDname
lnsp152Logarithm of surface pressure
aermr01210001Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio
aermr02210002Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio
aermr03210003Sea Salt Aerosol (5 - 20 um) Mixing Ratio
aermr04210004Dust Aerosol (0.03 - 0.55 um) Mixing Ratio
aermr05210005Dust Aerosol (0.55 - 0.9 um) Mixing Ratio
aermr06210006Dust Aerosol (0.9 - 20 um) Mixing Ratio
aermr07210007Hydrophobic Organic Matter Aerosol Mixing Ratio
aermr08210008Hydrophilic Organic Matter Aerosol Mixing Ratio
aermr09210009Hydrophobic Black Carbon Aerosol Mixing Ratio
aermr10210010Hydrophilic Black Carbon Aerosol Mixing Ratio
aermr11210011Sulphate Aerosol Mixing Ratio
no2210121Nitrogen dioxide
so2210122Sulphur dioxide
co210123Carbon monoxide
hcho210124Formaldehyde
go3210203GEMS Ozone
ch4217004Methane
hno3217006Nitric acid
pan217013Peroxyacetyl nitrate
c5h8217016Isoprene
no217027Nitrogen monoxide
oh217030Hydroxyl radical
c2h6217045Ethane
c3h8217047Propane

預報結果項目與編號表

地面變數項

short nameparameter IDname
pm1210072Particulate matter d < 1 um
pm2p5210073Particulate matter d < 2.5 um
pm10210074Particulate matter d < 10 um
tcno2210125Total column Nitrogen dioxide
tcso2210126Total column Sulphur dioxide
tcco210127Total column Carbon monoxide
tchcho210128Total column Formaldehyde
gtco3210206GEMS Total column ozone
aod550210207Total Aerosol Optical Depth at 550nm
ssaod550210208Sea Salt Aerosol Optical Depth at 550nm
duaod550210209Dust Aerosol Optical Depth at 550nm
omaod550210210Organic Matter Aerosol Optical Depth at 550nm
bcaod550210211Black Carbon Aerosol Optical Depth at 550nm
suaod550210212Sulphate Aerosol Optical Depth at 550nm
aod469210213Total Aerosol Optical Depth at 469nm
aod670210214Total Aerosol Optical Depth at 670nm
aod865210215Total Aerosol Optical Depth at 865nm
aod1240210216Total Aerosol Optical Depth at 1240nm
uvbed214002UV biologically effective dose
uvbedcs214003UV biologically effective dose clear-sky
tc_ch4218004Total column methane
tc_hno3218006Total column nitric acid
tc_pan218013Total column peroxyacetyl nitrate
tc_c5h8218016Total column isoprene
tc_no218027Total column nitrogen monoxide
tc_oh218030Total column hydroxyl radical
tc_c2h6218045Total column ethane
tc_c3h8218047Total column propane

定壓層變數項

short nameparameter IDname
aermr01210001Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio
aermr02210002Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio
aermr03210003Sea Salt Aerosol (5 - 20 um) Mixing Ratio
aermr04210004Dust Aerosol (0.03 - 0.55 um) Mixing Ratio
aermr05210005Dust Aerosol (0.55 - 0.9 um) Mixing Ratio
aermr06210006Dust Aerosol (0.9 - 20 um) Mixing Ratio
aermr07210007Hydrophobic Organic Matter Aerosol Mixing Ratio
aermr08210008Hydrophilic Organic Matter Aerosol Mixing Ratio
aermr09210009Hydrophobic Black Carbon Aerosol Mixing Ratio
aermr10210010Hydrophilic Black Carbon Aerosol Mixing Ratio
aermr11210011Sulphate Aerosol Mixing Ratio
no2210121Nitrogen dioxide
so2210122Sulphur dioxide
co210123Carbon monoxide
hcho210124Formaldehyde
go3210203GEMS Ozone
ch4217004Methane
hno3217006Nitric acid
pan217013Peroxyacetyl nitrate
c5h8217016Isoprene
no217027Nitrogen monoxide
oh217030Hydroxyl radical
c2h6217045Ethane
c3h8217047Propane

定比例層變數項

short nameparameter IDname
lnsp152Logarithm of surface pressure
aermr01210001Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio
aermr02210002Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio
aermr03210003Sea Salt Aerosol (5 - 20 um) Mixing Ratio
aermr04210004Dust Aerosol (0.03 - 0.55 um) Mixing Ratio
aermr05210005Dust Aerosol (0.55 - 0.9 um) Mixing Ratio
aermr06210006Dust Aerosol (0.9 - 20 um) Mixing Ratio
aermr07210007Hydrophobic Organic Matter Aerosol Mixing Ratio
aermr08210008Hydrophilic Organic Matter Aerosol Mixing Ratio
aermr09210009Hydrophobic Black Carbon Aerosol Mixing Ratio
aermr10210010Hydrophilic Black Carbon Aerosol Mixing Ratio
aermr11210011Sulphate Aerosol Mixing Ratio
no2210121Nitrogen dioxide
so2210122Sulphur dioxide
co210123Carbon monoxide
hcho210124Formaldehyde
go3210203GEMS Ozone
ch4217004Methane
hno3217006Nitric acid
pan217013Peroxyacetyl nitrate
c5h8217016Isoprene
no217027Nitrogen monoxide
oh217030Hydroxyl radical
c2h6217045Ethane
c3h8217047Propane