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

Last change on this file since 26744 was 26744, checked in by Mathieu Morlighem, 3 years ago

merged trunk-jpl and trunk for revision 26742

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