```python import xarray as xr import matplotlib.pyplot as plt # 读取nc文件 data = xr.open_dataset('sst.nc') # 计算nino3.4指数,使用 nino3.4 区域的坐标(5S-5N, 170W-120W) nino3_4 = data.sel(lat=slice(-5, 5), lon=slice(360-170, 360-120)).mean(dim=['lat', 'lon']) # 绘制nino3.4指数时间变化图 plt.figure(figsize=(12, 6)) nino3_4.plot() plt.title('Nino3.4 Index Time Series') plt.xlabel('Time') plt.ylabel('SST (°C)') plt.grid() plt.show() ``` [2024-11-24 20:03:28 | AI写代码神器 | 299点数解答]