Changeset 13010


Ignore:
Timestamp:
08/13/12 11:44:01 (13 years ago)
Author:
Mathieu Morlighem
Message:

CHG: moving stuff around

Location:
issm/trunk-jpl/src/m
Files:
2 added
15 deleted
10 edited
17 copied
6 moved

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/exp/expbox.m

    r6661 r13010  
    11function expbox(filename)
    2 %EXPBOX - Create a ARGUS file using to clicks
     2%EXPBOX - Create an ARGUS file using two clicks
    33%
    44%   Two clicks on a plot are used to generate a rectangular box
  • issm/trunk-jpl/src/m/exp/expcircle.m

    r12997 r13010  
    1 function expcreatecircle(filename,x0,y0,radius,numberofnodes)
    2 %EXPCREATECIRCLE - create a circular contour corresponding to given parameters
     1function expcircle(filename,x0,y0,radius,numberofnodes)
     2%EXPCIRCLE - create a circular contour corresponding to given parameters
    33%
    44%   Creates a closed argus contour centered on x,y of radius size.
     
    66%
    77%   Usage:
    8 %      expcreatecircle(filename,x0,y0,radius,numberofnodes)
     8%      expcircle(filename,x0,y0,radius,numberofnodes)
    99%
    1010%   See also EXPMASTER, EXPDOC
  • issm/trunk-jpl/src/m/exp/expcreatecontour.m

    r1 r13010  
    1616%Get contour
    1717disp('Click on contour points you desire. Type RETURN to end input of points');
    18 [x,y]=ginputquick;
     18[x,y]=ginput();
    1919
    2020%close contour
  • issm/trunk-jpl/src/m/exp/expcreateprofile.m

    r1 r13010  
    1616%Get profile
    1717disp('Click on profile points you desire. Type RETURN to end input of points');
    18 [x,y]=ginputquick;
     18[x,y]=ginput();
    1919
    2020%plot contour
  • issm/trunk-jpl/src/m/exp/expexcludeoutliers.m

    r7636 r13010  
    11function excludeoutliers(newcontourname,contourname,domainname)
    2 %EXCLUDEOUTLIERS exclude points of contour that are not within the domain  contour. return new contours in a different file.
     2%EXCLUDEOUTLIERS - exclude points of contour that are not within the domain
     3%contour. return new contours in a different file.
    34%
    45%        Usage: excludeoutliers('NewContour.exp','Contour.exp','DomainOutline.exp');
  • issm/trunk-jpl/src/m/exp/explink.m

    r1 r13010  
    2727        end
    2828end
    29 
  • issm/trunk-jpl/src/m/exp/expsquare.m

    r6661 r13010  
    1 function expbox(filename)
     1function expsquare(filename)
    22%EXPBOX - Create a ARGUS file using to clicks
    33%
    4 %   Two clicks on a plot are used to generate a rectangular box
     4%   Two clicks on a plot are used to generate a square box
    55%   This box is written in EXP format on filename
    66%
     
    1818
    1919%Get points
    20 disp('Click twice to define a rectangular domain. First click for upper left corner, second for lower right corner');
     20disp('Click twice to define a square domain. First click for upper left corner, second for lower right corner');
    2121[x,y]=ginput(2);
    2222
  • issm/trunk-jpl/src/m/exp/expwrite.m

    r12997 r13010  
    1717fid=fopen(filename,'w');
    1818for n=1:length(a),
     19        if(length(contours(n).x)~=length(contours(n).y)),
     20                error('contours x and y coordinates must be of identical size');
     21        end
    1922   
    2023   if isfield(a,'name'),
  • issm/trunk-jpl/src/m/geometry/SegIntersect.m

    r4785 r13010  
    7777        bool=0;
    7878        return;
    79 
    8079end
    81 
  • issm/trunk-jpl/src/m/interp/InterpFromFile.m

    r9734 r13010  
    4343        data_out=InterpFromMeshToMesh2d(Data.(Names.indexname),Data.(Names.xname),Data.(Names.yname),Data.(Names.dataname),x,y);
    4444end
     45
     46end
     47function Names=FieldFindVarNames(filename)
     48%FIELDFINDVARNAMES - find names of variables in a data set file
     49%
     50%   This routines looks at the variables contained in a file and finds out
     51%   the names of the variables that are needed for an interpolation (x,y,data)
     52%   or (index,x,y,data)
     53%
     54%   Usage:
     55%      Names=FieldFindVarNames(filename)
     56%
     57%   Example:
     58%      Names=FieldFindVarNames('thickness.mat')
     59%
     60%   See also: INTERPFROMFILE, GRIDDATA
     61
     62%some checks
     63if nargin~=1 | nargout~=1
     64        help FieldFindVarNames
     65        error('FieldFindVarNames error message: bad usage');
     66end
     67if ~exist(filename)
     68        error(['FieldFindVarNames error message: file ' filename  ' does not exist']);
     69end
     70
     71%Get variables
     72A=whos('-file',filename);
     73
     74%find x,y,vx and vy
     75xenum=NaN; yenum=NaN; dataenum=NaN; indexenum=NaN;
     76if length(A)==3,
     77        isnode=1;
     78        for i=1:3
     79                if strcmpi(A(i).name(1),'x');
     80                        xenum=i;
     81                elseif strcmpi(A(i).name(1),'y');
     82                        yenum=i;
     83                elseif (strncmpi(A(i).name,filename,3) | strncmpi(A(i).name,'data',4)),
     84                        dataenum=i;
     85                else
     86                        %nothing
     87                end
     88        end
     89elseif length(A)==4,
     90        isnode=0;
     91        for i=1:4
     92                if strcmpi(A(i).name(1),'x');
     93                        xenum=i;
     94                elseif strcmpi(A(i).name(1),'y');
     95                        yenum=i;
     96                elseif (strncmpi(A(i).name,'index',5) | strncmpi(A(i).name,'elements',7));
     97                        indexenum=i;
     98                elseif (strncmpi(A(i).name,filename,3) | strncmpi(A(i).name,'data',4)),
     99                        dataenum=i;
     100                else
     101                        %nothing
     102                end
     103        end
     104else
     105        error(['FieldFindVarNames error message: file ' filename  ' not supported yet (it should hold 3 variables x,y and data (for nodes) OR 4 variables  x,y,index and data (for mesh))']);
     106end
     107
     108%2: if only one item is missing, find it by elimination
     109if ~isnode,
     110        pos=find(isnan([xenum yenum indexenum dataenum]));
     111        if length(pos)==1,
     112                list=[xenum yenum indexenum dataenum]; list(pos)=[];
     113                if pos==1,
     114                        xenum=setdiff(1:4,list);
     115                elseif pos==2,
     116                        yenum=setdiff(1:4,list);
     117                elseif pos==3,
     118                        indexenum=setdiff(1:4,list);
     119                elseif pos==4,
     120                        dataenum=setdiff(1:4,list);
     121                end
     122        end
     123else
     124        pos=find(isnan([xenum yenum dataenum]));
     125        if length(pos)==1,
     126                list=[xenum yenum indexenum dataenum]; list(pos)=[];
     127                if pos==1,
     128                        xenum=setdiff(1:3,list);
     129                elseif pos==2,
     130                        yenum=setdiff(1:3,list);
     131                elseif pos==3,
     132                        dataenum=setdiff(1:3,list);
     133                end
     134        end
     135end
     136
     137%assum that we have found at least xenum and yenum
     138if ( isnan(xenum) | isnan(yenum))
     139        error(['FieldFindVarNames error message: file ' filename  ' not supported yet (the coordinates vectors should be named x and y)']);
     140end
     141
     142%find index
     143if (~isnode & isnan(indexenum)),
     144        for i=1:4
     145                lengthi=min(A(i).size);
     146                if (lengthi==3),
     147                        indexenum=i;
     148                end
     149        end
     150        if isnan(indexenum),
     151                error(['FieldFindVarNames error message: file ' filename  ' not supported yet (index not found)']);
     152        end
     153end
     154
     155%4: last chance
     156if ~isnode,
     157        pos=find(isnan([xenum yenum indexenum dataenum]));
     158        if length(pos)==1,
     159                list=[xenum yenum indexenum dataenum]; list(pos)=[];
     160                if pos==1,
     161                        xenum=setdiff(1:4,list);
     162                elseif pos==2,
     163                        yenum=setdiff(1:4,list);
     164                elseif pos==3,
     165                        indexenum=setdiff(1:4,list);
     166                elseif pos==4,
     167                        dataenum=setdiff(1:4,list);
     168                end
     169        end
     170else
     171        pos=find(isnan([xenum yenum dataenum]));
     172        if length(pos)==1,
     173                list=[xenum yenum indexenum dataenum]; list(pos)=[];
     174                if pos==1,
     175                        xenum=setdiff(1:3,list);
     176                elseif pos==2,
     177                        yenum=setdiff(1:3,list);
     178                elseif pos==3,
     179                        dataenum=setdiff(1:3,list);
     180                end
     181        end
     182end
     183
     184%last check
     185if isnan(dataenum)
     186        error(['FieldFindVarNames error message: file ' filename  ' not supported yet (data not found)']);
     187end
     188
     189%create output
     190Names=struct();
     191Names.xname=A(xenum).name;
     192Names.yname=A(yenum).name;
     193Names.dataname=A(dataenum).name;
     194if ~isnode,
     195        Names.indexname=A(indexenum).name;
     196        Names.interp='mesh';
     197else
     198        Names.interp='node';
     199end
     200end
  • issm/trunk-jpl/src/m/interp/plugvelocities.m

    r10165 r13010  
    1414%   See also: INTERPFROMFILE, GRIDDATA
    1515
     16disp('WARNING: deprecated functions (plugvelocities)');
    1617%some checks
    1718if nargin~=3 | nargout~=1
     
    4041md.initialization.vy=md.inversion.vy_obs;
    4142md.initialization.vel=md.inversion.vel_obs;
     43end
     44
     45function Names=VelFindVarNames(filename)
     46%VELFINDVARNAMES - find names of variables in a velocity data set file
     47%
     48%   This routines looks at the variables contained in a file and finds out
     49%   the names of the variables that are needed for an interpolation (x,y,vx,vy)
     50%   or (index,x,y,vx,vy)
     51%
     52%   Usage:
     53%      Names=VelFindVarNames(filename)
     54%
     55%   Example:
     56%      Names=VelFindVarNames('velocities.mat')
     57%
     58%   See also: INTERPFROMFILE, GRIDDATA
     59
     60%some checks
     61if nargin~=1 | nargout~=1
     62        help VelFindVarNames
     63        error('VelFindVarNames error message: bad usage');
     64end
     65if ~exist(filename)
     66        error(['VelFindVarNames error message: file ' filename  ' does not exist']);
     67end
     68
     69%Get variables
     70A=whos('-file',filename);
     71
     72%find x,y,vx and vy
     73xenum=NaN; yenum=NaN; vxenum=NaN; vyenum=NaN; indexenum=NaN;
     74if length(A)==4,
     75        isnode=1;
     76        for i=1:4
     77                if strcmpi(A(i).name(1),'x');
     78                        xenum=i;
     79                elseif strcmpi(A(i).name(1),'y');
     80                        yenum=i;
     81                else
     82                        if (strcmpi(A(i).name(end),'x') | strncmpi(A(i).name,'vx',2));
     83                                vxenum=i;
     84                        elseif (strcmpi(A(i).name(end),'y') | strncmpi(A(i).name,'vy',2));
     85                                vyenum=i;
     86                        end
     87                end
     88        end
     89elseif length(A)==5,
     90        isnode=0;
     91        for i=1:5
     92                if strcmpi(A(i).name(1),'x');
     93                        xenum=i;
     94                elseif strcmpi(A(i).name(1),'y');
     95                        yenum=i;
     96                elseif (strcmpi(A(i).name(1),'index') | strcmpi(A(i).name(1),'elements'));
     97                        indexenum=i;
     98                else
     99                        if (strcmpi(A(i).name(end),'x') | strncmpi(A(i).name,'vx',2));
     100                                vxenum=i;
     101                        elseif (strcmpi(A(i).name(end),'y') | strncmpi(A(i).name,'vy',2));
     102                                vyenum=i;
     103                        end
     104                end
     105        end
     106else
     107        error(['VelFindVarNames error message: file ' filename  ' not supported yet (it should hold 4 variables x,y,vx and vy (for nodes) OR 5 variables  x,y,index,vx and vy (for mesh))']);
     108end
     109
     110%assum that we have found at least vxenum and vyenum
     111if ( isnan(vxenum) | isnan(vyenum))
     112        error(['VelFindVarNames error message: file ' filename  ' not supported yet (the velocities should be named vx and vy)']);
     113end
     114
     115%find index
     116if (~isnode & isnan(indexenum)),
     117        for i=1:5
     118                lengthi=min(A(i).size);
     119                if (lengthi==3),
     120                        indexenum=i;
     121                end
     122        end
     123        if isnan(indexenum),
     124                error(['VelFindVarNames error message: file ' filename  ' not supported yet (index not found)']);
     125        end
     126end
     127
     128%find x y
     129if (isnan(xenum) | isnan(yenum))
     130
     131        %check the size
     132        if A(vxenum).size(1)==A(vxenum).size(2),
     133                error(['VelFindVarNames error message: file ' filename  ' not supported (velocities is a square matrix, save x and y with another name)']);
     134        end
     135        if ~(A(vxenum).size(1)==A(vyenum).size(1) & A(vxenum).size(2)==A(vyenum).size(2)),
     136                error(['VelFindVarNames error message: file ' filename  ' not supported (vx and vy matrices do not have the same size)']);
     137        end
     138
     139        %find xenum and yenum
     140        for i=1:4
     141                lengthi=max(A(i).size);
     142                if ((i~=vxenum) & (lengthi==A(vxenum).size(1) | lengthi==A(vxenum).size(1)+1)),
     143                        yenum=i;
     144                elseif ((i~=vxenum) & (lengthi==A(vxenum).size(2) | lengthi==A(vxenum).size(2)+1)),
     145                        xenum=i;
     146                end
     147        end
     148
     149        %last check
     150        if (isnan(xenum) | isnan(yenum))
     151                error(['plugdata error message: file ' filename  ' not supported yet']);
     152        end
     153end
     154
     155%create output
     156Names=struct();
     157Names.xname=A(xenum).name;
     158Names.yname=A(yenum).name;
     159Names.vxname=A(vxenum).name;
     160Names.vyname=A(vyenum).name;
     161if ~isnode,
     162        Names.indexname=A(indexenum).name;
     163        Names.interp='mesh';
     164else
     165        Names.interp='node';
     166end
  • issm/trunk-jpl/src/m/mesh/roundmesh.m

    r11011 r13010  
    2020y_list=radius*y_list.*sin(theta);
    2121A=struct('x',x_list,'y',y_list,'density',1);
    22 expgen('RoundDomainOutline.exp',A,1);
     22expwrite('RoundDomainOutline.exp',A);
    2323
    2424%Call Bamg
  • issm/trunk-jpl/src/m/regional/isbasin.m

    r12997 r13010  
    77%
    88
    9 
    109%First, load basin names:
    1110load([jplsvn '/projects/ModelData/Names/Names.mat']);
    12 
    1311
    1412%go through names:
Note: See TracChangeset for help on using the changeset viewer.