Regrid lat和lon数据以降低分辨率和平均数据来匹配

时间:2013-06-05 16:39:42

标签: matlab find interpolation

我有来自AMSR的关于冰浓度的数据。纬度和经度数据是方位角的,因为它们是从km数据转换为lat和lon。我需要采用高分辨率,不均匀间隔的网格,并将其转换为均匀间隔的网格,使纬度和经度增加0.25个增量。然后我需要平均每个lat和lon增量的数据。

%%%%%%%%
% A .mat file was made from the following block of commented script so it
    % does not have to be run each time.
%
% % Read in Latitude and Longitude files
%     lonIce = double(hdfread('LongitudeLatitudeGrid-s6250-Antarctic.hdf', 'Longitudes'));
%     latIce = double(hdfread('LongitudeLatitudeGrid-s6250-Antarctic.hdf', 'Latitudes'));
% 
% % Transpose everything
%     latIce  = latIce'; 
%     lonIce  = lonIce';
%     
% % Add path
%     % datapath = '/home/jg3223/Documents/AMSR_SeaIceData_Antarctic';
% 
% % Create new lon and lat grid that increases by 0.25 degree increments.
% for i = 1:1437
%     for j = 1:159
%         X(i,j) = 0.75+0.25*i; % longitude from 1 to 360
%         Y(i,j) = -89.75+0.25*j; % latitude from -89.5 to -50
%     end
% end

% Read in sea ice concentrations
%      AMSR-E data format: 'asi-s6250-20110101-v5.hdf'; 
%      AMSR2 data format: 'asi-AMSR2-s6250-20120724-v5.hdf';
%      SSMI data format: 'asi-SSMIS17-s6250-20111001-v5.hdf';
fname = 'asi-s6250-20100101-v5.hdf';
data = double(hdfread(fname, 'ASI Ice Concentration'));

% % Define 3d matrix
% [N,M] = size(X);
% Q = zeros(N, M, 1251); % matrix we'll populate; each file contains
%                               % one map [nLONS x nLATS] at time step t
%%%%%%

% Load in the .mat file containing the variables needed 
load 'AMSR_DailySeaIce_Readin_Variables'

% Load list file
flist = fopen('fnames.dat');   % open the list of file names

tic;
t = 0;
while ~feof(flist),               % while we haven't reached the end of the file

% For each file 
fname = fgetl(flist);         % Reads next line of list, stores name of data file as string in fname
fid = fopen(fname);           % Open that file
disp(fname);

t = t+1; % time index 

% Open each file
data = double(hdfread(fname, 'ASI Ice Concentration'));

% Transpose data array
data = data';

% Interpolate
Z = griddata(lonIce, latIce, data, X, Y);

% Turn NaN to 0
% Z(isnan(Z)) = 0 ;

% Store in new array
data_All(:,:,t) = Z;

% Clear current data
clear data;

end

0 个答案:

没有答案