Changeset 24517 for issm/trunk-jpl/src/m/contrib/morlighem/modeldata/interpMouginotAntTimeSeries1973to2018.m
- Timestamp:
- 01/14/20 12:52:41 (5 years ago)
- 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)1 function [vxout vyout errxout erryout stdxout stdyout]= interpMouginotAntTimeSeries1973to2018(X,Y,T) 2 2 %INTERPMOUGINOTANTTIMESERIES1973TO2018 - interpolate observed (time series) velocities 3 3 % … … 45 45 % [vxout vyout]= interpMouginotAntTimeSeries1973to2018(md.mesh.x,md.mesh.y,[1986 1988; 1991 1992; 1995 1996; 2000 2001]); 46 46 % 47 % Another example :47 % Another examples: 48 48 % [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]); 49 51 50 52 %read data … … 119 121 error('nargin not supported yet!'); 120 122 end 123 if nargout~=1 & nargout~=2 & nargout~=6 124 error('nargout not supported!'); 125 end 126 121 127 122 128 % get the spatial positions … … 136 142 vxdata = []; 137 143 vydata = []; 144 if nargout==6 % it includes ERRX, ERRY, STDX and STDY 145 errxdata = []; 146 errydata = []; 147 stdxdata = []; 148 stdydata = []; 149 end 138 150 for i=1:length(pos), 139 151 disp([' step = ' int2str(i) '/' int2str(length(pos)) ', position = ' int2str(pos(i)) ', year = ' int2str(year1(pos(i))) ' - ' int2str(year2(pos(i)))]); … … 142 154 vxdata(:,:,i) = permute(vx,[2 1 3]); 143 155 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 144 166 end 145 167 xdata=xdata(id1x:id2x); … … 149 171 vxout = []; 150 172 vyout = []; 173 if nargout==6 % it includes ERRX, ERRY, STDX and STDY 174 errxout = []; 175 erryout = []; 176 stdxout = []; 177 stdyout = []; 178 end 151 179 for i=1:length(pos), 152 180 disp([' step = ' int2str(i) '/' int2str(length(pos)) ', position = ' int2str(pos(i)) ', year = ' int2str(year1(pos(i))) ' - ' int2str(year2(pos(i)))]); 153 181 vxout = [vxout InterpFromGrid(xdata,ydata,vxdata(:,:,i),double(X),double(Y))]; 154 182 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 155 189 end 156 190
Note:
See TracChangeset
for help on using the changeset viewer.