- 积分
- 6155
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2017-9-11
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2020-6-16 15:42:09
|
显示全部楼层
%读取MERRA数据
clc;
clear all;
data='/data/MERRA/';
file=dir([data,'MERRA2_*.tavgM_2d_slv_Nx.*.SUB.nc']);
k=length(file);
for i=1:k
f=[data,file(i).name];
ncid=netcdf.open(f,'NC_NOWRITE');
time=double(ncread(f,'time'));
t=double(ncread(f,'T2M'))-273.15;
lat=double(ncread(f,'lat'));
lon=double(ncread(f,'lon'));
[X,Y] = meshgrid(lat,lon);
lat1 = xlsread('/data/站点月/1980-2018.xlsx','Sheet2','e2:e81'); %站点纬度
lon1 = xlsread('/data/站点月/1980-2018.xlsx','Sheet2','d2:d81'); %站点经度
Tt= interp2(X,Y,t,lat1,lon1,'linear'); %linear 双线性插值法
TT(:,:,i)=Tt;
end
b=reshape(TT,[66 470]);%1980-2018
Ttb=reshape(b(:,1:468),[66 12 39]);
T0=reshape(mean(Ttb(:,1:12,:),2),[66 39]);%年平均
% T1=reshape(mean(Ttb(:,3:5,:),2),[66 39]);%春季平均
T2=reshape(mean(Ttb(:,6:8,:),2),[66 39]);%夏季平均
% T3=reshape(mean(Ttb(:,9:11,:),2),[80 38]);%秋季平均
%冬季 1-12----3月-2月
T=reshape(b(:,3:470),[66 12 39]);
T4=reshape(mean(T(:,10:12,:),2),[66 39]);%冬季平均 %3月-2月
%各站点月均温变化
T5=mean(Ttb(:,:,1:39),3);
T55=(mean(T5(1:66,:,:),1))';
%求均值
y0=(mean(T0,1))'; %多年平均
y2=(mean(T2,1))';
y4=(mean(T4,1))';
ymean=[y0 y2 y4];
s0=mean(T0,2); %气候态平均
s2=mean(T2,2);
s4=mean(T4,2);
smean=[s0 s2 s4];
%斜率
x=1980:1:2018;
k=size(T0,1);
for j =1:k
y=T0(j,:);
[a m b]=regression(x,y);
m=m*10;
M(:,j)=m;
end
N0=M'; |
|