Open raffyjef opened 2 years ago
Late but also had the same issue as well in that filled()
is a numpy masked array method while dsd.time["data"]
is just a list. Simple solution is to change the time attribute declarations in the ParsivelReader module to:
"data": np.ma.array(time_secs)
There also seems to be a bunch of other bugs related to the use of masked arrays. Had a similar issue again with dsd.calculate_radar_parameters()
where masked Nd values where getting converted to NaN values so the radar params that were returned where just a bunch of NaNs. This was solved by using filled()
on dsd.Nd["data"]
before calling calculate_radar_parameters()
. Llooking into the types of the variables you're dealing with should be the right direction if you ever encounter similar problems.
Yes, I am getting NaN values when using the dsd.calculate_radar_parameters(). How do I use filled() on dsd.Nd["data"]. Sorry, I am lost.
No worries, I just overwrote the Nd data after reading my disdrometer file. My code looks a little like this,
dsd = pydsd.read_parsivel(filename)
dsd.Nd["data"] = dsd.Nd["data"].filled()
dsd.calculate_radar_parameters()
Hi @josephhardinee, I have a problem processing the file when I am trying to use functions with time. I am trying to use this codes using the ATM4.txt files
import pydsd import matplotlib.pyplot as plt import pydsd.plot import pydsd.partition
filename = 'merged_file.txt' dsd = pydsd.read_parsivel(filename) dsd.calculate_dsd_parameterization() pydsd.plot.plot_dsd(dsd) plt.show()
Here is the error:
runfile('/home/jeff/.config/spyder-py3/DSD_sample.py', wdir='/home/jeff/.config/spyder-py3') Traceback (most recent call last):
File "/home/jeff/anaconda3/envs/wradlib/lib/python3.10/site-packages/spyder_kernels/py3compat.py", line 356, in compat_exec exec(code, globals, locals)
File "/home/jeff/.config/spyder-py3/DSD_sample.py", line 21, in
pydsd.plot.plot_dsd(dsd)
File "/home/jeff/anaconda3/envs/wradlib/lib/python3.10/site-packages/PyDSD-1.0.6.2+5.g0a54715-py3.10.egg/pydsd/plot/plot.py", line 72, in plot_dsd dsd.time["data"].filled(),
AttributeError: 'list' object has no attribute 'filled'
Do you have idea to fix this? My programming skills are not that advanced. Thank you