|
| 1 | +Advanced parameters |
| 2 | +=================== |
| 3 | + |
| 4 | +Payload |
| 5 | +-------- |
| 6 | + |
| 7 | +.. currentmodule:: webgeocalc.payload |
| 8 | + |
| 9 | +WebGeoCalc API requires JSON encoded payloads. An abstract class :py:class:`Payload` is |
| 10 | +available to convert any python keywords values pattern into a structure dictionary that |
| 11 | +can be encoded into JSON. It also provided a mechanism to enforce some required keywords |
| 12 | +and restrict some parameter to a subset of ``VALID_PARAMETERS`` |
| 13 | +(see :py:mod:`webgeocalc.vars`). |
| 14 | + |
| 15 | +>>> from webgeocalc.payload import Payload |
| 16 | +>>> from webgeocalc.decorator import parameter |
| 17 | + |
| 18 | +>>> class DerivedPayload(Payload): |
| 19 | +... REQUIRED = ('foo',) |
| 20 | +... |
| 21 | +... @parameter |
| 22 | +... def foo(self, val): # required |
| 23 | +... self.__foo = val |
| 24 | +... |
| 25 | +... @parameter(only='AXIS') # optional |
| 26 | +... def baz(self, val): |
| 27 | +... self.__baz = val |
| 28 | + |
| 29 | + |
| 30 | +>>> DerivedPayload(foo='bar', baz='X').payload |
| 31 | +{'foo': 'bar', 'baz': 'X'} |
| 32 | + |
| 33 | +.. autoclass:: webgeocalc.payload.Payload |
| 34 | + |
| 35 | +Direction |
| 36 | +--------- |
| 37 | + |
| 38 | +.. currentmodule:: webgeocalc.direction |
| 39 | + |
| 40 | +Direction vectors for ``ANGULAR_SEPARATION`` and ``POINTING_DIRECTION`` can be specified as |
| 41 | +an explicit :py:type:`dict` but it is recommended to use an explicit with :py:class:`Direction` |
| 42 | +object: |
| 43 | + |
| 44 | +>>> from webgeocalc.direction import Direction |
| 45 | + |
| 46 | +>>> Direction( |
| 47 | +... direction_type='POSITION', |
| 48 | +... target='MARS', |
| 49 | +... shape='POINT', |
| 50 | +... observer='EARTH', |
| 51 | +... aberration_correction='LT+S', |
| 52 | +... ).payload |
| 53 | +{'directionType': 'POSITION', |
| 54 | + 'target': 'MARS', |
| 55 | + 'shape': 'POINT', |
| 56 | + 'observer': 'EARTH', |
| 57 | + 'aberrationCorrection': 'LT+S', |
| 58 | + 'antiVectorFlag': False} |
| 59 | + |
| 60 | +>>> Direction( |
| 61 | +... direction_type='VELOCITY', |
| 62 | +... target='MARS', |
| 63 | +... reference_frame='ITRF93', |
| 64 | +... observer='EARTH', |
| 65 | +... aberration_correction='XCN+S', |
| 66 | +... anti_vector_flag=True, |
| 67 | +... ).payload |
| 68 | +{'directionType': 'VELOCITY', |
| 69 | + 'target': 'MARS', |
| 70 | + 'referenceFrame': 'ITRF93', |
| 71 | + 'observer': 'EARTH', |
| 72 | + 'aberrationCorrection': 'XCN+S', |
| 73 | + 'antiVectorFlag': True} |
| 74 | + |
| 75 | +>>> Direction( |
| 76 | +... direction_type='VECTOR', |
| 77 | +... observer='EARTH', |
| 78 | +... direction_vector_type='REFERENCE_FRAME_AXIS', |
| 79 | +... direction_frame='IAU_EARTH', |
| 80 | +... direction_frame_axis='X', |
| 81 | +... aberration_correction='S', |
| 82 | +... anti_vector_flag=True, |
| 83 | +... ).payload |
| 84 | +{'directionType': 'VECTOR', |
| 85 | + 'observer': 'EARTH', |
| 86 | + 'directionVectorType': 'REFERENCE_FRAME_AXIS', |
| 87 | + 'directionFrame': 'IAU_EARTH', |
| 88 | + 'directionFrameAxis': 'X', |
| 89 | + 'aberrationCorrection': 'S', |
| 90 | + 'antiVectorFlag': True} |
| 91 | + |
| 92 | +.. important:: |
| 93 | + |
| 94 | + Direction required parameters: |
| 95 | + - :py:attr:`~Direction.direction_type` either ``POSITION``, ``VELOCITY`` or ``VECTOR`` |
| 96 | + - :py:attr:`~Direction.observer` (not required if :py:attr:`aberration_correction` is ``NONE`` |
| 97 | + and :py:attr:`~Direction.direction vector` is ``VECTOR``) |
| 98 | + |
| 99 | + Direction ``POSITION`` required parameters: |
| 100 | + - :py:attr:`~Direction.target` |
| 101 | + - :py:attr:`~Direction.shape` |
| 102 | + |
| 103 | + Direction ``VELOCITY`` required parameters: |
| 104 | + - :py:attr:`~Direction.target` |
| 105 | + - :py:attr:`~Direction.reference_frame` |
| 106 | + |
| 107 | + Direction ``VECTOR`` required parameters: |
| 108 | + - :py:attr:`~Direction.direction_vector_type` either |
| 109 | + ``INSTRUMENT_BORESIGHT``, ``REFERENCE_FRAME_AXIS``, ``VECTOR_IN_INSTRUMENT_FOV``, |
| 110 | + ``VECTOR_IN_REFERENCE_FRAME`` or ``INSTRUMENT_FOV_BOUNDARY_VECTORS`` |
| 111 | + |
| 112 | + Direction ``VECTOR + INSTRUMENT_BORESIGHT`` required parameters: |
| 113 | + - :py:attr:`~Direction.direction_instrument` |
| 114 | + |
| 115 | + Direction ``VECTOR + REFERENCE_FRAME_AXIS`` required parameters: |
| 116 | + - :py:attr:`~Direction.direction_frame` |
| 117 | + - :py:attr:`~Direction.direction_frame_axis` |
| 118 | + |
| 119 | + Direction ``VECTOR + VECTOR_IN_INSTRUMENT_FOV`` required parameters: |
| 120 | + - :py:attr:`~Direction.direction_instrument` |
| 121 | + - :py:attr:`~Direction.direction_vector_x`, :py:attr:`~Direction.direction_vector_y` and :py:attr:`~Direction.direction_vector_z` |
| 122 | + or :py:attr:`~Direction.direction_vector_ra` and :py:attr:`~Direction.direction_vector_dec` |
| 123 | + or :py:attr:`~Direction.direction_vector_az`, :py:attr:`~Direction.direction_vector_el`, :py:attr:`~Direction.azccw_flag` |
| 124 | + and :py:attr:`~Direction.elplsz_flag`, |
| 125 | + |
| 126 | + Default parameters: |
| 127 | + - :py:attr:`~Direction.aberration_correction`: ``NONE`` |
| 128 | + - :py:attr:`~Direction.anti_vector_flag`: ``False`` |
| 129 | + |
| 130 | + |
| 131 | +.. autoclass:: Direction |
0 commit comments