Skip to content

Commit 41563dd

Browse files
fix: bounds check for DENSITY
density is not a state quantity
1 parent a85bba3 commit 41563dd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

models/wrf_unified/model_mod.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ module model_mod
4141
use distributed_state_mod, only : get_state_array, get_state
4242

4343
use obs_kind_mod, only : get_index_for_quantity, &
44+
get_name_for_quantity, &
4445
QTY_U_WIND_COMPONENT, &
4546
QTY_v_WIND_COMPONENT, &
4647
QTY_10M_U_WIND_COMPONENT, &
@@ -3117,11 +3118,19 @@ function within_bounds_horizontal(i, j, id, qty_in)
31173118
case (QTY_SURFACE_ELEVATION); qty = QTY_POTENTIAL_TEMPERATURE ! terrain height HGT is static data on mass grid
31183119
case (QTY_TEMPERATURE); qty = QTY_POTENTIAL_TEMPERATURE ! Force QTY_TEMPERATURE to QTY_POTENTIAL_TEMPERATURE
31193120
case (QTY_SPECIFIC_HUMIDITY); qty = QTY_VAPOR_MIXING_RATIO ! we use vapor mixing ratio to compute specific humidity
3121+
case (QTY_DENSITY); qty = QTY_GEOPOTENTIAL_HEIGHT ! density interpolated from geopotential height and pressure
31203122
case default
31213123
qty = qty_in
31223124
end select
31233125

31243126
var_id = get_varid_from_kind(wrf_dom(id), qty)
3127+
if (var_id <= 0) then
3128+
within_bounds_horizontal = .false.
3129+
call error_handler(E_ERR, 'within_bounds_horizontal', &
3130+
'Quantity ' // trim(adjustl(get_name_for_quantity(qty))) // &
3131+
' not in state')
3132+
return
3133+
endif
31253134

31263135
within_bounds_horizontal = (bounds_check_lon(i, id, var_id) .and. bounds_check_lat(j, id, var_id))
31273136

0 commit comments

Comments
 (0)