Changeset 24517


Ignore:
Timestamp:
01/14/20 12:52:41 (5 years ago)
Author:
tsantos
Message:

CHG: err as output

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/contrib/morlighem/modeldata/interpMouginotAntTimeSeries1973to2018.m

    r23873 r24517  
    1 function [vxout vyout]= interpMouginotAntTimeSeries1973to2018(X,Y,T)
     1function [vxout vyout errxout erryout stdxout stdyout]= interpMouginotAntTimeSeries1973to2018(X,Y,T)
    22%INTERPMOUGINOTANTTIMESERIES1973TO2018 - interpolate observed (time series) velocities
    33%
     
    4545%      [vxout vyout]= interpMouginotAntTimeSeries1973to2018(md.mesh.x,md.mesh.y,[1986 1988; 1991 1992; 1995 1996; 2000 2001]);
    4646%
    47 %      Another example:
     47%      Another examples:
    4848%      [vxout vyout]= interpMouginotAntTimeSeries1973to2018(md.mesh.x,md.mesh.y,[1973 1975; 1973 1988; 1991 1992; 2011 2012]);
     49%      [vel]= interpMouginotAntTimeSeries1973to2018(md.mesh.x,md.mesh.y,[1986; 1991; 1995; 2000]);
     50%      [vxout vyout errxout erryout stdxout stdyout]= interpMouginotAntTimeSeries1973to2018(md.mesh.x,md.mesh.y,[1986; 1991; 1995; 2000]);
    4951
    5052%read data
     
    119121        error('nargin not supported yet!');
    120122end
     123if nargout~=1 & nargout~=2 & nargout~=6
     124        error('nargout not supported!');
     125end
     126
    121127
    122128% get the spatial positions
     
    136142vxdata = [];
    137143vydata = [];
     144if nargout==6 % it includes ERRX, ERRY, STDX and STDY
     145        errxdata = [];
     146        errydata = [];
     147        stdxdata = [];
     148        stdydata = [];
     149end
    138150for i=1:length(pos),
    139151        disp(['      step = ' int2str(i) '/' int2str(length(pos)) ', position = ' int2str(pos(i)) ', year = '  int2str(year1(pos(i))) ' - ' int2str(year2(pos(i)))]);
     
    142154        vxdata(:,:,i) = permute(vx,[2 1 3]);
    143155        vydata(:,:,i) = permute(vy,[2 1 3]);
     156        if nargout==6 % it includes ERRX, ERRY, STDX and STDY
     157                errx = double(ncread(nc,'ERRX',[id1x id1y pos(i)],[id2x-id1x+1 id2y-id1y+1 1],[1 1 1]));
     158                erry = double(ncread(nc,'ERRY',[id1x id1y pos(i)],[id2x-id1x+1 id2y-id1y+1 1],[1 1 1]));       
     159                stdx = double(ncread(nc,'STDX',[id1x id1y pos(i)],[id2x-id1x+1 id2y-id1y+1 1],[1 1 1]));
     160                stdy = double(ncread(nc,'STDY',[id1x id1y pos(i)],[id2x-id1x+1 id2y-id1y+1 1],[1 1 1]));       
     161                errxdata(:,:,i) = permute(errx,[2 1 3]);
     162                errydata(:,:,i) = permute(erry,[2 1 3]);
     163                stdxdata(:,:,i) = permute(stdx,[2 1 3]);
     164                stdydata(:,:,i) = permute(stdy,[2 1 3]);
     165        end
    144166end
    145167xdata=xdata(id1x:id2x);
     
    149171vxout = [];
    150172vyout = [];
     173if nargout==6 % it includes ERRX, ERRY, STDX and STDY
     174        errxout = [];
     175        erryout = [];
     176        stdxout = [];
     177        stdyout = [];
     178end
    151179for i=1:length(pos),
    152180        disp(['      step = ' int2str(i) '/' int2str(length(pos)) ', position = ' int2str(pos(i)) ', year = '  int2str(year1(pos(i))) ' - ' int2str(year2(pos(i)))]);
    153181        vxout = [vxout InterpFromGrid(xdata,ydata,vxdata(:,:,i),double(X),double(Y))];
    154182        vyout = [vyout InterpFromGrid(xdata,ydata,vydata(:,:,i),double(X),double(Y))];
     183        if nargout==6 % it includes ERRX, ERRY, STDX and STDY
     184                errxout = [errxout InterpFromGrid(xdata,ydata,errxdata(:,:,i),double(X),double(Y))];
     185                erryout = [erryout InterpFromGrid(xdata,ydata,errydata(:,:,i),double(X),double(Y))];
     186                stdxout = [stdxout InterpFromGrid(xdata,ydata,stdxdata(:,:,i),double(X),double(Y))];
     187                stdyout = [stdyout InterpFromGrid(xdata,ydata,stdydata(:,:,i),double(X),double(Y))];
     188        end
    155189end
    156190
Note: See TracChangeset for help on using the changeset viewer.