plot_residuals34.pl
changeset 47 2ccb81b7cea5
child 53 b4374f1ebd60
equal deleted inserted replaced
46:cc6c4309828a 47:2ccb81b7cea5
       
     1 #======================================================================
       
     2 #                    P L O T _ R E S I D U A L S 3 4 . P L 
       
     3 #                    doc: Wed Jun  1 19:05:22 2016
       
     4 #                    dlm: Wed Jun  1 19:35:58 2016
       
     5 #                    (c) 2016 A.M. Thurnherr
       
     6 #                    uE-Info: 82 67 NIL 0 0 72 0 2 4 NIL ofnI
       
     7 #======================================================================
       
     8 
       
     9 # HISTORY:
       
    10 #	Jun  1, 2016: - created from [plot_residuals.pl]
       
    11 
       
    12 require "$ANTS/libGMT.pl";
       
    13 
       
    14 sub plot_residuals34($)
       
    15 {
       
    16 	my($pfn) = @_;
       
    17 
       
    18 	return unless ($P{max_depth});
       
    19 
       
    20 	my($xmin) = $P{min_ens}-0.5;
       
    21 	my($xmax) = $P{max_ens}+0.5;
       
    22 	my($ymin) = round(antsParam('min_depth')-25,50);
       
    23 	my($ymax) = ($P{water_depth} > 0) ?
       
    24 				round($P{water_depth}+25,50) :
       
    25 				round($P{max_depth}+$P{ADCP_bin_length}+25,50);
       
    26 
       
    27 	my($ens_width) = 10 / ($P{max_ens} - $P{min_ens} + 1);
       
    28 	my($bin_length) = 10 * $P{ADCP_bin_length} / 
       
    29 						($P{max_depth}-$P{min_depth}+$P{ADCP_bin_length});
       
    30 
       
    31 	my($R) = "-R$xmin/$xmax/$ymin/$ymax";
       
    32 	GMT_begin($pfn,'-JX10/-10',$R,'-P');
       
    33 
       
    34 	my($C) = "-C$WCALC/residuals.cpt";
       
    35 	GMT_psxy("$C -Sr");
       
    36 		for ($ens=$firstGoodEns; $ens<$LADCP_atbottom; $ens++) {						# downcast
       
    37 		  next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
       
    38 		  my(@bindepth) = binDepths($ens);
       
    39 		  for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
       
    40 			  next unless ($bin+1>=$outGrid_firstBin && $bin+1<=$outGrid_lastBin);
       
    41 			  next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]);
       
    42 			  next unless numberp($LADCP{ENSEMBLE}[$ens]->{W34}[$bin]);
       
    43 			  my($bi) = $bindepth[$bin]/$opt_o;
       
    44 			  printf(GMT "%d %f %f $ens_width $bin_length\n",
       
    45 				$LADCP{ENSEMBLE}[$ens]->{NUMBER},
       
    46 				$bindepth[$bin],
       
    47 				$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin] - $DNCAST{MEDIAN_W}[$bi]);
       
    48           }
       
    49         }
       
    50 		for ($ens=$LADCP_atbottom; $ens<=$lastGoodEns; $ens++) {					  # upcast 
       
    51 		  next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
       
    52 		  my(@bindepth) = binDepths($ens);
       
    53 		  for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
       
    54 			  next unless ($bin+1>=$outGrid_firstBin && $bin+1<=$outGrid_lastBin);
       
    55 			  next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]);
       
    56 			  next unless numberp($LADCP{ENSEMBLE}[$ens]->{W34}[$bin]);
       
    57 			  my($bi) = $bindepth[$bin]/$opt_o;
       
    58 			  printf(GMT "%d %f %f $ens_width $bin_length\n",
       
    59 				$LADCP{ENSEMBLE}[$ens]->{NUMBER},
       
    60 				$bindepth[$bin],
       
    61 				$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W34}[$bin] - $UPCAST{MEDIAN_W}[$bi]);
       
    62           }
       
    63         }
       
    64 
       
    65 	if ($P{water_depth} > 0) {															# SEABED
       
    66 		GMT_psxy('-G204/153/102');
       
    67 		print(GMT "$xmin $ymax\n$xmax $ymax\n$xmax $P{water_depth}\n $xmin $P{water_depth}\n");
       
    68 	}
       
    69 
       
    70 	GMT_unitcoords();																	# LABELS
       
    71 	GMT_pstext('-F+f9,Helvetica,orange+jTR -N -Gwhite');
       
    72         print(GMT "0.99 0.01 V$VERSION\n");
       
    73 	GMT_pstext('-F+f14,Helvetica,blue+jTL -N');
       
    74 		print(GMT "0.01 -0.06 $P{out_basename} $P{run_label}\n");
       
    75 
       
    76 	my($depth_tics) = ($ymax-$ymin < 1000) ? 'f10a100' : 'f100a500';					# AXES
       
    77 	my($ens_tics) =   ($xmax-$xmin < 4000) ? 'f50a500' : 'f500a2000';
       
    78 	GMT_setR($R);
       
    79 	GMT_psbasemap("-B$ens_tics:'Ensemble [#]':/$depth_tics:'Depth [m]':WeSn");
       
    80 
       
    81 	GMT_setAnnotFontSize(7);															# SCALE BAR
       
    82 	GMT_psscale("-Dn0.83/0.1+w3/0.4+e $C -B/:'w<3,4>\@-residual\@-':");
       
    83 		 
       
    84 	GMT_end();																			# FINISH PLOT
       
    85 }
       
    86 
       
    87 1; # return true on require