libSBE.pl
changeset 29 f41d125405a6
parent 28 db6c3d13f8be
child 30 1a1a12d5edc1
equal deleted inserted replaced
28:db6c3d13f8be 29:f41d125405a6
     1 #======================================================================
     1 #======================================================================
     2 #                    L I B S B E . P L 
     2 #                    L I B S B E . P L 
     3 #                    doc: Mon Nov  3 12:42:14 2014
     3 #                    doc: Mon Nov  3 12:42:14 2014
     4 #                    dlm: Sat Mar 19 18:17:54 2016
     4 #                    dlm: Tue May 31 13:12:22 2016
     5 #                    (c) 2014 A.M. Thurnherr
     5 #                    (c) 2014 A.M. Thurnherr
     6 #                    uE-Info: 18 71 NIL 0 0 72 2 2 4 NIL ofnI
     6 #                    uE-Info: 287 43 NIL 0 0 72 2 2 4 NIL ofnI
     7 #======================================================================
     7 #======================================================================
     8 
     8 
     9 # HISTORY:
     9 # HISTORY:
    10 #	Nov  3, 2014: - exported from [importCNV]
    10 #	Nov  3, 2014: - exported from [importCNV]
    11 #	Jun 16, 2015: - cosmetics
    11 #	Jun 16, 2015: - cosmetics
    14 #	Sep 29, 2015: - added potemp and sigma standard field names
    14 #	Sep 29, 2015: - added potemp and sigma standard field names
    15 #	Mar 19, 2016: - BUG: conductivity unit checking on input had multiple bugs
    15 #	Mar 19, 2016: - BUG: conductivity unit checking on input had multiple bugs
    16 #				  - solution for files with multiple conductivity units: ignore
    16 #				  - solution for files with multiple conductivity units: ignore
    17 #				    all conducitivities with units not equal to the first cond var
    17 #				    all conducitivities with units not equal to the first cond var
    18 #				  - added $libSBE_quiet to suppress diagnostic messages
    18 #				  - added $libSBE_quiet to suppress diagnostic messages
       
    19 #	May 31, 2016: - made successfully decoding lat/lon optional
    19 
    20 
    20 #----------------------------------------------------------------------
    21 #----------------------------------------------------------------------
    21 # fname_SBE2std($)
    22 # fname_SBE2std($)
    22 #	- standardize field names (also adds correct unit %PARAMs)
    23 #	- standardize field names (also adds correct unit %PARAMs)
    23 #----------------------------------------------------------------------
    24 #----------------------------------------------------------------------
   265 		&antsAddParams('date',$1),next
   266 		&antsAddParams('date',$1),next
   266 			if ($hdr =~ /Date\s*:\s*(.*)/);
   267 			if ($hdr =~ /Date\s*:\s*(.*)/);
   267 	
   268 	
   268 		if (($hdr =~ /Latitude\s*[:=]\s*/) && !defined($lat)) {
   269 		if (($hdr =~ /Latitude\s*[:=]\s*/) && !defined($lat)) {
   269 			($deg,$min,$NS) = split(/\s+/,$');
   270 			($deg,$min,$NS) = split(/\s+/,$');
   270 			croak("$0: cannot decode latitude ($')\n")
   271 			if ($NS eq 'N' || $NS eq 'S') {
   271 				unless ($NS eq 'N' || $NS eq 'S');
   272 				$lat = $deg + $min/60;
   272 			$lat = $deg + $min/60;
   273 				$lat *= -1 if ($NS eq 'S');
   273 			$lat *= -1 if ($NS eq 'S');
   274 			} else {
       
   275 				print(STDERR "$0: WARNING: cannot decode latitude ($')\n");
       
   276 				$lat = nan;
       
   277 			}
   274 			&antsAddParams('lat',$lat);
   278 			&antsAddParams('lat',$lat);
   275 			next;
   279 			next;
   276 		}
   280 		}
   277 		if (($hdr =~ /Longitude\s*[:=]\s*/) && !defined($lon)) {
   281 		if (($hdr =~ /Longitude\s*[:=]\s*/) && !defined($lon)) {
   278 			($deg,$min,$EW) = split(/\s+/,$');
   282 			($deg,$min,$EW) = split(/\s+/,$');
   279 			croak("$0: cannot decode longitude ($')\n")
   283 			if ($EW eq 'E' || $EW eq 'W') {
   280 				unless ($EW eq 'E' || $EW eq 'W');
   284 				$lon = $deg + $min/60;
   281 			$lon = $deg + $min/60;
   285 				$lon *= -1 if ($EW eq 'W');
   282 			$lon *= -1 if ($EW eq 'W');
   286 			} else {
       
   287 				print(STDERR "$0: WARNING: cannot decode longitude ($')\n");
       
   288 				$lon= nan;
       
   289 			}
   283 			&antsAddParams('lon',$lon);
   290 			&antsAddParams('lon',$lon);
   284 			next;
   291 			next;
   285 		}
   292 		}
   286 	    
   293 	    
   287 		if ($hdr =~ /interval = seconds: /) {
   294 		if ($hdr =~ /interval = seconds: /) {