計算歐洲氣溫的長期趨勢
你想使用 ERA5 資料集計算 1980 年至今的歐洲平均氣溫。這份資料是 Zarr 形式的每月平均氣溫與降水量,座標為緯度與經度的網格。Zarr 檔案已分塊(chunked),因此磁碟上的每個子檔都是 15 個緯度、15 個經度與 12 個月份所組成的陣列。
xarray 已經以 xr 匯入。
本練習屬於課程
在 Python 中使用 Dask 進行平行程式設計
練習說明
- 使用
xarray開啟"data/era_eu.zarr"資料集。 - 在
lat與lon維度上計算tempDataArray 的平均值。 - 在
time維度上以視窗大小 12 進行移動平均。 - 繪製
temp_rolling_mean的時間序列圖。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Open the ERA5 dataset
ds = ____
# Select the temperature dataset and take the latitude and longitude mean
temp_timeseries = ds[____].____
# Calculate the 12 month rolling mean
temp_rolling_mean = temp_timeseries.____(____).____()
# Plot the result
____
plt.show()