Problems in pyart.io.read #1670
GlutenitoBoss
started this conversation in
General
Replies: 1 comment
-
@GlutenitoBoss Hello! The field parameter only takes radar moments in to map (reflectivity, velocity etc). If the coordinate info or azimuth, elevation etc are named differently, you might need a custom reader or plug in your data to a radar object to get it to work, as the reader doesn't have a custom setting for those variables. An example of this is: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I Hi everyone,
I have a basic problem with the pyart.io.read function. My .nc file has different variable names than those used in Py-ART. For example, the variable "azimuth" appears as "azimut."
I tried using a dictionary to correct the variable names as follows:
radar = pyart.io.read(file,field_names=dict)
dict= {
'azimuth': 'azimut',
'elevation': 'elevation',
'corrected_reflectivity_horizontal': '',
'reflectivity_horizontal': 'TH',
'diff_phase': 'PHIDP',
'diff_reflectivity': 'ZDR',
'copol_coeff': 'RHOHV',
'sweep_start_ray_index': 'sweep_start_ray_index',
'sweep_mode': 'sweep_mode',
'sweep_number': 'sweep_number',
'sweep_end_ray_index': 'sweep_end_ray_index',
'fixed_angle': 'fixed_angle',
'latitude': 'latitude',
'altitude': 'altitude',
'longitude': 'longitude'
}
However, this approach does not seem to work.
How can I resolve this issue?
Thank you for your help!
Francesc
KeyError Traceback (most recent call last)
Cell In[55], line 28
25 file = '/home/francescpolls/Documents/Dades/Brice/MOUCHEROTTE_RADAR/PAM_43_data_720-1066-240m_202010021815.nc'
27 # Llegim el fitxer utilitzant el diccionari field_namesa
---> 28 radar = pyart.io.read(file, use_rsl=False,field_names=field_namesa,file_field_names=False,exclude_fields =excosos)
30 # Imprimim els camps del radar per verificar que s'han carregat correctament
31 print(radar.fields.keys())
File ~/anaconda3/envs/xiscu3/lib/python3.9/site-packages/pyart/io/auto_read.py:112, in read(filename, use_rsl, **kwargs)
110 else:
111 dset.close()
--> 112 return read_cfradial(filename, **kwargs) # CF/Radial
113 if filetype == "WSR88D":
114 return read_nexrad_archive(filename, **kwargs)
File ~/anaconda3/envs/xiscu3/lib/python3.9/site-packages/pyart/io/cfradial.py:250, in read_cfradial(filename, field_names, additional_metadata, file_field_names, exclude_fields, include_fields, delay_field_loading, use_arm_scan_name, **kwargs)
247 scan_type = "other"
249 # 4.8 Sensor pointing variables -> create attribute dictionaries
--> 250 azimuth = _ncvar_to_dict(ncvars["azimuth"])
251 elevation = _ncvar_to_dict(ncvars["elevation"])
252 if "scan_rate" in ncvars:
KeyError: 'azimuth'
Beta Was this translation helpful? Give feedback.
All reactions