mkProfile
changeset 11 9c3b147b4372
parent 8 7ad053ea1742
child 12 0f89b1523648
equal deleted inserted replaced
10:c835cd613f3e 11:9c3b147b4372
     1 #!/usr/bin/perl
     1 #!/usr/bin/perl
     2 #======================================================================
     2 #======================================================================
     3 #                    M K P R O F I L E 
     3 #                    M K P R O F I L E 
     4 #                    doc: Sun Jan 19 18:55:26 2003
     4 #                    doc: Sun Jan 19 18:55:26 2003
     5 #                    dlm: Wed Sep 21 12:03:14 2011
     5 #                    dlm: Fri Apr 12 09:24:14 2013
     6 #                    (c) 2003 A.M. Thurnherr
     6 #                    (c) 2003 A.M. Thurnherr
     7 #                    uE-Info: 747 30 NIL 0 0 72 2 2 4 NIL ofnI
     7 #                    uE-Info: 269 72 NIL 0 0 72 2 2 4 NIL ofnI
     8 #======================================================================
     8 #======================================================================
     9 
     9 
    10 # Make an LADCP Profile by Integrating W (similar to Firing's scan*).
    10 # Make an LADCP Profile by Integrating W (similar to Firing's scan*).
    11 
    11 
    12 # HISTORY:
    12 # HISTORY:
    76 #				  - added ping-interval calculation
    76 #				  - added ping-interval calculation
    77 #				  - BUG: post-recovery rotations were always zero
    77 #				  - BUG: post-recovery rotations were always zero
    78 #	Sep  9, 2011: - BUG: range calculation for Earth coordinate data included bins without
    78 #	Sep  9, 2011: - BUG: range calculation for Earth coordinate data included bins without
    79 #						 valid velocities
    79 #						 valid velocities
    80 #	Sep 21, 2010: - added %rms_heave_acceleration
    80 #	Sep 21, 2010: - added %rms_heave_acceleration
       
    81 #	Apr 12, 2013: - added -p
    81 
    82 
    82 # NOTES:
    83 # NOTES:
    83 #	- the battery values are based on transmission voltages (different
    84 #	- the battery values are based on transmission voltages (different
    84 #	  from battery voltages) and reported without units (raw 8-bit a2d
    85 #	  from battery voltages) and reported without units (raw 8-bit a2d
    85 #	  values)
    86 #	  values)
   103 die("Usage: $0 " .
   104 die("Usage: $0 " .
   104 	"[-Q)uiet] [-F)ilter <script>] " .
   105 	"[-Q)uiet] [-F)ilter <script>] " .
   105 	"[-s)uppress checkensemble()] " .
   106 	"[-s)uppress checkensemble()] " .
   106 	"[require -4)-beam solutions] " .
   107 	"[require -4)-beam solutions] " .
   107 	"[-r)ef-layer <bin|1,bin|6>] [-n) vels <min|2>] " .
   108 	"[-r)ef-layer <bin|1,bin|6>] [-n) vels <min|2>] " .
   108 	"[-e)rr-vel <max|0.1>] [-c)orrelation <min>] " .
   109 	"[-e)rr-vel <max[0.1]] [-c)orrelation <min>] [-p)ct-good <min[100]>] " .
   109 	"[-m)ax <gap>] " .
   110 	"[-m)ax <gap>] " .
   110 	"[-d)rift <dx,dy>] [-g)ps <start lat,lon/end lat,lon>] " .
   111 	"[-d)rift <dx,dy>] [-g)ps <start lat,lon/end lat,lon>] " .
   111 	"[output -f)ields <field[,...]> " .
   112 	"[output -f)ields <field[,...]> " .
   112 	"[-M)agnetic <declination>] [profile -B)ottom <depth>] " .
   113 	"[-M)agnetic <declination>] [profile -B)ottom <depth>] " .
   113 	"<RDI file>\n")
   114 	"<RDI file>\n")
   114 		unless (&Getopts("4AB:F:M:Qd:r:n:e:c:g:f:m:s") && @ARGV == 1);
   115 		unless (&Getopts("4AB:F:M:Qd:r:n:e:c:g:f:m:sp:") && @ARGV == 1);
   115 
   116 
   116 $RDI_Coords::minValidVels = 4 if ($opt_4);			# no 3-beam solutions
   117 $RDI_Coords::minValidVels = 4 if ($opt_4);			# no 3-beam solutions
   117 
   118 
   118 require $opt_F if defined($opt_F);					# load filter
   119 require $opt_F if defined($opt_F);					# load filter
   119 
   120 
   120 $opt_r = "1,6" 	unless defined($opt_r);				# defaults
   121 $opt_r = "1,6" 	unless defined($opt_r);				# defaults
   121 $opt_n = 2	   	unless defined($opt_n);
   122 $opt_n = 2	   	unless defined($opt_n);
   122 $opt_e = 0.1   	unless defined($opt_e);
   123 $opt_e = 0.1   	unless defined($opt_e);
   123 $opt_c = 70	   	unless defined($opt_c);
   124 $opt_c = 70	   	unless defined($opt_c);
   124 $opt_m = 120	unless defined($opt_m);
   125 $opt_m = 120	unless defined($opt_m);
       
   126 $opt_p = 100	unless defined($opt_p);
   125 
   127 
   126 ($minb,$maxb) = split(',',$opt_r);					# reference layer
   128 ($minb,$maxb) = split(',',$opt_r);					# reference layer
   127 die("$0: can't decode -r $opt_r\n") unless defined($maxb);
   129 die("$0: can't decode -r $opt_r\n") unless defined($maxb);
   128                                         
   130                                         
   129 if ($opt_g) {										# GPS info
   131 if ($opt_g) {										# GPS info
   262 #======================================================================
   264 #======================================================================
   263 # Step 1: Integrate w & determine water depth 
   265 # Step 1: Integrate w & determine water depth 
   264 #======================================================================
   266 #======================================================================
   265 
   267 
   266 ($firstgood,$lastgood,$atbottom,$w_gap_time,$zErr,$maxz,$rms_heave_accel) =
   268 ($firstgood,$lastgood,$atbottom,$w_gap_time,$zErr,$maxz,$rms_heave_accel) =
   267 	mk_prof(\%dta,!$opt_s,$opt_F,$minb,$maxb,$opt_c,$opt_e,$opt_m);
   269 	mk_prof(\%dta,!$opt_s,$opt_F,$minb,$maxb,$opt_c,$opt_e,$opt_m,$opt_p);
   268 
   270 
   269 unless (($atbottom > $firstgood) && ($lastgood > $atbottom)) {
   271 unless (($atbottom > $firstgood) && ($lastgood > $atbottom)) {
   270 	if ($opt_Q) {
   272 	if ($opt_Q) {
   271 		print(STDERR "$ARGV[0]: no valid cast data found\n");
   273 		print(STDERR "$ARGV[0]: no valid cast data found\n");
   272 		exit(0);
   274 		exit(0);