Changeset 1089
- Timestamp:
- 06/24/09 16:05:08 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/utils/DataProcessing/TracksToMatrix.m
r1082 r1089 1 function [x_f y_f MatData MatTracks]=TracksToMatrix(xmin,ymin,nx,ny,posting,track_coord,track_values,theta,varargin),1 function [x_f y_f MatData]=TracksToMatrix(xmin,ymin,nx,ny,posting,track_coord,track_values,theta,varargin), 2 2 %TRACKSTOMATRIX - Create a map from tracks 3 3 % 4 % This routine creates a map with average values of tracks using the DACE toolbox. 5 % xmin and ymin are two scalars are the extreme values of the data matrix 4 % This routine creates a map from tracks using Kriging with the DACE package. 5 % xmin and ymin are two scalars are the extreme values of the data matrix one wants to create 6 % posting is a scalar giving the posting of the matrix to be created in meters 6 7 % trac_coord is an exp file containing the coordinates of the tracks (x and y) 7 8 % trav_values is a vector with the values along the track coordinates 8 % posting is a scalar giving the posting of the matrix in meters 9 % theta is a parameter of the correlation function 9 % theta is a parameter of the correlation function stricly positive 10 % varagin can contain a matrix of data to constrain rhe matrix to be created 11 % it shoud contain indices x and y and the matrix 10 12 % 11 13 % Usage: … … 13 15 % 14 16 % Example: 15 % [x_f y_f Thickness]=TracksToMatrix(-10^6,!0^6,200,180,1000,'trackcoord.exp',thickness_values), 17 % [x_f y_f Thickness]=TracksToMatrix(-10^6,10^6,200,180,1000,'trackcoord.exp',thickness_values), 18 % [x_f y_f Thickness]=TracksToMatrix(-10^6,10^6,200,180,1000,'trackcoord.exp',thickness_values,x_m,y_m,globalthickness), 16 19 % 17 20 % See also: CREATEDATABOUNDARIES, CREATEDATAMATRIX 21 22 global ISSM_DIR 18 23 19 24 if nargin~=8 & nargin~=11, 20 25 error(' TracksToMatrix error message: wrong number of arguments') 21 26 end 27 28 %Add path to dace 29 addpath([ISSM_DIR '/externalpackages/dace/install']) 22 30 23 31 %First create the x_m and y_m fot the matrix … … 32 40 [Mvalue Mx My]=CreateDataMatrix(x_m,y_m,track_coord,track_values); 33 41 34 MatTracks=Mvalue;35 42 %Create vector for these coordinates and values 36 43 Svalue=sparse(Mvalue); … … 44 51 %Create boundaries for the track if specified 45 52 if nargin==11, 53 disp(' constain the border of matrix with global matrix'); 46 54 %Find out the elements to counstrain the border 47 55 x_matrix=varargin{1}; … … 49 57 datamatrix=varargin{3}; 50 58 51 %Create values on the border 59 %Create values on the border of the smaller map 52 60 [Xedge,Yedge,EdgeValues]=CreateDataBoundaries(x_m,y_m,x_matrix,y_matrix,datamatrix); 53 61 62 %Create values on the border of the larger map 63 [Xedge2,Yedge2,EdgeValues2]=CreateDataBoundaries(x_f,y_f,x_matrix,y_matrix,datamatrix); 64 54 65 %Add these values to the track values 55 Values=[Values;EdgeValues ];56 Coord=[X,Y;Xedge,Yedge ];66 Values=[Values;EdgeValues;EdgeValues2]; 67 Coord=[X,Y;Xedge,Yedge;Xedge2,Yedge2]; 57 68 end 58 69 59 70 %Create model for data 71 disp(' create the statiscal model of the data'); 60 72 [dmodel,perf]=dacefit(Coord,Values,@regpoly1,@corrgauss,theta); 61 73 … … 64 76 65 77 %Compute data on these points 78 disp(' predict the values'); 66 79 VecData=predictor(Points,dmodel); 67 80 68 81 %Reshape to get a matrix 69 82 MatData=reshape(VecData,ny,nx); 83 84 rmpath([ISSM_DIR '/externalpackages/dace/install']);
Note:
See TracChangeset
for help on using the changeset viewer.