LADCPintsh
changeset 33 dd5b67a41791
parent 30 8697ba5a88ec
parent 29 f72cd642972c
child 35 3d769eee8c4f
equal deleted inserted replaced
32:9b972ce37c3b 33:dd5b67a41791
     1 #!/usr/bin/perl
     1 #!/usr/bin/perl
     2 #======================================================================
     2 #======================================================================
     3 #                    L A D C P I N T S H 
     3 #                    L A D C P I N T S H 
     4 #                    doc: Thu Oct 14 21:22:50 2010
     4 #                    doc: Thu Oct 14 21:22:50 2010
     5 #                    dlm: Tue Jul 15 09:14:27 2014
     5 #                    dlm: Fri Mar  6 15:51:49 2015
     6 #                    (c) 2010 A.M. Thurnherr & E. Firing
     6 #                    (c) 2010 A.M. Thurnherr & E. Firing
     7 #                    uE-Info: 526 0 NIL 0 0 72 0 2 4 NIL ofnI
     7 #                    uE-Info: 8 0 NIL 0 0 72 0 2 4 NIL ofnI
     8 #======================================================================
     8 #======================================================================
     9 
     9 
    10 $antsSummary = 'integrate LADCP shear';
    10 $antsSummary = 'integrate LADCP shear';
    11 
    11 
    12 # NOTES:
    12 # NOTES:
    54 #	Jun  5, 2013: - BUG: code bombed when either UC or DC was missing
    54 #	Jun  5, 2013: - BUG: code bombed when either UC or DC was missing
    55 #	Jun 28, 2013: - adapated to new :: convention
    55 #	Jun 28, 2013: - adapated to new :: convention
    56 #				  - make sure LADCP DUL metadata are dealt with correctly
    56 #				  - make sure LADCP DUL metadata are dealt with correctly
    57 #	Jul 12, 2013: - clarified -u usage with better messages
    57 #	Jul 12, 2013: - clarified -u usage with better messages
    58 #	Mar 20, 2014: - fiddled while debugging [LADCPproc]
    58 #	Mar 20, 2014: - fiddled while debugging [LADCPproc]
       
    59 #	Jun  7, 2014: - improved error messages
    59 
    60 
    60 ($ANTS) = (`which ANTSlib` =~ m{^(.*)/[^/]*$});
    61 ($ANTS) = (`which ANTSlib` =~ m{^(.*)/[^/]*$});
    61 require "$ANTS/ants.pl";
    62 require "$ANTS/ants.pl";
    62 require "$ANTS/libstats.pl";
    63 require "$ANTS/libstats.pl";
    63 
    64 
   418 			&fixLowSampStat(\@BT_u_var,@BT_nsamp);				# remove spurious small variances
   419 			&fixLowSampStat(\@BT_u_var,@BT_nsamp);				# remove spurious small variances
   419 			&fixLowSampStat(\@BT_v_var,@BT_nsamp);
   420 			&fixLowSampStat(\@BT_v_var,@BT_nsamp);
   420 	        &fixLowSampStat(\@BT_w_var,@BT_nsamp);
   421 	        &fixLowSampStat(\@BT_w_var,@BT_nsamp);
   421         } elsif (defined($BTdF) && defined($BTuF) &&			# LDEO_IX ANTS format
   422         } elsif (defined($BTdF) && defined($BTuF) &&			# LDEO_IX ANTS format
   422 				 defined($BTvF) && defined($BTerrF)) {
   423 				 defined($BTvF) && defined($BTerrF)) {
   423 			croak("$0: -m not supported for this BT file format\n")
   424 			croak("$0: -m not supported for LDEO_IX output\n")
   424 				if defined($opt_m);
   425 				if defined($opt_m);
   425 			while (my(@BTr) = &antsFileIn(BTF)) {
   426 			while (my(@BTr) = &antsFileIn(BTF)) {
   426 				my($gi) = int($BTr[$BTdF] / $DZ);
   427 				my($gi) = int($BTr[$BTdF] / $DZ);
   427 				$BT_u[$gi] = $BTr[$BTuF];
   428 				$BT_u[$gi] = $BTr[$BTuF];
   428 				$BT_v[$gi] = $BTr[$BTvF];
   429 				$BT_v[$gi] = $BTr[$BTvF];
   432 			}
   433 			}
   433         } else {
   434         } else {
   434 			croak("$opt_r: not a valid reference-velocity file (ANTS format)\n");
   435 			croak("$opt_r: not a valid reference-velocity file (ANTS format)\n");
   435 		}
   436 		}
   436 	} else {													# non-ANTS file (LDEO_IX assumed)
   437 	} else {													# non-ANTS file (LDEO_IX assumed)
   437 		croak("$0: -m not supported for this BT file format\n")
   438 		croak("$0: -m not supported for LDEO_IX output\n")
   438 			if defined($opt_m);
   439 			if defined($opt_m);
   439 		while (<BTF>) {
   440 		while (<BTF>) {
   440 			last if /^Columns\s+=\s+z:u:v:err/;
   441 			last if /^Columns\s+=\s+z:u:v:err/;
   441 		}
   442 		}
   442 		croak("$opt_r: not a valid reference-velocity file (non-ANTS format)\n")
   443 		croak("$opt_r: not a valid reference-velocity file (non-ANTS format)\n")