plot_wprof.pl
changeset 46 cc6c4309828a
parent 45 6d49c7420a6c
child 47 2ccb81b7cea5
equal deleted inserted replaced
45:6d49c7420a6c 46:cc6c4309828a
     1 #======================================================================
     1 #======================================================================
     2 #                    P L O T _ W P R O F . P L 
     2 #                    P L O T _ W P R O F . P L 
     3 #                    doc: Sun Jul 26 11:08:50 2015
     3 #                    doc: Sun Jul 26 11:08:50 2015
     4 #                    dlm: Thu May 19 01:00:27 2016
     4 #                    dlm: Tue May 24 22:31:14 2016
     5 #                    (c) 2015 A.M. Thurnherr
     5 #                    (c) 2015 A.M. Thurnherr
     6 #                    uE-Info: 76 36 NIL 0 0 72 2 2 4 NIL ofnI
     6 #                    uE-Info: 19 51 NIL 0 0 72 2 2 4 NIL ofnI
     7 #======================================================================
     7 #======================================================================
     8 
     8 
     9 # HISTORY:
     9 # HISTORY:
    10 #	Jul 26, 2015: - created from LWplot_prof_2beam
    10 #	Jul 26, 2015: - created from LWplot_prof_2beam
    11 #	Jul 30, 2015: - moved main label outside plot area
    11 #	Jul 30, 2015: - moved main label outside plot area
    12 #	Oct 12, 2015: - BUG: gaps were not plotted as such
    12 #	Oct 12, 2015: - BUG: gaps were not plotted as such
    13 #	Mar 16, 2016: - adapted to gmt5
    13 #	Mar 16, 2016: - adapted to gmt5
    14 #	Mar 17, 2016: - improved
    14 #	Mar 17, 2016: - improved
    15 #	May 18, 2016: - replaced rms tilt by mean tilt with traffic background
    15 #	May 18, 2016: - replaced rms tilt by mean tilt with traffic background
    16 #				  - added plot_wprof_ymin tweakable
    16 #				  - added plot_wprof_ymin tweakable
       
    17 #	May 24, 2016: - BUG: ymin did not work for nsamp
       
    18 #				  - fixed for partial-depth profiles
       
    19 #				  - suppress plotting of nsamp == 0
    17 
    20 
    18 # Tweakables:
    21 # Tweakables:
    19 #
    22 #
    20 # $plot_wprof_xmin = -0.27;
    23 # $plot_wprof_xmin = -0.27;
    21 # $plot_wprof_ymin = 3600;
    24 # $plot_wprof_ymin = 3600;
    23 # $plot_wprof_xtics = "-0.25 -0.15 -0.05 0.05";
    26 # $plot_wprof_xtics = "-0.25 -0.15 -0.05 0.05";
    24 
    27 
    25 require "$ANTS/libGMT.pl";
    28 require "$ANTS/libGMT.pl";
    26 
    29 
    27 sub setR1() { GMT_setR("-R$plot_wprof_xmin/0.35/$plot_wprof_ymin/$plot_wprof_ymax"); }
    30 sub setR1() { GMT_setR("-R$plot_wprof_xmin/0.35/$plot_wprof_ymin/$plot_wprof_ymax"); }
    28 #sub setR2() { GMT_setR("-R-200/200/0/$plot_wprof_ymax"); }
    31 sub setR2() { GMT_setR("-R-450/350/$plot_wprof_ymin/$plot_wprof_ymax"); }
    29 sub setR2() { GMT_setR("-R-450/350/0/$plot_wprof_ymax"); }
       
    30 
    32 
    31 sub plotDC($$)
    33 sub plotDC($$)
    32 {
    34 {
    33 	my($f,$minsamp) = @_;
    35 	my($f,$minsamp) = @_;
    34 	for (my($bi)=0; $bi<=$#{$DNCAST{$f}}; $bi++) {
    36 	for (my($bi)=0; $bi<=$#{$DNCAST{$f}}; $bi++) {
    70 {
    72 {
    71 	my($pfn) = @_;
    73 	my($pfn) = @_;
    72 
    74 
    73 	$plot_wprof_xmin = -0.1
    75 	$plot_wprof_xmin = -0.1
    74 		unless defined($plot_wprof_xmin);		
    76 		unless defined($plot_wprof_xmin);		
    75 	$plot_wprof_ymin = 0
    77 	$plot_wprof_ymin = round(antsParam('min_depth')-25,50)
    76 		unless defined($plot_wprof_ymin);		
    78 		unless defined($plot_wprof_ymin);		
    77 	$plot_wprof_ymax = ($P{water_depth} > 0) ?
    79 	$plot_wprof_ymax = ($P{water_depth} > 0) ?
    78 					   round($P{water_depth} + 25) :
    80 					   round($P{water_depth}+25,50) :
    79 					   round($P{max_depth} 	 + 25)
    81 					   round($P{max_depth}+25,50)
    80 		unless defined($plot_wprof_ymax);					  	
    82 		unless defined($plot_wprof_ymax);					  	
    81 	$plot_wprof_xtics = "-0.05 0.05 0.15"
    83 	$plot_wprof_xtics = "-0.05 0.05 0.15"
    82 		unless defined($plot_wprof_xtics);
    84 		unless defined($plot_wprof_xtics);
    83 
    85 
    84 	GMT_begin($pfn,'-JX10/-10',"-R$plot_wprof_xmin/0.35/0/$plot_wprof_ymax",'-P');		# START PLOT
    86 	GMT_begin($pfn,'-JX10/-10',"-R$plot_wprof_xmin/0.35/$plot_wprof_ymin/$plot_wprof_ymax",'-P');		# START PLOT
    85 
    87 
    86 	GMT_psxy('-G200'); 																	# MAD background
    88 	GMT_psxy('-G200'); 																	# MAD background
    87 		print(GMT "0.07 0\n 0.07 $plot_wprof_ymax\n0.18 $plot_wprof_ymax\n0.18 0\n");
    89 		print(GMT "0.07 $plot_wprof_ymin\n 0.07 $plot_wprof_ymax\n0.18 $plot_wprof_ymax\n0.18 $plot_wprof_ymin\n");
    88 
    90 
    89 	if ($P{water_depth} > 0) {															# SEABED
    91 	if ($P{water_depth} > 0) {															# SEABED
    90 		GMT_psxy('-G204/153/102');
    92 		GMT_psxy('-G204/153/102');
    91 		print(GMT "$plot_wprof_xmin $plot_wprof_ymax\n0.35 $plot_wprof_ymax\n0.35 $P{water_depth}\n $plot_wprof_xmin $P{water_depth}\n");
    93 		print(GMT "$plot_wprof_xmin $plot_wprof_ymax\n0.35 $plot_wprof_ymax\n0.35 $P{water_depth}\n $plot_wprof_xmin $P{water_depth}\n");
    92 	}
    94 	}
   110 	GMT_psxy('-Sc0.1c -Gcoral');		plotDC('MAD_W',0);								# MEAN ABSOLUTE DEVIATIONS
   112 	GMT_psxy('-Sc0.1c -Gcoral');		plotDC('MAD_W',0);								# MEAN ABSOLUTE DEVIATIONS
   111 	GMT_psxy('-Sc0.1c -GSeaGreen');		plotUC('MAD_W',0);	
   113 	GMT_psxy('-Sc0.1c -GSeaGreen');		plotUC('MAD_W',0);	
   112 	GMT_psxy('-Sc0.1c -Gblack');		plotBT('MAD_W',0);	
   114 	GMT_psxy('-Sc0.1c -Gblack');		plotBT('MAD_W',0);	
   113 
   115 
   114 	setR2();																			# SAMPLES
   116 	setR2();																			# SAMPLES
   115 	GMT_psxy('-W0.7,coral');			plotDC('N_SAMP',0);
   117 	GMT_psxy('-W0.7,coral');			plotDC('N_SAMP',1);
   116 	GMT_psxy('-W0.7,SeaGreen');			plotUC('N_SAMP',0);	
   118 	GMT_psxy('-W0.7,SeaGreen');			plotUC('N_SAMP',1);	
   117 	GMT_psxy('-W0.7,black');			plotBT('N_SAMP',0);	
   119 	GMT_psxy('-W0.7,black');			plotBT('N_SAMP',1);	
   118 	
   120 	
   119 	GMT_unitcoords();																	# LABELS
   121 	GMT_unitcoords();																	# LABELS
   120 	GMT_pstext('-F+f14,Helvetica,blue+jTL -N');
   122 	GMT_pstext('-F+f14,Helvetica,blue+jTL -N');
   121 		print(GMT "0.01 -0.06 $P{out_basename} [$P{run_label}]\n");
   123 		print(GMT "0.01 -0.06 $P{out_basename} [$P{run_label}]\n");
   122 	GMT_pstext('-F+f12,Helvetica+jBR');
   124 	GMT_pstext('-F+f12,Helvetica+jBR');
   171 	} else {
   173 	} else {
   172 		GMT_pstext('-F+f9,Helvetica,SeaGreen+jTL -Gyellow -N');
   174 		GMT_pstext('-F+f9,Helvetica,SeaGreen+jTL -Gyellow -N');
   173 	}
   175 	}
   174 		printf(GMT "0.89 1.125 %.1fm\@+2\@+/s\n",$P{uc_rms_accel_pkg});
   176 		printf(GMT "0.89 1.125 %.1fm\@+2\@+/s\n",$P{uc_rms_accel_pkg});
   175 		
   177 		
   176 	my($depth_tics) = ($plot_wprof_ymax < 1000 ) ? 'f10a100' : 'f100a500';				# AXES
   178 	my($depth_tics) = ($plot_wprof_ymax-$plot_prof_ymin < 1000 ) ? 'f10a100' : 'f100a500';				# AXES
   177 	setR1();
   179 	setR1();
   178 	GMT_psbasemap("-Bf0.01:'':/$depth_tics:'Depth [m]':WeS");
   180 	GMT_psbasemap("-Bf0.01:'':/$depth_tics:'Depth [m]':WeS");
   179 	foreach my $t (split('\s+',$plot_wprof_xtics)) {
   181 	foreach my $t (split('\s+',$plot_wprof_xtics)) {
   180 		GMT_psbasemap(sprintf('-Ba10-%fS',10-$t));
   182 		GMT_psbasemap(sprintf('-Ba10-%fS',10-$t));
   181 	}
   183 	}