Skip to content

Commit

Permalink
bug-fix: use get_dist to calculate distances for observations with VE…
Browse files Browse the repository at this point in the history
…RTISUNDEF

fixes #486

Previously observations with VERTISUNDEF were given a large distance, because
the verical coordinate is missing: local_array(3) == missing_r8

The location_mod::get_dist uses horizontal distance only if
VERTISUNDEF for either location.
  • Loading branch information
hkershaw-brown committed Jul 10, 2023
1 parent 1b76f3a commit c637662
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions models/wrf/model_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6403,6 +6403,13 @@ subroutine get_close(gc, base_loc, base_type, locs, loc_qtys, &
local_loc = locs(t_ind)
local_which = nint(query_location(local_loc))

if (present(dist)) then
if (local_which == VERTISUNDEF) then
dist(k) = get_dist(base_loc, local_loc, base_type, loc_qtys(t_ind))
cycle
endif
endif

! Convert local vertical coordinate to requested vertical coordinate if necessary.
! This should only be necessary for obs priors, as state location information already
! contains the correct vertical coordinate (filter_assim's call to get_state_meta_data).
Expand Down

0 comments on commit c637662

Please sign in to comment.