# How to plot the accumulated (for a day/single plot) // how can i extract reflectivity values of stratiform and convective for evaluation

**URL:** <https://openradar.discourse.group/t/how-to-plot-the-accumulated-for-a-day-single-plot-how-can-i-extract-reflectivity-values-of-stratiform-and-convective-for-evaluation/432>\
**Category:** General\
**Tags:** xradar, wradlib, py-art, education, pyart\
**Created:** [March 21, 2024, 6:58pm UTC](https://openradar.discourse.group/t/how-to-plot-the-accumulated-for-a-day-single-plot-how-can-i-extract-reflectivity-values-of-stratiform-and-convective-for-evaluation/432 "2024-03-21T18:58:38Z")\
**Posts on this page:** 1\
**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 21, 2024, 6:58pm UTC](https://openradar.discourse.group/t/how-to-plot-the-accumulated-for-a-day-single-plot-how-can-i-extract-reflectivity-values-of-stratiform-and-convective-for-evaluation/432/1 "2024-03-21T18:58:38Z")

</div>

1)How to plot the accumulated (for a day/single plot) ?  
2)how can i extract reflectivity values of stratiform and convective for evaluation ?

My code:

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

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

for i, file in enumerate(grid\_files):  
grid\_data = pyart.io.read\_grid(file)  
feature\_dict = pyart.retrieve.feature\_detection(  
grid\_data,  
dx=2000,  
dy=2000,  
field=“REF”,  
always\_core\_thres=40,  
bkg\_rad\_km=4,  
use\_cosine=True,  
max\_diff=5,  
zero\_diff\_cos\_val=55,  
weak\_echo\_thres=10,  
max\_rad\_km=5,  
)

```
# Reshape the feature_detection field data
feature_data = feature_dict["feature_detection"]["data"][0, :, :]
feature_data_reshaped = np.broadcast_to(feature_data, (grid_data.nz,) + feature_data.shape)

# Mask the feature data
feature_masked = np.ma.masked_equal(feature_data_reshaped, 0)
feature_masked = np.ma.masked_equal(feature_masked, 3)

# Add the masked data to the grid
grid_data.add_field(
    "feature_detection", {"data": feature_masked}, replace_existing=True
)

display = pyart.graph.GridMapDisplay(grid_data)
plt.figure(figsize=(10, 8))
ax = plt.axes(projection=ccrs.PlateCarree())

display.plot_grid(
    "feature_detection",
    vmin=0,
    vmax=2,
    cmap=plt.get_cmap("viridis", 3),
    ax=ax,
    transform=ccrs.PlateCarree(),
    ticks=[1 / 3, 1, 5 / 3],
    ticklabs=["Mixed", "Stratiform", "Convective"],
)

plt.plot(75.8175, 26.8207, marker="x", color="black", markersize=15, markeredgewidth=2)
plt.title('convective stratiform-20/6/2022')
plt.show()

```
