# Can't plot reflectivity values \>=40dbz with appropriate ticks and cmaps

**URL:** <https://openradar.discourse.group/t/cant-plot-reflectivity-values-40dbz-with-appropriate-ticks-and-cmaps/421>\
**Category:** General\
**Tags:** wradlib, py-art, pyart\
**Created:** [March 15, 2024, 3:27pm UTC](https://openradar.discourse.group/t/cant-plot-reflectivity-values-40dbz-with-appropriate-ticks-and-cmaps/421 "2024-03-15T15:27:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ankithva](https://yyz2.discourse-cdn.com/free1/user_avatar/openradar.discourse.group/ankithva/32/317_2.png) [@ankithva](https://openradar.discourse.group/u/ankithva)\
**Post date:** [March 15, 2024, 3:27pm UTC](https://openradar.discourse.group/t/cant-plot-reflectivity-values-40dbz-with-appropriate-ticks-and-cmaps/421/1 "2024-03-15T15:27:10Z")

</div>

indeed to extract “REF” values \>=40dbz and need to plot it :

import pyart  
import numpy as np  
import glob  
import matplotlib.pyplot as plt  
import cartopy.crs as ccrs  
import cartopy.feature as cfeature  
from cartopy.mpl.gridliner import LONGITUDE\_FORMATTER, LATITUDE\_FORMATTER

# Assuming grid\_files is defined as in your code

grid\_files = glob.glob(“D:\radar\_data\radinout\gridded\_20\_jun\_2022\gridded\_20\_jun\_2022grid\_ZDR\_\*nc”)

# Define the projection you want to use

projection = ccrs.PlateCarree()

for i, file in enumerate(grid\_files):  
grid\_data = pyart.io.read\_grid(file)  
ref\_data = grid\_data.fields[‘REF’][‘data’]

```
ref_values_less_mask40 = np.where(ref_data >= 40, ref_data, np.nan)

 grid_data.fields['REF']['data'] = ref_values_less_mask40 
 grid_data.fields['REF']['long_name'] = 'Filtered Reflectivity'
 grid_data.fields['REF']['units'] = 'dBZ'

 fig = plt.figure(figsize=[8, 8])
 ax = plt.subplot(111, projection=projection)

 grid_display = pyart.graph.GridMapDisplay(grid_data)
 grid_display.plot_grid("REF", level=1,vmin=40,vmax=100, projection=projection, ax=ax, ticks=np.arange(40, 101, 2))

```

BUT I’M GETTING PLOTS LIKE THIS ,IS IT BECAUSE OF THE PROBLEM OF MY CODE OR DATA(SHOWING 100Dbz MOST OF THE MAP)?AND ALSO I NEED TO SEE THE “REF” \>=40 VARIATION WITH SUITABLE TICKS AND COLOURMAP.

 ![download](https://global.discourse-cdn.com/free1/uploads/openradar/original/1X/74f84a912280179a3f8e631da8e6bd9ca16e3552.png)  
 ![download](https://global.discourse-cdn.com/free1/uploads/openradar/original/1X/74f84a912280179a3f8e631da8e6bd9ca16e3552.png)  
 ![download](https://global.discourse-cdn.com/free1/uploads/openradar/original/1X/a018f32c060728a896427d98a0dda88aef5caf89.png)  
 ![download](https://global.discourse-cdn.com/free1/uploads/openradar/original/1X/27541ce5c51974e6f7f005237a6ae4cff84e1fea.png)

---

<div class="post-metadata">

**Author:** ![mgrover1](https://yyz2.discourse-cdn.com/free1/user_avatar/openradar.discourse.group/mgrover1/32/7_2.png) [@mgrover1](https://openradar.discourse.group/u/mgrover1)\
**Post date:** [March 15, 2024, 8:09pm UTC](https://openradar.discourse.group/t/cant-plot-reflectivity-values-40dbz-with-appropriate-ticks-and-cmaps/421/2 "2024-03-15T20:09:26Z")

</div>

Which radar is this from? I suspect it is data quality issue…

---

<div class="post-metadata">

**Author:** ![ankithva](https://yyz2.discourse-cdn.com/free1/user_avatar/openradar.discourse.group/ankithva/32/317_2.png) [@ankithva](https://openradar.discourse.group/u/ankithva)\
**Post date:** [March 16, 2024, 2:39am UTC](https://openradar.discourse.group/t/cant-plot-reflectivity-values-40dbz-with-appropriate-ticks-and-cmaps/421/3 "2024-03-16T02:39:23Z")

</div>

Data taken from IMD JAIPUR,INDIA

---

<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:** [March 16, 2024, 10:53am UTC](https://openradar.discourse.group/t/cant-plot-reflectivity-values-40dbz-with-appropriate-ticks-and-cmaps/421/4 "2024-03-16T10:53:58Z")

</div>

What’s the “no data” or “no rain” value in your files? For example some IRIS files have the no data set for something like 65000 (large positive value). Such case would satisfy your equation greater or equal than 40 and you limit the vmax of plot to 100, so everything above 100 is max color (yellow in your case).

You can check for this in multiple ways, for example:

```auto
ref_data0 = np.where(ref_data <= 1000, ref_data, np.nan) # The 1000 is arbitrary, change how you like
ref_values_less_mask40 = np.where(ref_data0 >= 40, ref_data0, np.nan)

```

Or single line:  
`ref_values_less_mask40 = np.where(np.logical_and(ref_data >= 40, ref_data <= 1000), ref_data, np.nan) # Again, 1000 is arbitrary`

Or exclude the nodata value with np.where(), if this is the case here.

Or just show the output of print(ref\_data). Might give some clues.
