Home > atmlab > geoplots > gmt > nearneighbor.m

nearneighbor

PURPOSE ^

NEARNEIGHBOR Appends options to GMT nearneighbor

SYNOPSIS ^

function command = nearneighbor(file,in)

DESCRIPTION ^

 NEARNEIGHBOR Appends options to GMT nearneighbor

 PURPOSE: Appends options to a short script and calls the GMT

 IN    file      %s              .ps-file created/appened to by command
       in        struct          options here (see help gmt_plot)

 OUT   command   %s              string command to be used in system call

 Created by Salomon Eliasson
 $Id: nearneighbor.m 7908 2012-10-07 12:16:39Z seliasson $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

nearneighbor.m

SOURCE CODE ^

0001 function command = nearneighbor(file,in)
0002 % NEARNEIGHBOR Appends options to GMT nearneighbor
0003 %
0004 % PURPOSE: Appends options to a short script and calls the GMT
0005 %
0006 % IN    file      %s              .ps-file created/appened to by command
0007 %       in        struct          options here (see help gmt_plot)
0008 %
0009 % OUT   command   %s              string command to be used in system call
0010 %
0011 % Created by Salomon Eliasson
0012 % $Id: nearneighbor.m 7908 2012-10-07 12:16:39Z seliasson $
0013 
0014 nearneighbor = sprintf('nearneighbor -R');
0015 
0016 nearneighbor = sprintf('%s -bic',nearneighbor); %for binary input
0017 
0018 %location of file
0019 if isfield(in,'ungriddedfile')
0020     nearneighbor = sprintf('%s %s',nearneighbor,in.ungriddedfile);
0021     nearneighbor = sprintf('%s -G%s',nearneighbor,file);
0022 else
0023     error 'needs in.ungriddedfile '
0024 end
0025 
0026 %increment grid
0027 if isfield(in,'increment')
0028     nearneighbor = sprintf('%s -I%s',nearneighbor,in.increment);
0029 end
0030 
0031 %average with adjasent gridpoint GMT default=4
0032 nearneighbor = sprintf('%s -N1/1',nearneighbor);
0033 
0034 %search radius
0035 if isfield(in,'search')
0036     nearneighbor = sprintf('%s -S%s',nearneighbor,in.search);
0037 else
0038     error 'needs in.search'
0039 end
0040 
0041 command = sprintf('%s >> %s.ps',nearneighbor,file(1:end-4));

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005