[Dart-dev] DART/branches Revision: 11951

dart at ucar.edu dart at ucar.edu
Thu Sep 21 16:41:58 MDT 2017


nancy at ucar.edu
2017-09-21 16:41:58 -0600 (Thu, 21 Sep 2017)
166
minor code block rearrangement to have clearer code.
(combined 2 if-blocks separated by an else that made it
more confusing than necessary to trace the logic here.)




Modified: DART/branches/rma_trunk/assimilation_code/location/threed_sphere/location_mod.f90
===================================================================
--- DART/branches/rma_trunk/assimilation_code/location/threed_sphere/location_mod.f90	2017-09-21 22:36:49 UTC (rev 11950)
+++ DART/branches/rma_trunk/assimilation_code/location/threed_sphere/location_mod.f90	2017-09-21 22:41:58 UTC (rev 11951)
@@ -1578,27 +1578,26 @@
             ! Could avoid adding any that have nums lower than base_ob???
             t_ind = gc%gtt(bt)%loc_box(st - 1 + k)
 
-            ! Can compute total distance here if verts are the same
-            ! Only compute distance if dist is present
-            if(present(dist)) then
+            if(.not. present(dist)) then
+               ! Dist isn't present; add this ob to list without computing distance
+               num_close = num_close + 1
+               close_ind(num_close) = t_ind
+            else
                if(base_loc%which_vert == locs(t_ind)%which_vert) then
+                  ! Can compute total distance here if verts are the same
                   this_dist = get_dist(base_loc, locs(t_ind), base_type, loc_qtys(t_ind))
-               else
-               ! Otherwise can just get horizontal distance
+               else 
+                  ! Otherwise can just get horizontal distance
                   this_dist = get_dist(base_loc, locs(t_ind), base_type, loc_qtys(t_ind), &
                      no_vert = .true.)
                endif
-            else
-               ! Dist isn't present; add this ob to list without computing distance
-               num_close = num_close + 1
-               close_ind(num_close) = t_ind
-            endif
 
-            ! If dist is present and this loc's distance is less than cutoff, add it in list
-            if(present(dist) .and. this_dist <= this_maxdist) then
-               num_close = num_close + 1
-               close_ind(num_close) = t_ind
-               dist(num_close) = this_dist
+               ! If this loc's distance is less than cutoff, add it to the list
+               if(this_dist <= this_maxdist) then
+                  num_close = num_close + 1
+                  close_ind(num_close) = t_ind
+                  dist(num_close) = this_dist
+               endif
             endif
          end do
       end do LON_OFFSET


More information about the Dart-dev mailing list