[Dart-dev] DART/branches Revision: 12829

dart at ucar.edu dart at ucar.edu
Tue Sep 18 08:01:17 MDT 2018


nancy at ucar.edu
2018-09-18 08:01:17 -0600 (Tue, 18 Sep 2018)
137
try to prevent badly formed grids from computing
a 0 cell width and dividing by it, creating NaNs.
instead return a failed interpolate.




Modified: DART/branches/recam/models/utilities/quad_utils_mod.f90
===================================================================
--- DART/branches/recam/models/utilities/quad_utils_mod.f90	2018-09-17 22:45:03 UTC (rev 12828)
+++ DART/branches/recam/models/utilities/quad_utils_mod.f90	2018-09-18 14:01:17 UTC (rev 12829)
@@ -1573,6 +1573,10 @@
    if(dist_bot <= 0 .and. dist_top > 0) then
       bot = i - 1
       top = i
+      if ((abs(dist_bot) + dist_top) == 0) then
+         istatus = 2
+         return
+      endif
       fract = abs(dist_bot) / (abs(dist_bot) + dist_top)
       if (debug > 3) print *, 'lon: returning bot, top, fract', bot, top, fract
       return
@@ -1586,6 +1590,10 @@
    top = 1
    dist_bot = lon_dist(lon, lon_array(bot))
    dist_top = lon_dist(lon, lon_array(top))
+   if ((abs(dist_bot) + dist_top) == 0) then
+      istatus = 2
+      return
+   endif
    fract = abs(dist_bot) / (abs(dist_bot) + dist_top)
 else
    string1 = 'end reached. internal error, should not happen'


More information about the Dart-dev mailing list