MeteoSwiss / pyrad

Python Radar Data Processing
https://meteoswiss.github.io/pyrad/
Other
37 stars 10 forks source link

Improvement of function interpol_field in read_data_radar.py needed #26

Closed jfigui closed 1 year ago

jfigui commented 1 year ago

The function has difficulties in the transition between 360 and 0 degree so quite often the northernmost pointing ray is left blank.

wolfidan commented 1 year ago

I will take a look, @jfigui could you provide an example where this happens please?

jfigui commented 1 year ago

Sure, I will send you some test files by email

wolfidan commented 1 year ago

Hi @jfigui , issue happens when both radar objects have an azimuth value very close to zero but due to floating number precision they differ,

for example if f1.azimuth['data'][0] = 7.702979e-16 and f2.azimuth['data'][0] = 8.548066e-15

then field_interp = pyrad.io.read_data_radar.interpol_field(f1, f2, 'reflectivity')¨

will give a blank northernmost azimuth (because f2.azimuth['data'][0] > f1.azimuth['data'][0], so f1.azimuth['data'][0] (angle_new in interpol_field) is outside of interpolation range). A simple fix I would see would be to use

angle_new = np.around(angle_new, 3) angle_old = np.around(angle_old , 3) to round them to a reasonable precision that would correspond to the true measurement of the rotary encoder (and not some random floating numbers fluctuations). We could also use a much higher value such as 10 instead of 3, I don't know what would make sense. Would that be ok? Cheers,

wolfidan commented 1 year ago

Solved in https://github.com/MeteoSwiss/pyrad/releases/tag/v1.6