[Dart-dev] [5045] DART/trunk/observations/gps/convert_cosmic_gps_cdf.f90: drat. check in

nancy at ucar.edu nancy at ucar.edu
Wed Jun 29 13:14:31 MDT 2011


Revision: 5045
Author:   nancy
Date:     2011-06-29 13:14:31 -0600 (Wed, 29 Jun 2011)
Log Message:
-----------
drat.  check in the version of the code which actually has the
second fix in it.

Modified Paths:
--------------
    DART/trunk/observations/gps/convert_cosmic_gps_cdf.f90

-------------- next part --------------
Modified: DART/trunk/observations/gps/convert_cosmic_gps_cdf.f90
===================================================================
--- DART/trunk/observations/gps/convert_cosmic_gps_cdf.f90	2011-06-29 19:12:34 UTC (rev 5044)
+++ DART/trunk/observations/gps/convert_cosmic_gps_cdf.f90	2011-06-29 19:14:31 UTC (rev 5045)
@@ -661,6 +661,9 @@
 integer  :: bot_lev, k
 real(r8) :: fract
 
+bot_lev = -1
+fract = 0.0_r8
+
 !  Search down through height levels
 do k = 2, nobs
   if ( height >= hghtp(k) ) then
@@ -670,6 +673,22 @@
   endif
 end do
 
+! the hghtp() array is currently an interpolated list of levels
+! and on at least 1 PGI compiler version computing the lowest value 
+! rounds enough that a height exactly equal to the lowest level 
+! compares as less than instead of equal.  so test and if it's very very 
+! close to the lowest level then return it as equal; otherwise it's 
+! an internally inconsistent input file.
+if (bot_lev < 0) then
+  if (abs(height - hghtp(nobs)) < 0.00001) then
+     bot_lev = nobs
+     fract = 0.0_r8
+  else
+     call error_handler(E_ERR, 'bad level, below lowest in file', &
+                       source, revision, revdate)
+  endif
+endif
+
 lref = (1.0_r8 - fract) * refp(bot_lev) + fract * refp(bot_lev-1)
 
 return


More information about the Dart-dev mailing list