Skip to content

Latest commit

 

History

History
131 lines (105 loc) · 4.21 KB

File metadata and controls

131 lines (105 loc) · 4.21 KB

Advanced parameters

Payload

.. currentmodule:: webgeocalc.payload

WebGeoCalc API requires JSON encoded payloads. An abstract class :py:class:`Payload` is available to convert any python keywords values pattern into a structure dictionary that can be encoded into JSON. It also provided a mechanism to enforce some required keywords and restrict some parameter to a subset of VALID_PARAMETERS (see :py:mod:`webgeocalc.vars`).

>>> from webgeocalc.payload import Payload
>>> from webgeocalc.decorator import parameter
>>> class DerivedPayload(Payload):
...     REQUIRED = ('foo',)
...
...     @parameter
...     def foo(self, val):  # required
...         self.__foo = val
...
...     @parameter(only='AXIS')  # optional
...     def baz(self, val):
...         self.__baz = val
>>> DerivedPayload(foo='bar', baz='X').payload
{'foo': 'bar', 'baz': 'X'}
.. autoclass:: webgeocalc.payload.Payload

Direction

.. currentmodule:: webgeocalc.direction

Direction vectors for ANGULAR_SEPARATION and POINTING_DIRECTION can be specified as an explicit :py:type:`dict` but it is recommended to use an explicit with :py:class:`Direction` object:

>>> from webgeocalc.direction import Direction
>>> Direction(
...     direction_type='POSITION',
...     target='MARS',
...     shape='POINT',
...     observer='EARTH',
...     aberration_correction='LT+S',
... ).payload
{'directionType': 'POSITION',
 'target': 'MARS',
 'shape': 'POINT',
 'observer': 'EARTH',
 'aberrationCorrection': 'LT+S',
 'antiVectorFlag': False}
>>> Direction(
...     direction_type='VELOCITY',
...     target='MARS',
...     reference_frame='ITRF93',
...     observer='EARTH',
...     aberration_correction='XCN+S',
...     anti_vector_flag=True,
... ).payload
{'directionType': 'VELOCITY',
 'target': 'MARS',
 'referenceFrame': 'ITRF93',
 'observer': 'EARTH',
 'aberrationCorrection': 'XCN+S',
 'antiVectorFlag': True}
>>> Direction(
...     direction_type='VECTOR',
...     observer='EARTH',
...     direction_vector_type='REFERENCE_FRAME_AXIS',
...     direction_frame='IAU_EARTH',
...     direction_frame_axis='X',
...     aberration_correction='S',
...     anti_vector_flag=True,
... ).payload
{'directionType': 'VECTOR',
 'observer': 'EARTH',
 'directionVectorType': 'REFERENCE_FRAME_AXIS',
 'directionFrame': 'IAU_EARTH',
 'directionFrameAxis': 'X',
 'aberrationCorrection': 'S',
 'antiVectorFlag': True}

Important

Direction required parameters:
Direction POSITION required parameters:
Direction VELOCITY required parameters:
Direction VECTOR required parameters:
Direction VECTOR + INSTRUMENT_BORESIGHT required parameters:
Direction VECTOR + REFERENCE_FRAME_AXIS required parameters:
Direction VECTOR + VECTOR_IN_INSTRUMENT_FOV required parameters:
Default parameters:
.. autoclass:: Direction