libLADCP.pl
changeset 47 dde46143288c
parent 39 56bdfe65a697
equal deleted inserted replaced
46:70e566505a12 47:dde46143288c
     1 #======================================================================
     1 #======================================================================
     2 #                    L I B L A D C P . P L 
     2 #                    . . / L I B / L I B L A D C P . P L 
     3 #                    doc: Wed Jun  1 20:38:19 2011
     3 #                    doc: Wed Jun  1 20:38:19 2011
     4 #                    dlm: Sat Apr  6 19:42:07 2019
     4 #                    dlm: Tue Sep 14 08:17:30 2021
     5 #                    (c) 2011 A.M. Thurnherr
     5 #                    (c) 2011 A.M. Thurnherr
     6 #                    uE-Info: 211 34 NIL 0 0 70 2 2 4 NIL ofnI
     6 #                    uE-Info: 201 0 NIL 0 0 70 2 2 4 NIL ofnI
     7 #======================================================================
     7 #======================================================================
     8 
     8 
     9 # HISTORY:
     9 # HISTORY:
    10 #	Jun  1, 2011: - created
    10 #	Jun  1, 2011: - created
    11 #	Jul 29, 2011: - improved
    11 #	Jul 29, 2011: - improved
    18 #	Jan 18, 2012: - added T_VI_alt() to allow assessment of tilt correction extrema
    18 #	Jan 18, 2012: - added T_VI_alt() to allow assessment of tilt correction extrema
    19 #	Aug 22, 2012: - added documentation
    19 #	Aug 22, 2012: - added documentation
    20 #				  - added T_w()
    20 #				  - added T_w()
    21 #	Sep 24, 2012: - made "k" argument default in T_w()
    21 #	Sep 24, 2012: - made "k" argument default in T_w()
    22 #	Oct 25, 2012: - renamed T_SM() to T_ASM()
    22 #	Oct 25, 2012: - renamed T_SM() to T_ASM()
    23 #	Jun 26. 2013: - added T_w_z()
    23 #	Jun 26, 2013: - added T_w_z()
    24 #				  - added parameter checks to processing-specific corrections
    24 #				  - added parameter checks to processing-specific corrections
    25 #	May 18, 2015: - added pulse length to T_w() and T_w_z()
    25 #	May 18, 2015: - added pulse length to T_w() and T_w_z()
    26 #	Apr 25, 2018: - added eps_VKE() parameterization
    26 #	Apr 25, 2018: - added eps_VKE() parameterization
    27 #	Apr  5, 2018: - adapted to improved antsFunUsage()
    27 #	Apr  5, 2018: - adapted to improved antsFunUsage()
    28 #				  - BUG eps_VKE() had erroneous string
    28 #				  - BUG eps_VKE() had erroneous string
       
    29 #	Sep  9, 2021: - removed T_w_z(); consistent with Thurnherr (JAOT 2012),
       
    30 #				    vertical divergence spectra should be corrected with
       
    31 #					T_w()
    29 
    32 
    30 require "$ANTS/libvec.pl";
    33 require "$ANTS/libvec.pl";
    31 require "$ANTS/libfuns.pl";
    34 require "$ANTS/libfuns.pl";
    32 
    35 
    33 #------------------------------------------------------------------------------
    36 #------------------------------------------------------------------------------
   200 
   203 
   201 #----------------------------------------------------------------------
   204 #----------------------------------------------------------------------
   202 # T_w(k,blen,plen,dz,range_max)
   205 # T_w(k,blen,plen,dz,range_max)
   203 #	- vertical-velocity method of Thurnherr (IEEE 2011)
   206 #	- vertical-velocity method of Thurnherr (IEEE 2011)
   204 #	- range_max == 0 disables tilt correction
   207 #	- range_max == 0 disables tilt correction
       
   208 #	- this is the expression that should be used to correct spectra
       
   209 #	  of VKE and vertical divergence (w_z)
       
   210 #   - I am not sure why the finite differencing of the processed
       
   211 #	  velocities does not have to be corrected for, but this is
       
   212 #	  consistent with:
       
   213 #		- Thurnherr (JAOT 2012) where the shear is corrected with T_VI
       
   214 #		- the strain correction of Kunze et al. (2006), which corrects
       
   215 #	      for bin averaging, but not for finite differencing(?)
   205 #----------------------------------------------------------------------
   216 #----------------------------------------------------------------------
   206 
   217 
   207 { my(@fc);
   218 { my(@fc);
   208 	sub T_w(@)
   219 	sub T_w(@)
   209 	{
   220 	{
   215 			unless ($k>=0 && $blen>0 && $plen>0 && $dz>0 && $range_max>=0);				
   226 			unless ($k>=0 && $blen>0 && $plen>0 && $dz>0 && $range_max>=0);				
   216 		return T_ravg($k,$blen,$plen) * T_binavg($k,$dz) * T_tilt($k,dprime($range_max));
   227 		return T_ravg($k,$blen,$plen) * T_binavg($k,$dz) * T_tilt($k,dprime($range_max));
   217 	}
   228 	}
   218 }
   229 }
   219 
   230 
   220 #----------------------------------------------------------------------
   231 ##----------------------------------------------------------------------
   221 # T_w_z(k,blen,plen,dz,range_max)
   232 ## T_w_z(k,blen,plen,dz,range_max)
   222 #	- vertical-velocity method of Thurnherr (IEEE 2011)
   233 ##	- vertical-velocity method of Thurnherr (IEEE 2011)
   223 #	- first differencing of gridded shear to calculate dw/dz
   234 ##	- first differencing of gridded shear to calculate dw/dz
   224 #	- NB: grid-scale differentiation assumed
   235 ##	- NB: grid-scale differentiation assumed
   225 #	- range_max == 0 disables tilt correction
   236 ##	- range_max == 0 disables tilt correction
   226 #----------------------------------------------------------------------
   237 ##----------------------------------------------------------------------
   227 
   238 #
   228 { my(@fc);
   239 #{ my(@fc);
   229 	sub T_w_z(@)
   240 #	sub T_w_z(@)
   230 	{
   241 #	{
   231 		my($k,$blen,$plen,$dz,$range_max) =
   242 #		my($k,$blen,$plen,$dz,$range_max) =
   232 			&antsFunUsage(-4,'ffff',
   243 #			&antsFunUsage(-4,'ffff',
   233 				'T_w_z([vertical wavenumber[rad/s]] <ADCP bin size[m]> <pulse length[m]> <output grid resolution[m]> <range max[m]>)',
   244 #				'T_w_z([vertical wavenumber[rad/s]] <ADCP bin size[m]> <pulse length[m]> <output grid resolution[m]> <range max[m]>)',
   234 				\@fc,'k',undef,undef,undef,@_);
   245 #				\@fc,'k',undef,undef,undef,@_);
   235 		croak("T_w_z($k,$blen,$plen,$dz,$range_max): bad parameters\n")
   246 #		croak("T_w_z($k,$blen,$plen,$dz,$range_max): bad parameters\n")
   236 			unless ($k>=0 && $blen>0 && $plen>0 && $dz>0 && $range_max>=0);				
   247 #			unless ($k>=0 && $blen>0 && $plen>0 && $dz>0 && $range_max>=0);				
   237 		return T_ravg($k,$blen,$plen) * T_binavg($k,$dz) * T_tilt($k,dprime($range_max)) * T_fdiff($k,$dz);
   248 #		return T_ravg($k,$blen,$plen) * T_binavg($k,$dz) * T_tilt($k,dprime($range_max)) * T_fdiff($k,$dz);
   238 	}
   249 #	}
   239 }
   250 #}
   240 
   251 
   241 1;
   252 1;