Author : 蘇奕翰
s1000210hank@icloud.com
早安 這是再分析資料的下載手冊
內容僅包含再分析資料的下載 並不提供使用再分析資料的方法
網頁註冊以及金鑰設置
步驟
-
以下是ECMWF官網的再分析資料列表 可以在裡面看到不同的再分析資料
https://www.ecmwf.int/en/forecasts/datasets/browse-reanalysis-datasets
建議進行註冊 才可以使用除了常用的ERA5以外的資料
紅框標示處會進入到該再分析資料所提供的產品區
與下面黑底方塊中 由ECMWF直接提供的資料不同
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
點擊進入Climate Data Store的網頁後會看到以下畫面
https://cds.climate.copernicus.eu/cdsapp#!/home
首先需要先點擊右上角進行註冊
註冊完後點擊畫面紅框處 進入API的說明文中
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
註冊後該處會顯示一串網址以及一串API如紅框處
暫時先別關閉畫面 進行主機上的API金鑰設置
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
若為Linux系統則按照左邊的提示進行操作
若為Windows系統則依照以下步驟進行
- 開啟命令提示字元
- 輸入
cd %USERPROFILE%
移動至使用者資料夾
- 輸入
echo url: https://cds.climate.copernicus.eu/api/v2 >> .cdsapirc
- 複製API
- 輸入
echo 複製的API >> .cdsapirc
- 輸入
type .cdsapirc
確認上述文字有成功輸入
Reference
-
進入以下頁面進行認證
https://cds.climate.copernicus.eu/cdsapp/#!/terms/licence-to-use-copernicus-products
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
回到首頁 收尋框中輸入ERA5後可以得到以下產品
並自行尋找所需要的產品
點擊進去後即可進行下載
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
使用 python 下載
使用程式碼下載較為方便 不需要進入頁面即可下載
這邊則以 python 作為範例
前一個章節的帳號註冊以及金鑰設置仍然為必要手續
必須先完成才可以使用程式碼下載
若尚未成為 python 使用者
可以參考這篇說明文件 Python 初學者使用手冊
步驟
- 下載 範例程式碼
內含 reanalysis_download.py
以及 __example_meta.json
- 進入命令提示字元 下載 cdsapi, pandas
- 輸入
conda install -c conda-forge cdsapi
- 輸入
conda install -c anaconda pandas
__example_meta.json
為範例設定檔 以下將逐行解釋
最下面的表格是設定檔的參考網站 : API 名稱及其他參數設定
{
首行可以自己改名稱 代表意義為官網上看到的產品名稱 也可以改為自己的計畫名稱
"ERA5 monthly averaged data on single levels from 1979 to present" : {
"__info" : "set start time and end time"
"start" : "2020-05-01" 下載資料的開始時間
"final" : "2021-03-01" 下載資料的結束時間
這行是該產品的 API名稱 不可以改動 由提供的網址查詢 (Datasets Name)
"__info" : "the product's API name, can not rewrite",
"data_name" : "reanalysis-era5-single-levels-monthly-means",
該產品的資料時間解析度 目前有每月以及每小時的資料
"__info" : "data frequency, monthly, daily or hourly",
"data_freq" : "monthly",
資料最重要的設定參數 以下的參數都可以在提供的網址查詢
"__info" : "year, month, time are the keywords you can not change",
"setting" : {
產品的型式 必須與上面的 data_name 對應
"product_type" : "monthly_averaged_reanalysis",
"format" : "netcdf", 資料格式
"area" : [25,115,20,125], 資料範圍 (N,W,S,E)
"grid" : [0.25,0.25], 資料網格大小 (經,緯)
可用的變數 點擊 Datasets Name 的名稱即可連結到變數列
"variable" : ["10m_u_component_of_wind",
"mean_sea_level_pressure"],
"year" : "YYYY", 年分 勿改動
"month" : "MM", 月份 勿改動
"time" : ["00:00", "01:00", "02:00", "03:00",
"04:00", "05:00", "06:00", "07:00",
"08:00", "09:00", "10:00", "11:00",
"12:00", "13:00", "14:00", "15:00",
"16:00", "17:00", "18:00", "19:00",
"20:00", "21:00", "22:00", "23:00"]
時間 勿改動
}
}
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
reanalysis_download.py
為主程式
需在最下方輸入兩個參數後才可以執行
- 於命令提示字元執行主程式
python reanalysis_download.py
- 若出現 SSH error 等字眼 則先執行以下命令
範例
計畫名稱為 test
下載從 2021-02-01 00:00:00 到 2021-02-07 00:00:00 的 hourly 資料
要下載的資料名稱為 reanalysis-era5-pressure-levels
以 netcdf4 的格式下載
資料的形式為 reanalysis
範圍從 ~ , ~
空間解析度為 X
需要使用的變數有 Specific humidity 以及 Temperature
使用的壓力層為 1,2,…,950,975,1000
{
"test" : {
"__info" : "set start time and end time",
"start" : "2021-02-01 00:00:00",
"final" : "2021-02-07 00:00:00",
"__info" : "the product's API name, can not rewrite",
"data_name" : "reanalysis-era5-pressure-levels",
"__info" : "data frequency, monthly, daily or hourly",
"data_freq" : "hourly",
"__info" : "year, month, time are the keywords you CAN NOT change",
"setting" : {
"product_type" : "reanalysis",
"format" : "netcdf",
"area" : [25,120,24,121],
"grid" : [0.25,0.25],
"variable" : ["Specific humidity","Temperature"],
"pressure_level" : ["1","2","3","5","7","10","20","30","50","70",
"100","125","150","175","200","225","250","300",
"350","400","450","500","550","600","650","700",
"750","775","800","825","850","875","900","925","950","975","1000"],
"year" : "YYYY",
"month" : "MM",
"day" : "DD",
"time" : ["00:00", "01:00", "02:00", "03:00",
"04:00", "05:00", "06:00", "07:00",
"08:00", "09:00", "10:00", "11:00",
"12:00", "13:00", "14:00", "15:00",
"16:00", "17:00", "18:00", "19:00",
"20:00", "21:00", "22:00", "23:00"]
}
}
}
Reference
https://confluence.ecmwf.int/display/CKB/General+articles
json改start跟final ->
down改PROJ_NAME ->
handler改DIR_NAM、start跟final