NCAR / NCAR/wrf-python

Problem with wrf.interplevel desiredlev input

Open
#219 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
498
Forks
178
PR merge metrics
No merged PRs in 30d

Description

Hello, I encountered a problem when trying to use a "for loop" to get a sequence of different interpolation planes.

So I have tried this line, which works fine:
p_certain_level = wrf.interplevel(p,z,2893.9905)

I can plot this to get:
image

I also have other different height values that I want to plot. So I write a list:
height = [588.0741, 1751.7858, 2893.9905, 4019.048, 5129.8022, 6228.1494, ... ]

Then I write the for loop:
for a in range(0,3): ## here i'm just trying the first three heights, not the whole list
ss = wrf.interplevel(p, z, float(height[a]))
print(ss)

This returns something like:
image

As you can see, there are a lot of nan in the printed array. I also tried to plot the result:
image

As you can see, the middle values are kept unchanged. However, the other values are all missing. I'm not sure what's happening that leads to interplevel method not working. I've tried a few times and believe this is related to list and numpy.array (both list and np.array are producing the same problem).

I've tried wrf.getvar, in which I use a "timeidx = blabla_list [3]", which turns out to work properly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the scalar and looped wrf.interplevel calls with the same p, z, and height values shown in the issue, then inspect how NaN values are produced for each requested level. No repository file or test is named, so compare the interpolation behavior for scalar, list, and numpy-array inputs. Done means determining whether the missing values are caused by the input values or by wrf.interplevel, with a documented reproduction or fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.