libIMP.pl
changeset 46 70e566505a12
parent 41 fa41b3a72c97
child 52 cab17f0c5e88
equal deleted inserted replaced
45:90f620beec6b 46:70e566505a12
     1 #======================================================================
     1 #======================================================================
     2 #                    L I B I M P . P L 
     2 #                    L I B I M P . P L 
     3 #                    doc: Tue Nov 26 21:59:40 2013
     3 #                    doc: Tue Nov 26 21:59:40 2013
     4 #                    dlm: Tue Apr 14 17:23:47 2020
     4 #                    dlm: Sat Jul 24 09:37:27 2021
     5 #                    (c) 2017 A.M. Thurnherr
     5 #                    (c) 2017 A.M. Thurnherr
     6 #                    uE-Info: 736 58 NIL 0 0 72 0 2 4 NIL ofnI
     6 #                    uE-Info: 70 13 NIL 0 0 72 0 2 4 NIL ofnI
     7 #======================================================================
     7 #======================================================================
     8 
     8 
     9 # HISTORY:
     9 # HISTORY:
    10 #	Nov 26, 2013: - created
    10 #	Nov 26, 2013: - created
    11 #	Dec  1, 2013: - removed HDG_ROT
    11 #	Dec  1, 2013: - removed HDG_ROT
    63 #	Apr 12, 2020: - modified rot_vecs to pass all records with non-numerical elapsed 
    63 #	Apr 12, 2020: - modified rot_vecs to pass all records with non-numerical elapsed 
    64 #	Apr 13, 2020: - added prep_piro_ADCP
    64 #	Apr 13, 2020: - added prep_piro_ADCP
    65 #				  - BUG: dhist_binsize != 1 did not work
    65 #				  - BUG: dhist_binsize != 1 did not work
    66 #				  - BUG: dhist agreement % was not rounded
    66 #				  - BUG: dhist agreement % was not rounded
    67 #	Apr 14, 2020: - cosmetics
    67 #	Apr 14, 2020: - cosmetics
       
    68 #	Jul 12, 2021: - improvements to histogram plot
       
    69 #	Jul 24, 2021: - updated docu
       
    70 # HISTORY END
    68 
    71 
    69 #----------------------------------------------------------------------
    72 #----------------------------------------------------------------------
    70 # gRef() library
    73 # gRef() library
    71 #----------------------------------------------------------------------
    74 #----------------------------------------------------------------------
    72 
    75 
   456 	my($dhist_binsize,$modefrac,@dhist) = @_;
   459 	my($dhist_binsize,$modefrac,@dhist) = @_;
   457 	
   460 	
   458 	my($plotsize) = '13c';
   461 	my($plotsize) = '13c';
   459 	my($xmin,$xmax) = (-180.5,180.5);
   462 	my($xmin,$xmax) = (-180.5,180.5);
   460 	my($ymin) = 0;
   463 	my($ymin) = 0;
   461 	my($ymax) = 1.05 * $dhist[$HDG_offset/$dhist_binsize];
   464 	my($ymax) = 0;
       
   465 
       
   466 	for (my($i)=0; $i<@dhist; $i++) {
       
   467 		$ymax = $dhist[$i] if ($dhist[$i] > $ymax);
       
   468     }
       
   469 	$ymax = 1.05 * $ymax;
   462 	    
   470 	    
   463 	GMT_begin("$P{profile_id}${opt_a}_hdg_offset.ps","-JX${plotsize}","-R$xmin/$xmax/$ymin/$ymax",'-X6 -Y4 -P');
   471 	GMT_begin("$P{profile_id}${opt_a}_hdg_offset.ps","-JX${plotsize}","-R$xmin/$xmax/$ymin/$ymax",'-X6 -Y4 -P');
       
   472 	if (defined($opt_o)) {
       
   473 		GMT_psxy("-W2,red");
       
   474 		printf(GMT "%f %f\n%f %f\n",$opt_o,0,$opt_o,$ymax);
       
   475     }
   464 	GMT_psxy("-Sb${dhist_binsize}u -GCornFlowerBlue");
   476 	GMT_psxy("-Sb${dhist_binsize}u -GCornFlowerBlue");
   465 	for (my($i)=0; $i<@dhist; $i++) {
   477 	for (my($i)=0; $i<@dhist; $i++) {
   466 		next unless $dhist[$i];
   478 		next unless $dhist[$i];
   467 		printf(GMT "%f $dhist[$i]\n",$i*$dhist_binsize>180 ? $i*$dhist_binsize-360 : $i*$dhist_binsize);
   479 		printf(GMT "%f $dhist[$i]\n",$i*$dhist_binsize>180 ? $i*$dhist_binsize-360 : $i*$dhist_binsize);
   468 	}
   480 	}