Home > atmlab > geoplots > gmt > psscale.m

psscale

PURPOSE ^

PSSCALE Appends options to GMT psscale

SYNOPSIS ^

function command = psscale(file,in)

DESCRIPTION ^

 PSSCALE Appends options to GMT psscale

 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: psscale.m 8453 2013-05-27 19:06:41Z seliasson $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

psscale.m

SOURCE CODE ^

0001 function command = psscale(file,in)
0002 % PSSCALE Appends options to GMT psscale
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: psscale.m 8453 2013-05-27 19:06:41Z seliasson $
0013 
0014 assert(isfield(in,'cptfile'),['gmtlab:' mfilename ':badInput'],'needs in.cptfile')
0015 
0016 psscale = sprintf('psscale');
0017 if isfield(in,'position')
0018     psscale = sprintf('%s -D%s',psscale,in.position);
0019 else
0020     psscale = sprintf('%s -D%s/%s/%s/%s%s',...
0021         psscale,num2str(in.xpos),num2str(in.ypos),num2str(in.length),num2str(in.width),...
0022         in.orientation);
0023     
0024     %may only append 'h'
0025     if strcmp(in.orientation,'v'), psscale = psscale(1:end-1); end 
0026 end
0027 
0028 if ( isfield(in,'tick_annotations') && ~isempty(in.tick_annotations) ) || ...
0029         ( isfield(in,'equalboxwidth') && in.equalboxwidth ) || ...
0030         any(isfield(in,{'box_spacing','tick_centering'}))
0031     
0032     psscale = sprintf('%s -L',psscale);
0033     
0034     if isfield(in,'box_spacing')
0035         % tickspacing (annotation every xth contour), unit (dispay with legend)
0036         psscale = sprintf('%s%g',psscale,in.box_spacing);
0037     end
0038     if isfield(in,'tick_centering')
0039         psscale = sprintf('%si',psscale);
0040     end
0041 end
0042 
0043 psscale = sprintf('%s %s',psscale,in.plotPlacement);
0044 
0045 % selects Overlay plot mode and assume more pscode will be appended later
0046 psscale = sprintf('%s -O -K',psscale);
0047 
0048 if in.sidebar %i.e the triangles bellow the min and above the max values
0049     switch in.sidebar
0050         case 1
0051             str = '-Eb';
0052         case 2
0053             str = '-Ef';
0054         case 3
0055             str = '-E';
0056         otherwise
0057             error(['gmtlab:' mfilename ':input'],...
0058                 'error in determining sidebar')
0059     end
0060     psscale = sprintf('%s %s',psscale,str);
0061 end
0062 
0063 if isfield(in,'tick_spacing')
0064     psscale = sprintf('%s -B%g:"%s":/:"%s":',psscale,in.tick_spacing,in.xunit,in.unit);
0065 else
0066     psscale = sprintf('%s -B:"%s":/:"%s":',psscale,in.xunit,in.unit);
0067 end
0068 
0069 psscale = sprintf('%s -C%s',psscale,in.cptfile);
0070 
0071 if isfield(in,'shift_tick_annotations')
0072     psscale = sprintf('%s --ANNOT_OFFSET_PRIMARY=%s',psscale,in.shift_tick_annotations);
0073 end
0074 
0075 if isfield(in,'font_size')
0076     psscale = sprintf('%s --ANNOT_FONT_SIZE_PRIMARY=%s',psscale,num2str(in.font_size));
0077 end
0078 
0079 if isfield(in,'tick_length')
0080     psscale = sprintf('%s --TICK_LENGTH %s',psscale,num2str(in.tick_length));
0081 end
0082 if isfield(in,'tick_annotation_format')
0083     psscale = sprintf('%s --D_FORMAT=%s',psscale,in.tick_annotation_format);
0084 end
0085 
0086 command = sprintf('%s >> %s.ps',psscale,file);

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