前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >气象数据分析 | 经验正交分解EOF

气象数据分析 | 经验正交分解EOF

作者头像
MeteoAI
发布2021-11-12 16:59:21
2.9K0
发布2021-11-12 16:59:21
举报
文章被收录于专栏:MeteoAI

经验正交函数分析方法(empirical orthogonal function,缩写EOF)也称特征向量分析(eigenvector analysis),或者主成分分析(principal component analysis),是一种分析矩阵数据中的结构特征,提取主要数据特征量的一种方法。

导入模块

代码语言:javascript
复制
import cartopy.crs as ccrs
import cartopy.feature as cfeature
from netCDF4 import Dataset
import matplotlib.pyplot as plt
import numpy as np

from eofs.standard import Eof
from eofs.examples import example_data_path

import warnings
warnings.filterwarnings('ignore')
代码语言:javascript
复制
/home/lqy/anaconda3/lib/python3.8/site-packages/iris/config.py:139: UserWarning: Ignoring config item 'Resources':'test_data_dir' (section:option) as '/home/h05/itwl/projects/git/iris-test-data/test_data' is not a valid directory path.
  warnings.warn(msg.format(section, option, c_path))

冬季北大西洋位势高度数据

北大西洋涛动(North Atlantic oscillation,NAO)于1920年由Sir Gilbert Walker(G.沃克)发现,三大涛动之一,指亚速尔高压和冰岛低压之间气压的反向变化关系,即当亚速尔地区气压偏高时,冰岛地区气压偏低,反之亦然。NAO是北大西洋地区大气最显著的模态。其气候影响最突出的主要是北美及欧洲,但也可能对其它地区如亚洲的气候有一定影响。

代码语言:javascript
复制
# Read geopotential height data using the netCDF4 module. The file contains
# December-February averages of geopotential height at 500 hPa for the
# European/Atlantic domain (80W-40E, 20-90N).
filename = '../input/eof7091/hgt_djf.nc'
ncin = Dataset(filename, 'r')
z_djf = ncin.variables['z'][:]
lons = ncin.variables['longitude'][:]
lats = ncin.variables['latitude'][:]
ncin.close()

# Compute anomalies by removing the time-mean.
z_djf_mean = z_djf.mean(axis=0)
z_djf = z_djf - z_djf_mean

# Create an EOF solver to do the EOF analysis. Square-root of cosine of
# latitude weights are applied before the computation of EOFs.
coslat = np.cos(np.deg2rad(lats)).clip(0., 1.)
wgts = np.sqrt(coslat)[..., np.newaxis]
solver = Eof(z_djf, weights=wgts)

# Retrieve the leading EOF, expressed as the covariance between the leading PC
# time series and the input SLP anomalies at each grid point.
eof1 = solver.eofsAsCovariance(neofs=1)

# Plot the leading EOF expressed as covariance in the European/Atlantic domain.
clevs = np.linspace(-75, 75, 11)
proj = ccrs.Orthographic(central_longitude=-20, central_latitude=60)
ax = plt.axes(projection=proj)
ax.set_global()
ax.coastlines()
ax.contourf(lons, lats, eof1.squeeze(), levels=clevs,
            cmap=plt.cm.RdBu_r, transform=ccrs.PlateCarree())
plt.title('EOF1 expressed as covariance', fontsize=16)

plt.show()

北大西洋上两个大气活动中心(冰岛低压和亚速尔高压)的气压变化为明显负相关;当冰岛低压加深时,亚速尔高压加强,或冰岛低压填塞时,亚速尔高压减弱。G.沃克称这一现象为北大西洋涛动North Atlantic oscillation (NAO)。北大西洋涛动强,表明两个活动中心之间的气压差大,北大西洋中纬度的西风强,为高指数环流。这时墨西哥湾暖流及拉布拉多寒流均增强,西北欧和美国东南部因受强暖洋流影响,出现暖冬;同时为寒流控制的加拿大东岸及格陵兰西岸却非常寒冷。反之北大西洋涛动弱,表明两个活动中心之间的气压差小,北大西洋上西风减弱,为低指数环流。这时西北欧及美国东南部将出现冷冬,而加拿大东岸及格陵兰西岸则相对温暖。

太平洋海温距平数据

厄尔尼诺现象,是指东太平洋海水每隔数年就会异常升温的现象,是厄尔尼诺-南方振荡现象(El Niño-Southern Oscillation,ENSO)中,东太平洋升温的阶段。它与中太平洋和东太平洋(约在国际换日线及西经120度)赤道位置产生的温暖海流有关。厄尔尼诺-南方振荡现象是指中太平洋和东太平洋赤道位置海面温度的高低温循环。厄尔尼诺现象是因为西太平洋的高气压及东太平洋的低气压所造成。厄尔尼诺-南方振荡现象中的低温阶段称为拉尼娜现象(也称为反圣婴现象),是指东太平洋的海面温度高于平均值,以及西太平洋的气压较低及东太平洋的气压较高所造成。

代码语言:javascript
复制
"""
Compute and plot the leading EOF of sea surface temperature in the
central and northern Pacific during winter time.

The spatial pattern of this EOF is the canonical El Nino pattern, and
the associated time series shows large peaks and troughs for well-known
El Nino and La Nina events.
"""
filename = '../input/eof7091/sst_ndjfm_anom.nc'
ncin = Dataset(filename, 'r')
sst = ncin.variables['sst'][:]
lons = ncin.variables['longitude'][:]
lats = ncin.variables['latitude'][:]
ncin.close()

# Create an EOF solver to do the EOF analysis. Square-root of cosine of
# latitude weights are applied before the computation of EOFs.
coslat = np.cos(np.deg2rad(lats))
wgts = np.sqrt(coslat)[..., np.newaxis]
solver = Eof(sst, weights=wgts)

# Retrieve the leading EOF, expressed as the correlation between the leading
# PC time series and the input SST anomalies at each grid point, and the
# leading PC time series itself.
eof1 = solver.eofsAsCorrelation(neofs=1)
pc1 = solver.pcs(npcs=1, pcscaling=1)

# Plot the leading EOF expressed as correlation in the Pacific domain.
clevs = np.linspace(-1, 1, 11)
ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=190))
fill = ax.contourf(lons, lats, eof1.squeeze(), clevs,
                   transform=ccrs.PlateCarree(), cmap=plt.cm.RdBu_r)
ax.add_feature(cfeature.LAND, facecolor='w', edgecolor='k')
cb = plt.colorbar(fill, orientation='horizontal')
cb.set_label('correlation coefficient', fontsize=12)
plt.title('EOF1 expressed as correlation', fontsize=16)

# Plot the leading PC time series.
plt.figure()
years = range(1962, 2012)
plt.plot(years, pc1, color='b', linewidth=2)
plt.axhline(0, color='k')
plt.title('PC1 Time Series')
plt.xlabel('Year')
plt.ylabel('Normalized Units')
plt.xlim(1962, 2012)
plt.ylim(-3, 3)
plt.show()
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2021-11-09,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 MeteoAI 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 导入模块
  • 冬季北大西洋位势高度数据
  • 太平洋海温距平数据
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档