Skip to content

Commit

Permalink
FIX: Correct error in calculation of pulse volume. (#124)
Browse files Browse the repository at this point in the history
* FIX: Correct error in calculation of pulse volume.

We need to take half of the beam width in order to compute the base radius of our cone.
  • Loading branch information
heistermann authored and kmuehlbauer committed Nov 15, 2016
1 parent 9950d3d commit 35ce99b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def _minimal_ext_cmd(cmd):

return GIT_REVISION


# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
# update it when the contents of directories change.
if os.path.exists('MANIFEST'):
Expand Down
1 change: 1 addition & 0 deletions testrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,6 @@ def err_exit(message, rc=2):
sys.stderr.write("\n%s\n" % message)
sys.exit(rc)


if __name__ == '__main__':
main(sys.argv[1:])
8 changes: 5 additions & 3 deletions wradlib/qual.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,11 @@ def pulse_volume(ranges, h, theta):
:math:`V=(\pi/3) \cdot h \cdot (R^2 + R \cdot r + r^2)`.
R and r are the radii of the two frustum surface circles. Assuming that the
pulse width is small compared to the range, we get
:math:`R=r= \tan ( \theta \cdot \pi/180 ) \cdot range`.
:math:`R=r= \tan ( 0.5 \cdot \theta \cdot \pi/180 ) \cdot range`
with theta being the aperture angle (beam width).
Thus, the pulse volume simply becomes the volume of a cylinder with
:math:`V=\pi \cdot h \cdot range^2 \cdot \tan(\theta \cdot \pi/180)^2`
:math:`V=\pi \cdot h \cdot range^2 \cdot \tan(
0.5 \cdot \theta \cdot \pi/180)^2`
Parameters
----------
Expand All @@ -148,7 +150,7 @@ def pulse_volume(ranges, h, theta):
See :ref:`notebooks/workflow/recipe1.ipynb`.
"""
return np.pi * h * (ranges ** 2) * (np.tan(np.radians(theta))) ** 2
return np.pi * h * (ranges ** 2) * (np.tan(np.radians(theta/2.))) ** 2


def beam_block_frac(Th, Bh, a):
Expand Down
1 change: 1 addition & 0 deletions wradlib/tests/test_dp.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ class TextureTest(unittest.TestCase):
def test_texture(self):
pass


if __name__ == '__main__':
unittest.main()

0 comments on commit 35ce99b

Please sign in to comment.