source: issm/trunk/src/m/contrib/morlighem/modeldata/interpIBCSO.m@ 24313

Last change on this file since 24313 was 23873, checked in by Mathieu Morlighem, 6 years ago

NEW: added interpolation routines'

File size: 1.3 KB
Line 
1function [bedout sid] = interpIBCSO(X,Y),
2
3%read data
4switch (oshostname()),
5 case {'ronne'}
6 ncpath='/home/ModelData/Antarctica/IBCSO/ibcso_v1_bed.grd';
7 sidpath='/home/ModelData/Antarctica/IBCSO/ibcso_v1_sid.grd';
8 otherwise
9 error('hostname not supported yet');
10end
11
12disp(' -- IBCSO: loading bathymetry');
13x_range = double(ncread(ncpath,'x_range'));
14y_range = double(ncread(ncpath,'y_range'));
15spacing = double(ncread(ncpath,'spacing'));
16xdata = (x_range(1)-spacing(1)/2) : spacing(1) : (x_range(2)-spacing(1)/2);
17ydata = (y_range(1)-spacing(2)/2) : spacing(2) : (y_range(2)-spacing(2)/2);
18data = double(ncread(ncpath,'z'));
19data(find(data==-9999 | isinf(data))) = NaN;
20data = reshape(data,[numel(xdata) numel(ydata)])';
21disp(' -- IBCSO: interpolating bed');
22bedout = InterpFromGrid(xdata,fliplr(ydata),data,double(X),double(Y));
23
24if nargout==2,
25 disp(' -- IBCSO: bathymetry sid');
26 xdata = ncread(sidpath,'x');
27 ydata = ncread(sidpath,'y');
28 data = ncread(sidpath,'z')';
29 disp(' -- IBCSO: transforming coordinates');
30 [LAT,LON] = xy2ll(double(X(:)),double(Y(:)),-1,0,71);
31 [x065,y065] = ll2xy(LAT,LON,-1,0,65);
32 x065 = reshape(x065,size(X));
33 y065 = reshape(y065,size(Y));
34 disp(' -- IBCSO: interpolating sids');
35 sid = InterpFromGrid(xdata,ydata,data,x065,y065,'nearest');
36 sid(find(sid<200000)) = 0;
37 sid(find(sid>399999)) = 0;
38end
Note: See TracBrowser for help on using the repository browser.