开始使用免费开始使用

计算欧洲气温趋势

您希望使用 ERA5 数据集计算从 1980 年至今的欧洲平均气温。该数据是一个 Zarr 数据集,包含按月的平均气温和降水,基于经纬度网格。Zarr 文件已分块,磁盘上的每个子文件是一个形状为 15 个纬度、15 个经度和 12 个月的数组。

xarray 已作为 xr 导入供您使用。

本练习是课程的一部分

Python 中的 Dask 并行编程

查看课程

练习说明

  • 使用 xarray 打开 "data/era_eu.zarr" 数据集。
  • 计算 temp DataArray 在 latlon 维度上的平均值。
  • 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()
编辑并运行代码