-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is beam profile overlap help behaving correctly? #415
Comments
Hi @bart1 and @BerendWijers , thanks for catching this bug. Strictly I would say In practice for this specific case it doesn't make much numerical difference, because omitting NA values in these final statements within a sum is identical to setting those elements to zero: Lines 220 to 222 in 001f6a3
So it boils down to whether we like how typically your
Mathematically |
I definitely agree v <- seq(-.5,5,length.out=100)
ipol1=approxfun(0:4, c(25, 50, NA, 50, 25), na.rm = F)(v)
ipol2=approxfun(0:4, c(25, 50, 0, 50, 25))(v)
ipol3=approxfun(0:4, c(25, 50, NA, 50, 25))(v)
plot(c(0,1,3,4),c(25, 50, 50, 25), col='red',pch=16,ylim=c(0,50))
points(v,ipol2,pch=2,col='blue')
points(v,ipol1,col='green')
points(v,ipol3,pch=3, col='red') Created on 2021-01-07 by the reprex package (v0.3.0) To summarize I make two changes first |
Hi @bart1, you're right the
eta becomes zero if the airspace is empty (linear reflectivity zero, log reflectivity -Inf dBZ) or when it's set to zero by Looking at this example of alternating values and NAs:
Here replacing NA with zeros might be a better solution after all, to avoid the interpolation become overwhelmingly NA, even when half of the interpolated vector has valid values. Let me know what you think, and please go ahead with making the change. We should also properly document this in the help pages. |
@bart1 I was preparing a pull request to bring the master branch up to date with latest developments, so fixed this one quickly as well, let me know if it doesn't behave as expected |
Thanks I agree with the solution, I tested and can confirm it works like expected |
While working with @BerendWijers we noticed a error in the
intergrate_to_ppi
function. It fails when there is only one nonNA
values in theeta
quantity of the vp:This error comes from the following bit of
beam_profile_overlap_help
:bioRad/R/beam.R
Lines 210 to 217 in 001f6a3
It is here accounted for that all
quantity
values can beNA
in which caseNA
is returned howeverapproxfun
also fails when there is only one noneNA
value. A fix could be to also returnNA
when there is only one noneNA
values. Thinking about this a bit more I do however wonder if the current behavior of this function is correct asapproxfun
omits allNA
values while it might be the case that these should actually be assumed to be zero. I think this is most easily illustrated by the following example:I think if we really think
NA
means zero the last interpolation (where allNA
s are replaced by0
) might be the most valid.@adokter what do you think? I cant completely see through where and how this function is used so I did not directly want to change it but thought I would bring it up
Created on 2021-01-07 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: