Skip to content

wrf get_close_state gives out of bounds values for some state elements when localizing in height/pressure #1040

@hkershaw-brown

Description

@hkershaw-brown

💀 will fill with a reproducer.

I found when I run get_close_state on wrf, if I have vert_localization_coord height or pressure (not tried scaleheight) I get some state elements dist=1.0e9 because the state element is "not in the domain". 🙃

If I use level as vert_localization_coord, non of the state elements are outside the domain.

WRF uses the same get_close routine for get_close_state and get_close_obs.

get_close_state
-> get_close

get_close_obs
-> get_close

get_close uses vert_convert

call vert_convert(state_handle, local_loc, loc_qtys(t_ind), istatus2)

rather than convert_vertical_state

vert_convert uses the location from the location type to get the domain the state is in
https://github.com/NCAR/DART/blob/4c89e64191dd905c58baf8a0d726c1e5ae24ceb6/models/wrf/model_mod.f90#L3197C1-L3197C33

Then gets the 8 points around this location and does an interpolation.

I think the set/get location is wiggling the location of the element so it is "outside" the domain #621

convert_vertical_state uses the state index to get the domain and i,j,k location, so there is no "out of domain check" except if you give it an index outside the range of the state vector.

You can catch this "out of domain" for a particular state element by putting a stop at line 6533

DART/models/wrf/model_mod.f90

Lines 6532 to 6533 in 4c89e64

if (((vertical_localization_on()).and.(local_array(3) == missing_r8)).or.(istatus2 == 1)) then
dist(k) = 1.0e9

I think the 8 points interpolating to get the vertical conversion of a state element is not going to be bitwise with convert_vertical_state (convert_vertical_state(given state element) /= vert_convert(given state element) but I have not confirmed this yet. Focused on the "out of domain" since it stood out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingwrfWeather Research & Forecasting Model

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions