Skip to content

Commit

Permalink
use set_vertical rather than set_location
Browse files Browse the repository at this point in the history
bitwise with original code
see #621 for difference between set_veritical and set_location
  • Loading branch information
hkershaw-brown committed Jan 12, 2024
1 parent dc1d6ba commit adbe085
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions models/wrf/model_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module model_mod

use location_mod, only : location_type, get_close_type, &
set_location, set_location_missing, &
set_vertical_localization_coord, &
set_vertical_localization_coord, set_vertical, &
VERTISHEIGHT, VERTISLEVEL, VERTISPRESSURE, &
VERTISSURFACE, VERTISUNDEF, VERTISSCALEHEIGHT, &
loc_get_close => get_close, get_location, &
Expand Down Expand Up @@ -1883,7 +1883,7 @@ subroutine convert_vertical_state(state_handle, num, locs, loc_qtys, loc_indx, &

endif

locs(i) = set_location(lon_lat_vert(1), lon_lat_vert(2), vert, which_vert)
call set_vertical(locs(i), vert, which_vert)

enddo

Expand Down Expand Up @@ -1939,13 +1939,15 @@ subroutine convert_vertical_obs(state_handle, num, locs, loc_qtys, loc_types, &
endif

if (lon_lat_vert(3) == MISSING_R8) then ! vertical is missing, no conversion
istatus(ob) = 0 ! HK todo original code does not set success for this
call set_vertical(locs(ob), MISSING_R8, which_vert)
istatus(ob) = 1 ! HK todo original code does not set success for this
cycle
endif

! convert to which_vert
call get_domain_info(lon_lat_vert(1),lon_lat_vert(2),id,xloc,yloc)
if (id == 0) then
call set_vertical(locs(ob), MISSING_R8, which_vert) !HK original code - why set to missing?
istatus(ob) = NOT_IN_ANY_DOMAIN
cycle
endif
Expand All @@ -1955,6 +1957,7 @@ subroutine convert_vertical_obs(state_handle, num, locs, loc_qtys, loc_types, &
call toGrid(yloc,j,dy,dym)

if ( .not. within_bounds_horizontal(i, j, id, loc_qtys(ob)) ) then
call set_vertical(locs(ob), MISSING_R8, which_vert)
istatus(ob) = FAILED_BOUNDS_CHECK
cycle
endif
Expand Down Expand Up @@ -2054,7 +2057,8 @@ subroutine convert_vertical_obs(state_handle, num, locs, loc_qtys, loc_types, &


end select


!HK original code uses set_location, you could use set_vertical here see #621
locs(ob) = set_location(lon_lat_vert(1), lon_lat_vert(2), zout(1), which_vert)
istatus(ob) = 0

Expand Down

0 comments on commit adbe085

Please sign in to comment.