when iam trying to plot ALTITUDE VS REFLECTIVITY USING THE CODE BELOW :
import matplotlib.pyplot as plt
import numpy as np
import glob
import pyart
# Assuming grid_files is defined as in your code
grid_files = glob.glob("D:\\radar_data\\radinout\\gridded_zdr_june20_rm_clutter\\gridded*nc")
# Initialize lists to store data
altitude_list = []
reflectivity_list = []
# Iterate through each file
for i, file in enumerate(grid_files):
# Read grid data
grid_data = pyart.io.read_grid(file)
# Extracting reflectivity data
reflectivity = grid_data.fields['REF']['data']
# Append reflectivity data to the list
reflectivity_list.append(reflectivity)
# Extracting altitude data
altitude = grid_data.point_altitude['data']
# Append altitude data to the list
altitude_list.append(altitude)
# Convert lists to arrays
reflectivity_array = np.ma.concatenate(reflectivity_list, axis=1)
altitude_array = np.ma.concatenate(altitude_list, axis=1)
# Plotting line plot
plt.figure(figsize=(10, 6))
for i in range(reflectivity_array.shape[1]):
plt.plot(altitude_array[:, i], reflectivity_array[:, i])
plt.xlabel('Altitude (m)')
plt.ylabel('Reflectivity (dBZ)')
plt.title('Reflectivity vs Altitude')
plt.show()
#label=f'File {i+1}'
the loop is not ending running continuously and not getting any output.