LADCPproc
changeset 26 d778b73f2a43
parent 25 91bd907db97f
child 27 ec8873454890
equal deleted inserted replaced
25:91bd907db97f 26:d778b73f2a43
     1 #!/usr/bin/perl
     1 #!/usr/bin/perl
     2 #======================================================================
     2 #======================================================================
     3 #                    L A D C P P R O C 
     3 #                    L A D C P P R O C 
     4 #                    doc: Thu Sep 16 20:36:10 2010
     4 #                    doc: Thu Sep 16 20:36:10 2010
     5 #                    dlm: Wed Mar 19 23:41:55 2014
     5 #                    dlm: Thu Mar 20 12:34:04 2014
     6 #                    (c) 2010 A.M. Thurnherr
     6 #                    (c) 2010 A.M. Thurnherr
     7 #                    uE-Info: 91 55 NIL 0 0 72 10 2 4 NIL ofnI
     7 #                    uE-Info: 94 52 NIL 0 0 72 10 2 4 NIL ofnI
     8 #======================================================================
     8 #======================================================================
     9 
     9 
    10 # NOTES:
    10 # NOTES:
    11 #   - the shear-method editing in this code is based on Eric Firing's merge.c
    11 #   - the shear-method editing in this code is based on Eric Firing's merge.c
    12 #   - as described in [LADCPproc.backscatter], there are three different codes 
    12 #   - as described in [LADCPproc.backscatter], there are three different codes 
    87 #				  - added CTD lat/lon info to most output files (but not BT)
    87 #				  - added CTD lat/lon info to most output files (but not BT)
    88 #				  - BUG: moved %water_depth to common %PARAMs
    88 #				  - BUG: moved %water_depth to common %PARAMs
    89 #	Mar 19, 2014: - moved code to set LADCP_time_lag %PARAM into main prog so it is
    89 #	Mar 19, 2014: - moved code to set LADCP_time_lag %PARAM into main prog so it is
    90 #				    set, even when -l is used
    90 #				    set, even when -l is used
    91 #				  - added pitch, roll, hdg to -t output
    91 #				  - added pitch, roll, hdg to -t output
       
    92 #	Mar 20, 2014: - BUG: wrong number of samples were recorded when upcast had no
       
    93 #						 valid data whatsoever
       
    94 #				  - added support for $LADCP_max_gap
    92 
    95 
    93 ($ANTS)    = (`which ANTSlib` =~ m{^(.*)/[^/]*$});
    96 ($ANTS)    = (`which ANTSlib` =~ m{^(.*)/[^/]*$});
    94 ($PERL_TOOLS) = (`which mkProfile` =~ m{^(.*)/[^/]*$});
    97 ($PERL_TOOLS) = (`which mkProfile` =~ m{^(.*)/[^/]*$});
    95 ($LADCPPROC)  = ($0 =~ m{^(.*)/[^/]*$});
    98 ($LADCPPROC)  = ($0 =~ m{^(.*)/[^/]*$});
    96 
    99 
   355 
   358 
   356 print(STDERR "\t\tconstructing profile time series...")
   359 print(STDERR "\t\tconstructing profile time series...")
   357 	if ($opt_d);
   360 	if ($opt_d);
   358 	
   361 	
   359 ($LADCP_start,$LADCP_end,$LADCP_bottom,$w_gap_time,$zErr,$maxz) =
   362 ($LADCP_start,$LADCP_end,$LADCP_bottom,$w_gap_time,$zErr,$maxz) =
   360     mk_prof(\%LADCP,0,undef,1,6,70,0.1,9999);
   363     mk_prof(\%LADCP,0,undef,1,6,70,0.1,$LADCP_max_gap);
   361 croak("\n$LADCP_file: no good ensembles found\n")
   364 croak("\n$LADCP_file: no good ensembles found\n")
   362     unless defined($LADCP_start);
   365     unless defined($LADCP_start);
   363 
   366 
   364 my($cast_duration) = $LADCP{ENSEMBLE}[$LADCP_end]->{UNIX_TIME} -
   367 my($cast_duration) = $LADCP{ENSEMBLE}[$LADCP_end]->{UNIX_TIME} -
   365                      $LADCP{ENSEMBLE}[$LADCP_start]->{UNIX_TIME};
   368                      $LADCP{ENSEMBLE}[$LADCP_start]->{UNIX_TIME};
   626 @dc_wsh_mu = @wsh_mu; @dc_wsh_sig = @wsh_sig;
   629 @dc_wsh_mu = @wsh_mu; @dc_wsh_sig = @wsh_sig;
   627 @dc_esh_mu = @esh_mu;
   630 @dc_esh_mu = @esh_mu;
   628 @dc_lash_mu = @lash_mu; @dc_losh_mu = @losh_mu;
   631 @dc_lash_mu = @lash_mu; @dc_losh_mu = @losh_mu;
   629 
   632 
   630 print(STDERR "\n\tupcast...") if ($opt_d);
   633 print(STDERR "\n\tupcast...") if ($opt_d);
       
   634 @sh_n=@ush_mu=@ush_sig=@vsh_mu=@vsh_sig=@wsh_mu=@wsh_sig=@esh_mu=@lash_mu=@losh_mu=undef;
       
   635 
   631 edit_velocity($LADCP_end,$LADCP_bottom);							# upcast
   636 edit_velocity($LADCP_end,$LADCP_bottom);							# upcast
   632 calc_shear($LADCP_end,$LADCP_bottom,$SHEAR_PREGRID_DZ,0);
   637 calc_shear($LADCP_end,$LADCP_bottom,$SHEAR_PREGRID_DZ,0);
   633 calc_shear($LADCP_end,$LADCP_bottom,$GRID_DZ,1);
   638 calc_shear($LADCP_end,$LADCP_bottom,$GRID_DZ,1);
   634 
   639 
   635 @uc_sh_n = @sh_n;													# save upcast results
   640 @uc_sh_n = @sh_n;													# save upcast results