Changeset 1089 for issm/trunk


Ignore:
Timestamp:
06/24/09 16:05:08 (16 years ago)
Author:
seroussi
Message:

improved kriging routine

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),
     1function [x_f y_f MatData]=TracksToMatrix(xmin,ymin,nx,ny,posting,track_coord,track_values,theta,varargin),
    22%TRACKSTOMATRIX - Create a map from tracks
    33%
    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
    67%   trac_coord is an exp file containing the coordinates of the tracks (x and y)
    78%   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
    1012%
    1113%   Usage:
     
    1315%
    1416%   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),
    1619%
    1720%   See also: CREATEDATABOUNDARIES, CREATEDATAMATRIX
     21
     22global ISSM_DIR
    1823
    1924if nargin~=8 & nargin~=11,
    2025        error(' TracksToMatrix error message: wrong number of arguments')
    2126end
     27
     28%Add path to dace
     29addpath([ISSM_DIR '/externalpackages/dace/install'])
    2230
    2331%First create the x_m and y_m fot the matrix
     
    3240[Mvalue Mx My]=CreateDataMatrix(x_m,y_m,track_coord,track_values);
    3341
    34 MatTracks=Mvalue;
    3542%Create vector for these coordinates and values
    3643Svalue=sparse(Mvalue);
     
    4451%Create boundaries for the track if specified
    4552if nargin==11,
     53        disp('      constain the border of matrix with global matrix');
    4654        %Find out the elements to counstrain the border
    4755        x_matrix=varargin{1};
     
    4957        datamatrix=varargin{3};
    5058
    51         %Create values on the border
     59        %Create values on the border of the smaller map
    5260        [Xedge,Yedge,EdgeValues]=CreateDataBoundaries(x_m,y_m,x_matrix,y_matrix,datamatrix);
    5361
     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
    5465        %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];
    5768end
    5869
    5970%Create model for data
     71disp('      create the statiscal model of the data');
    6072[dmodel,perf]=dacefit(Coord,Values,@regpoly1,@corrgauss,theta);
    6173
     
    6476
    6577%Compute data on these points
     78disp('      predict the values');
    6679VecData=predictor(Points,dmodel);
    6780
    6881%Reshape to get a matrix
    6982MatData=reshape(VecData,ny,nx);
     83
     84rmpath([ISSM_DIR '/externalpackages/dace/install']);
Note: See TracChangeset for help on using the changeset viewer.