赞
踩
function [gldas,time,num_file]=readgldas(controlfile_path) % Read the Control File fid=fopen(controlfile_path,'r'); num_file= fscanf(fid,'%d',1); lat= fscanf(fid,'%d',1); lon= fscanf(fid,'%d',1); dir_in=fscanf(fid,'%s',1); file_name=cell(num_file,1); for i = 1:num_file file_name{i} = fscanf(fid,'%s',1); end %ini gldas=zeros(num_file,lat,lon); SWE=zeros(num_file,lat,lon); SoilMoi0_10cm_inst=zeros(num_file,lat,lon); SoilMoi100_200cm_inst=zeros(num_file,lat,lon); SoilMoi10_40cm_inst=zeros(num_file,lat,lon); SoilMoi40_100cm_inst=zeros(num_file,lat,lon); time=zeros(num_file,1); for ii=1:num_file file=char(strcat(dir_in,file_name(ii))); SWE(ii,:,:)=rot90(ncread(file,'SWE_inst')); SoilMoi0_10cm_inst(ii,:,:)=rot90(ncread(file,'SoilMoi0_10cm_inst')); SoilMoi100_200cm_inst(ii,:,:)=rot90(ncread(file,'SoilMoi100_200cm_inst')); SoilMoi10_40cm_inst(ii,:,:)=rot90(ncread(file,'SoilMoi10_40cm_inst')); SoilMoi40_100cm_inst(ii,:,:)=rot90(ncread(file,'SoilMoi40_100cm_inst')); time(ii,:,:)=ncread(file,'time'); end for j=1:num_file gldas(j,:,:)=SWE(j,:,:)+SoilMoi0_10cm_inst(j,:,:)+SoilMoi100_200cm_inst(j,:,:)+SoilMoi10_40cm_inst(j,:,:)+SoilMoi40_100cm_inst(j,:,:); end
gldas=zeros(num_file,lat,lon);
SWE=zeros(num_file,lat,lon);
SoilMoi0_10cm_inst=zeros(num_file,lat,lon);
SoilMoi100_200cm_inst=zeros(num_file,lat,lon);
SoilMoi10_40cm_inst=zeros(num_file,lat,lon);
SoilMoi40_100cm_inst=zeros(num_file,lat,lon);
time=zeros(num_file,1);
这几个变量只是我需要的,也是grace需要的,只用下载这几个就可以,处理也就只处理这几个。
其中需要一个控制文件
180 //文件数 150 //纬度范围 360 //经度范围 clm //模型类型 E:\GLDAS\gldas_clm\ //文件夹 GLDAS_CLM10_M.A200201.001.grb.SUB.nc4 //文件名 GLDAS_CLM10_M.A200202.001.grb.SUB.nc4 GLDAS_CLM10_M.A200203.001.grb.SUB.nc4 GLDAS_CLM10_M.A200204.001.grb.SUB.nc4 GLDAS_CLM10_M.A200205.001.grb.SUB.nc4 GLDAS_CLM10_M.A200206.001.grb.SUB.nc4 GLDAS_CLM10_M.A200207.001.grb.SUB.nc4 GLDAS_CLM10_M.A200208.001.grb.SUB.nc4 GLDAS_CLM10_M.A200209.001.grb.SUB.nc4 GLDAS_CLM10_M.A200210.001.grb.SUB.nc4 GLDAS_CLM10_M.A200211.001.grb.SUB.nc4 ................................
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。