plot_wprof.pl
changeset 58 7688bec6fe87
parent 55 2d8e1139acd5
child 59 4118a8e880de
equal deleted inserted replaced
55:2d8e1139acd5 58:7688bec6fe87
     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: Tue Mar 23 08:28:12 2021
     4 #                    dlm: Mon Apr 12 08:44:01 2021
     5 #                    (c) 2015 A.M. Thurnherr
     5 #                    (c) 2015 A.M. Thurnherr
     6 #                    uE-Info: 25 39 NIL 0 0 72 0 2 4 NIL ofnI
     6 #                    uE-Info: 26 61 NIL 0 0 72 0 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
    21 #	Mar 20, 2018: - BUG: units of vertical package acceleration were wrong
    21 #	Mar 20, 2018: - BUG: units of vertical package acceleration were wrong
    22 #				  - added blue background for likely in-ice package accelerations
    22 #				  - added blue background for likely in-ice package accelerations
    23 #	May 16, 2020: - added residual profile data to background
    23 #	May 16, 2020: - added residual profile data to background
    24 #	May 23, 2020: - BUG: windows without samples made program bomb
    24 #	May 23, 2020: - BUG: windows without samples made program bomb
    25 #	Mar 23, 2021: - BUG: instrument frequency was rounded to 100kHz
    25 #	Mar 23, 2021: - BUG: instrument frequency was rounded to 100kHz
       
    26 #	Apr 12, 2021: - added documentation on background shading
    26 
    27 
    27 # Tweakables:
    28 # Tweakables:
    28 #
    29 #
    29 # $plot_wprof_xmin = -0.27;
    30 # $plot_wprof_xmin = -0.27;
    30 # $plot_wprof_ymin = 3600;
    31 # $plot_wprof_ymin = 3600;
    71 			print(GMT "nan nan\n");
    72 			print(GMT "nan nan\n");
    72 		}
    73 		}
    73     }
    74     }
    74 }
    75 }
    75 
    76 
       
    77 # plot red \\\\ //// patterns (for dc and uc) in background 
       
    78 #	- based on rms residual (like residual profiles)
       
    79 #	- 100-m-thick layers
       
    80 #	- white (no pattern) for rms residual <= 0.002
       
    81 #	- red (max saturation) for rms residual >= 0.012
       
    82 
    76 sub plotRes()
    83 sub plotRes()
    77 {
    84 {
    78 	my($last_depth,$dc_sumsq_res,$dc_n,$uc_sumsq_res,$uc_n);
    85 	my($last_depth,$dc_sumsq_res,$dc_n,$uc_sumsq_res,$uc_n);
    79 	for (my($bi)=0; $bi<=$#{$DNCAST{MEDIAN_W}}; $bi++) {
    86 	for (my($bi)=0; $bi<=$#{$DNCAST{MEDIAN_W}}; $bi++) {
    80 		my($depth) = ($bi+0.5) * $opt_o;
    87 		my($depth) = ($bi+0.5) * $opt_o;
    81 		if ($depth > $last_depth+100 || $bi == $#{$DNCAST{MEDIAN_W}}) {
    88 		if ($depth > $last_depth+100 || $bi == $#{$DNCAST{MEDIAN_W}}) {
    82 			if ($dc_n==0 || sqrt($dc_sumsq_res/$dc_n) > 0.002) {
    89 			if ($dc_n==0 || sqrt($dc_sumsq_res/$dc_n) > 0.002) {
    83 				my($green) = $dc_n ? round(100*max(0.01-max(sqrt($dc_sumsq_res/$dc_n)-0.002,0),0) * 255) : 0;
    90 				my($lightness) = $dc_n ? round(100*max(0.01-max(sqrt($dc_sumsq_res/$dc_n)-0.002,0),0) * 255) : 0;
    84 				GMT_psxy("-Gp300/12:F255/$green/${green}B-");
    91 				GMT_psxy("-Gp300/12:F255/$lightness/${lightness}B-");
    85 				printf(GMT "%g %g\n%g %g\n%g %g\n%g %g\n",
    92 				printf(GMT "%g %g\n%g %g\n%g %g\n%g %g\n",
    86 								-0.1,$last_depth,0,$last_depth,
    93 								-0.1,$last_depth,0,$last_depth,
    87 								0,$depth,-0.1,$depth);
    94 								0,$depth,-0.1,$depth);
    88 			}
    95 			}
    89 			if ($uc_n==0 || sqrt($uc_sumsq_res/$uc_n) > 0.002) {
    96 			if ($uc_n==0 || sqrt($uc_sumsq_res/$uc_n) > 0.002) {
    90 				my($green) = $uc_n ? round(100*max(0.01-max(sqrt($uc_sumsq_res/$uc_n)-0.002,0),0) * 255) : 0;
    97 				my($lightness) = $uc_n ? round(100*max(0.01-max(sqrt($uc_sumsq_res/$uc_n)-0.002,0),0) * 255) : 0;
    91 				GMT_psxy("-Gp300/9:F255/$green/${green}B-");
    98 				GMT_psxy("-Gp300/9:F255/$lightness/${lightness}B-");
    92 				printf(GMT "%g %g\n%g %g\n%g %g\n%g %g\n",
    99 				printf(GMT "%g %g\n%g %g\n%g %g\n%g %g\n",
    93 								0,$last_depth,0.07,$last_depth,
   100 								0,$last_depth,0.07,$last_depth,
    94 								0.07,$depth,0,$depth);
   101 								0.07,$depth,0,$depth);
    95 			}
   102 			}
    96 			$dc_sumsq_res = $dc_n = $uc_sumsq_res = $uc_n = 0;
   103 			$dc_sumsq_res = $dc_n = $uc_sumsq_res = $uc_n = 0;