# Iam having problem in extracting(20 to 40 dbz) and potting reflectivity to rainrate

**URL:** <https://openradar.discourse.group/t/iam-having-problem-in-extracting-20-to-40-dbz-and-potting-reflectivity-to-rainrate/468>\
**Category:** General\
**Tags:** wradlib, py-art\
**Created:** [May 7, 2024, 5:24pm UTC](https://openradar.discourse.group/t/iam-having-problem-in-extracting-20-to-40-dbz-and-potting-reflectivity-to-rainrate/468 "2024-05-07T17:24:33Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![jorahu](https://yyz2.discourse-cdn.com/free1/user_avatar/openradar.discourse.group/jorahu/32/19_2.png) [@jorahu](https://openradar.discourse.group/u/jorahu)\
**Post date:** [May 12, 2024, 11:54am UTC](https://openradar.discourse.group/t/iam-having-problem-in-extracting-20-to-40-dbz-and-potting-reflectivity-to-rainrate/468/4 "2024-05-12T11:54:56Z")

</div>

Hey

Seems like you need to debug your code line by line.

The following line in your code should do exactly what you want.

```auto
# Filter reflectivity between 20 dBZ and 40 dBZ
ref_values_between_20_and_40 = ma.masked_inside(ref_data, 20, 40)

```

Why is does not can depend on multiple problems. Maybe you have overwritten some variables before plotting (an eeeeeeasy mistake when using Jupyter or a similar IDE). Print out or plot the variable ref\_values\_between\_20\_and\_40 right after the definition with, for example, plt.imshow(ref\_values\_between\_20\_and\_40).

There is no way for others to debug your code by simply looking at it. Even more so when the functions used seem appropriate.

If the ma.masked\_inside doesn’t do the expected, try numpy.where(), for example.

Also, if the issue is strictly with filtering your data, there is no need to attach code about plotting. Always include the minimum amount of code needed to illustrate your issue, this tremendously increases your chances of getting informative answers.

---

_[View the full topic](https://openradar.discourse.group/t/iam-having-problem-in-extracting-20-to-40-dbz-and-potting-reflectivity-to-rainrate/468)._
