C C PPLUS command file from ctdplt C C epic pointer file set ptrfile "8s180.ptr" C variable to plot set var "sal" C x-axis min,max,inc xaxis,34.62000,34.74000,0.2000000E-01 C y-axis variable set yvar "potemp" C y-axis min,max,inc (bottom,top,increment) yaxis,0.6000000,2.200000,0.2000000 C plot metacode filename pltnme,"8s180_ptr.plt" C plot size size,8.,10.5 C plot origin origin,1.5,1.2 C axis length axlen,4.500,8.000 C axis labelling interval (1=every tic) axlint,1,1 C select whether to draw axes top,bottom,left,right (1=draw axis) axset,1,1,1,1 C turn off echo of commands echo,off C select maximum number of lines to overplot per page (limit is 50) set nperpage 50 C loop to select line characteristics set ncnt 1 while ncnt .le. nperpage then set ncnt $integer(ncnt) line,'ncnt',,0 inc ncnt endw C loop to select pens for lines set plist "1;2;3;4;5;6;7" set i 1 set ncnt 1 while ncnt .le. nperpage then set ipen $element('i',";",plist) if ipen .eq. ";" then set ipen $element(1,";",plist) set i 2 else inc i set i $integer(i) endif pen,'ncnt','ipen' set mypen('ncnt') 'ipen' inc ncnt set ncnt $integer(ncnt) endw C maximum number of data files to read from pointer file set imax 1000 C itotal counts total number of lines plotted set itotal 0 C iplot counts the total number of plots made set iplot 0 C set slab of data to extract all points in depth e myslab=[i=1:1,j=1:1,k=*,l=1:1] C open input pointer file e openr "'ptrfile'" C set to first data file e nextr C exit if error reading file if eps$filename .eq. "" then e print "*** error reading input pointer file 'ptrfile', exiting \n" exit endif C loop to read and plot up to imax input data files set iloop 0 while iloop .lt. imax then C window data to axis limits window,on C icnt counts the number of lines plotted on this page set icnt 0 set ncnt 0 C loop to plot up to nperpage lines per page while ncnt .lt. nperpage then C print message e print "reading 'eps$filename' \n" C check if the selected variable is in this file set gvlist "'eps$namelist';'eps$varlist';" set gv $locate("'var';",gvlist) if gv .gt. 0 then set gv $locate("'yvar';",gvlist) endif C if gv > 0 then variable was in the varlist; process this file if gv .gt. 0 then C increment number of lines total inc itotal C increment number of lines on this page inc icnt set icnt $integer(icnt) C assign field e v1='var'[myslab] e y1='yvar'[myslab] C load field into pplus plotting buffer e line(v1,y1) C get the cruise e epsin.CRUISE set cruise $edit(eps$attr,TRIM) C get the cast e epsin.CAST set cast $edit(eps$attr,TRIM) C set the plab label array for the legend set plist "1;2;3;4;5;6;7;8;9;A;B;C;D;E;F" set tmp $element('mypen(icnt)',";",plist) set plaba('icnt') "@P'tmp'@SR 'eps$latitude' 'eps$longitude'" set plabb('icnt') "@P'tmp'@AS 'cruise' 'cast'" else C here, the selected variable was not found in this file; print message e print "*** 'var' or 'yvar' not found in 'eps$filename' \n" endif C set to next input data file e nextr C check if have reached the end of the pointer file if ppl$eof .eq. "YES" then C if at end of file then set loop exit conditions set iloop 'imax' set ncnt 'nperpage' else C increment the loop counters and loop back to process next data file inc iloop set ncnt 'icnt' endif C end of while loop to plot up to nperpage lines per page endw C if any lines were read then plot this page if icnt .gt. 0 then C increment number of plots inc iplot C blank out pplus default title title C open plotting %opnplt:nooverlay C x axis label xlab,'eps$xlabel' C plot the data in the buffer plot C label for main plot title set yloc 'ppl$ylen' + .3 %label:nouser 0,'yloc',-1,0,.16,"@AS8S, 180 historical" C draw the epic date/time labels at upper right set xloc 'ppl$xlen' + 1.5 set yloc 'ppl$ylen' + 1.0 %label:nouser,'xloc','yloc',+1,0,.1,"EPIC: @AS'eps$pointerfile'" set yloc 'yloc' + .15 %label:nouser,'xloc','yloc',+1,0,.1,"'date' 'time'" C draw legend on plot C starting point for legend set xloc 'ppl$xlen' + .25 set yloc 'ppl$ylen' C loop to draw the legend labels set i 0 while i .lt. icnt then inc i set i $integer(i) %label:nouser,'xloc','yloc',-1,0,.08,"'plaba(i)'" set yloc 'yloc' - .15 %label:nouser,'xloc','yloc',-1,0,.08,"'plabb(i)'" set yloc 'yloc' - .2 endw C close plotting for this page %clsplt:wait endif C flush the pplus line buffer nlines C end of while loop to read filenames from pointer file endw C close the pointer file e close epsin C print message and exit set iplot $integer(iplot) set itotal $integer(itotal) e print "total number of lines plotted = 'itotal' (in 'iplot' plot(s)) \n"