Replies: 4 comments 1 reply
-
@RBhupi - can you print plot using the actual range value as opposed to the index number of the range to ensure this is not related to ordering of the in-memory representation? ie. plot T with respect to range (0 to ~50 km or whatever the range of the radar is) instead of 0 to 400 |
Beta Was this translation helpful? Give feedback.
-
Thank you @mgrover1 The range array is exactly equal.
Here.
|
Beta Was this translation helpful? Give feedback.
-
@RBhupi - you are selecting two different azimuths. If you check to see the azimuth is equal using that indexing strategy, you will see that they are not the same azimuth. |
Beta Was this translation helpful? Give feedback.
-
@RBhupi - if you plot out the azimuths, import numpy as np
import matplotlib.pyplot as plt
import xradar as xd
import pyart
file_name = 'gucxprecipradarcmacppiS2.c1.20220825.194643.nc'
#xradar
radar_xr = xd.io.open_cfradial1_datatree(file_name)
geo_ds = xd.georeference.get_x_y_z(radar_xr['sweep_0'].to_dataset())
# trying first sweep
sounding_temp_xr = geo_ds['sounding_temperature'].values[0, :]
range_xr = geo_ds['range'].values/1000 # kilometers
azimuth_xr = geo_ds["azimuth"].values
# From pyart
radar_pyart = pyart.io.read(file_name)
radar_pyart = radar_pyart.extract_sweeps([0])
#trying first sweep
sounding_temp_pyart = radar_pyart.fields['sounding_temperature']['data'][0, :]
range_pyart = radar_pyart.range['data']/1000
azimuth_pyart = radar_pyart.azimuth["data"]
# this is not equal
print(f"xradar temperature: {sounding_temp_xr[100]} and pyart {sounding_temp_pyart[100]}.")
sounding_temp_xr==sounding_temp_pyart
# Plot
plt.plot(azimuth_pyart, label='pyart azimuth')
plt.plot(azimuth_xr, label='xradar azimuth')
plt.xlabel("index number of azimuth")
plt.ylabel("azimuth (degrees)")
plt.legend() You will notice that xradar sorts the azimuths in ascending order, Py-ART has a slightly different sorting of the azimuths. Neither is necessarily correct/incorrect, it just depends how you sort the arrays. |
Beta Was this translation helpful? Give feedback.
-
Description
I am expecting the sounding temperature values to match between xradar and Py-ART, but they don't mathc in the following code. I think I am misunderstanding the differences in how Py-ART and xradar stores data in their objects, and this confusion is causing the inconsistency. I have tried checking if the sweeps are reversed (using [-1] instead of 0), but that hasn’t resolved the issue either.
What I Did
Beta Was this translation helpful? Give feedback.
All reactions