|
1 #====================================================================== |
|
2 # D U M P _ R E S I D U A L _ P R O F I L E S . P L |
|
3 # doc: Thu Mar 24 07:55:07 2016 |
|
4 # dlm: Tue Mar 29 13:43:56 2016 |
|
5 # (c) 2016 A.M. Thurnherr |
|
6 # uE-Info: 11 30 NIL 0 0 72 2 2 4 NIL ofnI |
|
7 #====================================================================== |
|
8 |
|
9 # HISTORY: |
|
10 # Mar 24, 2016: - created from [plot_residuals.pl] |
|
11 # Mar 29, 2016: - cleaned up |
|
12 |
|
13 sub dump_residual_profiles($) |
|
14 { |
|
15 my($odir) = @_; |
|
16 |
|
17 unless (-d $odir) { |
|
18 warning(0,"Creating residual-profile output directory ./$odir\n"); |
|
19 my(@dirs) = split('/',$odir); |
|
20 my($path) = '.'; |
|
21 foreach my $d (@dirs) { |
|
22 $path .= "/$d"; |
|
23 mkdir($path); |
|
24 } |
|
25 } |
|
26 |
|
27 return unless ($P{max_depth}); |
|
28 |
|
29 @antsNewLayout = ('bin','depth','residual'); |
|
30 |
|
31 for ($ens=$firstGoodEns; $ens<=$lastGoodEns; $ens++) { |
|
32 next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}); |
|
33 |
|
34 my($of) = sprintf('>%s/%04d.rprof',$odir,$LADCP{ENSEMBLE}[$ens]->{NUMBER}); |
|
35 open(STDOUT,$of) || error("$of: $!\n"); |
|
36 undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE); |
|
37 |
|
38 &antsAddParams('ensemble', $LADCP{ENSEMBLE}[$ens]->{NUMBER}, |
|
39 'elapsed', $LADCP{ENSEMBLE}[$ens]->{ELAPSED}, |
|
40 'CTD_depth', $LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH}, |
|
41 'CTD_w', $CTD{W}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
|
42 'CTD_accel', $CTD{W_t}[$LADCP{ENSEMBLE}[$ens]->{CTD_SCAN}], |
|
43 'ADCP_tilt', $LADCP{ENSEMBLE}[$ens]->{TILT}); |
|
44 |
|
45 my(@bindepth) = calc_binDepths($ens); |
|
46 for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) { |
|
47 next unless ($bin+1>=$outGrid_firstBin && $bin+1<=$outGrid_lastBin); |
|
48 next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]); |
|
49 my($bi) = $bindepth[$bin]/$opt_o; |
|
50 my($res) = ($ens < $LADCP_atbottom) ? |
|
51 $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] - $DNCAST{MEDIAN_W}[$bi] : |
|
52 $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] - $UPCAST{MEDIAN_W}[$bi]; |
|
53 &antsOut($bin,$bindepth[$bin],$res); |
|
54 |
|
55 } |
|
56 &antsOut('EOF'); open(STDOUT,'>&2'); |
|
57 } |
|
58 } |
|
59 |
|
60 1; # return true on require |