Source code for irfpy.jdc.fov0
''' JDC fov module.
As of I know only little on JDC, I made this module for a draft use.
Thus, I added ``0`` in the trail of the module.
FOV 90x360 for each sensor with resolution of 5.5x19.5 means
the 16x16 separation, as a maximum, while I doubt such high number
of bins. But for the draft purpose, I just implement following the
number. The implementation will be changed as the sensor design progresses.
'''
import numpy as np
[docs]def elev_pix_center(nel):
r''' Elevation pixel center in degrees.
The JDC has two units. Number definition is, preliminary,
0 to 15 for JDC on nadir unit and 16 to 31 for zenith.
Ch-0 corresponds to the nadir-looking and 31 for zenith looking.
The definition of angle, :math:`\theta` is 0 for zenith looking
and 180 is nadir looking.
Thus, the expression is
.. math::
\theta = (180. / 32.) * (31 - nel) + (180. / 64.)
Note that the ``nel`` is usually ``int`` or ``np.array`` with
``dtype=np.int``, but ``float`` may be allowed for special use.
:param nel: Number of elevation. 0 to 31.
:type nel: ``int``, ``float`` or ``np.array``.
:return: The elevation angle.
:rtype: ``np.array``
>>> print(elev_pix_center(0))
177.1875
>>> print(elev_pix_center(8))
132.1875
>>> print(elev_pix_center(31))
2.8125
>>> print(elev_pix_center([31, 23, 0]))
[ 2.8125 47.8125 177.1875]
Note also that the returned type is np.array object, even
the given parameter is a scalar. In this case, np.array object
with shape ``()`` is returned.
>>> print(elev_pix_center(8).shape)
()
'''
return (180. / 32.) * (31.5 - np.array(nel))
[docs]def elev_pix_fwhm(nel):
''' Return the FWHM
For draft, I just return 5.5 for simplicity.
'''
return 5.5 + np.zeros_like(nel)
[docs]def azim_pix_center(naz):
r''' Return the azimuthal angle for the given channel number(s).
Similar to :meth:`elev_pix_center`, the azimuthal angle,
:math:`\phi` is returned.
.. math::
\phi = naz * 22.5 + 11.25
>>> print(azim_pix_center(0))
11.25
>>> print(azim_pix_center(15))
348.75
>>> print(azim_pix_center([6, 7, 8]))
[146.25 168.75 191.25]
'''
return np.array(naz) * 22.5 + 11.25
[docs]def azim_pix_fwhm(naz):
''' Return the FWHM
For draft, I just return 19.5 for simplicity.
'''
return 19.5 + np.zeros_like(naz)
import unittest
import doctest
[docs]def doctests():
return unittest.TestSuite((
doctest.DocTestSuite(),
))
if __name__ == '__main__':
unittest.main(defaultTest='doctests')