Advanced parameters
Payload
WebGeoCalc API requires JSON encoded payloads. An abstract 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 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'}
- class webgeocalc.payload.Payload(**kwargs)[source]
Bases:
ABCAbstract WebGeoCalc payload abstract class.
Check if any required parameters is missing.
- Raises:
CalculationRequiredAttr – If any parameter in
REQUIREDis not provided.
- property payload: dict
Payload parameters dict for JSON input in WebGeoCalc format.
Collect all the properties prefixed with
__*.- Returns:
Payload keys and values.
- Return type:
dict
Direction
Direction vectors for ANGULAR_SEPARATION and POINTING_DIRECTION can be specified as
an explicit dict but it is recommended to use an explicit with 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_typeeitherPOSITION,VELOCITYorVECTORobserver(not required ifaberration_correctionisNONEanddirection vectorisVECTOR)
- Direction
POSITIONrequired parameters: - Direction
VELOCITYrequired parameters: - Direction
VECTORrequired parameters: direction_vector_typeeitherINSTRUMENT_BORESIGHT,REFERENCE_FRAME_AXIS,VECTOR_IN_INSTRUMENT_FOV,VECTOR_IN_REFERENCE_FRAMEorINSTRUMENT_FOV_BOUNDARY_VECTORS
- Direction vector
INSTRUMENT_BORESIGHTorINSTRUMENT_FOV_BOUNDARY_VECTORSrequired parameters: - Direction vector
REFERENCE_FRAME_AXISrequired parameters: - Direction vector
VECTOR_IN_INSTRUMENT_FOVrequired parameters: - Direction vector
VECTOR_IN_REFERENCE_FRAMErequired parameters: - Default parameters:
aberration_correction:NONEanti_vector_flag:False
- class webgeocalc.direction.Direction(aberration_correction='NONE', anti_vector_flag=False, **kwargs)[source]
Bases:
PayloadWebgeocalc direction object.
- Parameters:
direction_type (str) – See:
direction_typeDepending on the desireddirection_type, different parameters are required.observer (str or int) – See:
observerNot required ifaberration_correctionisNONEanddirection vectorisVECTOR.'POSITION' (Required parameters)
target (str or int) – See:
targetshape (str) – See:
shape'VELOCITY' (Required parameters)
target – See:
targetreference_frame (str, optional) – See:
reference_frame'VECTOR' (Required parameters)
direction_vector_type (str) – See:
direction_vector_typedirection_instrument (str or int) – See:
direction_instrumentdirection_frame (str) – See:
direction_framedirection_frame_axis (str) – See:
direction_frame_axisdirection_vector_x (float) – See:
direction_vector_xdirection_vector_y (float) – See:
direction_vector_ydirection_vector_z (float) – See:
direction_vector_zdirection_vector_ra (float) – See:
direction_vector_radirection_vector_dec (float) – See:
direction_vector_decdirection_vector_az (float) – See:
direction_vector_azdirection_vector_el (float) – See:
direction_vector_elazccw_flag (bool or str) – See:
azccw_flagelplsz_flag (bool or str) – See:
elplsz_flagaberration_correction (str, optional) – See:
aberration_correction(default:NONE)anti_vector_flag (str or bool, optional) – See:
anti_vector_flag(default:False)
- property direction_type
Type of direction.
Method used to specify a direction. Directions could be specified as the position of an object as seen from the observer, as the velocity vector of an object as seen from the observer in a given reference frame, or by providing a vector in a given reference frame.
- Parameters:
direction_type (str) –
The type of direction string. One of:
POSITIONVELOCITYVECTOR
Velocity depends on the reference frame in which it is expressed.
- Raises:
CalculationInvalidAttr – If the value provided is invalid.
- property observer
Observing body.
- Parameters:
observer (str or int) – The observing body
nameoridfromAPI.bodies(). Required ifaberration_correctionis not'NONE'for direction vector of type'VECTOR'.
- property target
Target body.
- Parameters:
target (str or int) – The target body
nameoridfromAPI.bodies().
- property shape
The shape to use for the first body.
- Parameters:
shape (str) –
One of:
POINTSPHERE
- Raises:
CalculationInvalidAttr – If the value provided is invalid.
- property reference_frame
The reference frame name.
- Parameters:
reference_frame (str) – The reference frame name.
- property direction_vector_type
Direction vector type.
- Parameters:
direction_vector_type (str) –
The direction vector type string. One of:
INSTRUMENT_BORESIGHTREFERENCE_FRAME_AXISVECTOR_IN_INSTRUMENT_FOVVECTOR_IN_REFERENCE_FRAMEINSTRUMENT_FOV_BOUNDARY_VECTORS(*)
(*) only for
PointingDirectioncalculation.- Raises:
CalculationInvalidAttr – If the value provided is invalid.
CalculationRequiredAttr – If this parameter is
INSTRUMENT_BORESIGHT,VECTOR_IN_INSTRUMENT_FOVorINSTRUMENT_FOV_BOUNDARY_VECTORSbutdirection_instrumentis not provided.CalculationRequiredAttr – If this parameter is
REFERENCE_FRAME_AXISorVECTOR_IN_REFERENCE_FRAMEbutdirection_frameis not provided.CalculationRequiredAttr – If this parameter is
REFERENCE_FRAME_AXISbutdirection_frame_axisis not provided.
- property direction_instrument
The instrument direction.
Required only if
direction_vector_typeisINSTRUMENT_BORESIGHT,VECTOR_IN_INSTRUMENT_FOVorINSTRUMENT_FOV_BOUNDARY_VECTORS.- Parameters:
direction_instrument (str or int) – The instrument
nameorID.- Raises:
CalculationIncompatibleAttr – If
direction_vector_typenot inINSTRUMENT_BORESIGHT,INSTRUMENT_FOV_BOUNDARY_VECTORSorVECTOR_IN_INSTRUMENT_FOV.
- property direction_frame
The vector’s reference frame name.
Required only if
direction_vector_typeisREFERENCE_FRAME_AXISorVECTOR_IN_REFERENCE_FRAME.- Parameters:
direction_frame (str) – The vector’s reference frame name.
- Raises:
CalculationIncompatibleAttr – If
direction_vector_typeis not inREFERENCE_FRAME_AXISorVECTOR_IN_REFERENCE_FRAME.
- property direction_frame_axis
The direction vector frame axis.
Required only if
direction_vector_typeisREFERENCE_FRAME_AXIS.- Parameters:
direction_frame_axis (str) –
The direction frame axis string. One of:
XYZ
- Raises:
CalculationInvalidAttr – If the value provided is invalid.
CalculationIncompatibleAttr – If
direction_vector_typeis notREFERENCE_FRAME_AXIS.CalculationInvalidAttr – If the value provided is invalid.
- property direction_vector_x
The X direction vector coordinate.
If
direction_vector_typeisVECTOR_IN_INSTRUMENT_FOVorVECTOR_IN_REFERENCE_FRAME, then either all three ofdirection_vector_x,direction_vector_y, anddirection_vector_zmust be provided.- Parameters:
direction_vector_x (float) – The X direction vector coordinate value.
- property direction_vector_y
The Y direction vector coordinate.
If
direction_vector_typeisVECTOR_IN_INSTRUMENT_FOVorVECTOR_IN_REFERENCE_FRAME, then either all three ofdirection_vector_x,direction_vector_y, anddirection_vector_zmust be provided.- Parameters:
direction_vector_y (float) – The Y direction vector coordinate value.
- property direction_vector_z
The Z direction vector coordinate.
If
direction_vector_typeisVECTOR_IN_INSTRUMENT_FOVorVECTOR_IN_REFERENCE_FRAME, then either all three ofdirection_vector_x,direction_vector_y, anddirection_vector_zmust be provided.- Parameters:
direction_vector_z (float) – The Z direction vector coordinate value.
- property direction_vector_ra
The right ascension direction vector coordinate.
If
direction_vector_typeisVECTOR_IN_INSTRUMENT_FOVorVECTOR_IN_REFERENCE_FRAME, then either all three ofdirection_vector_raanddirection_vector_decmust be provided.- Parameters:
direction_vector_ra (float) – The right ascension direction vector coordinate value.
- property direction_vector_dec
The declination direction vector coordinate.
If
direction_vector_typeisVECTOR_IN_INSTRUMENT_FOVorVECTOR_IN_REFERENCE_FRAME, then either all three ofdirection_vector_raanddirection_vector_decmust be provided.- Parameters:
direction_vector_dec (float) – The declination direction vector coordinate value.
- property direction_vector_az
The azimuth direction vector coordinate.
If
direction_vector_typeisVECTOR_IN_INSTRUMENT_FOVorVECTOR_IN_REFERENCE_FRAME, then either all three ofdirection_vector_az,direction_vector_el,azccw_flagandelplsz_flagmust be provided.- Parameters:
direction_vector_az (float) – The azimuth direction vector coordinate value.
- property direction_vector_el
The elevation direction vector coordinate.
If
direction_vector_typeisVECTOR_IN_INSTRUMENT_FOVorVECTOR_IN_REFERENCE_FRAME, then either all three ofdirection_vector_az,direction_vector_el,azccw_flagandelplsz_flagmust be provided.- Parameters:
direction_vector_el (float) – The elevation vector coordinate value.
- property azccw_flag
Flag indicating how azimuth is measured.
If
direction_vector_typeisVECTOR_IN_INSTRUMENT_FOVorVECTOR_IN_REFERENCE_FRAME, then either all three ofdirection_vector_az,direction_vector_el,azccw_flagandelplsz_flagmust be provided.- Parameters:
azccw_flag (bool) – Flag indicating how azimuth is measured.
- Raises:
CalculationUndefinedAttr – If
direction_vector_azis not provided.CalculationInvalidAttr – If the value provided is invalid.
- property elplsz_flag
Flag indicating how elevation is measured.
If
direction_vector_typeisVECTOR_IN_INSTRUMENT_FOVorVECTOR_IN_REFERENCE_FRAME, then either all three ofdirection_vector_az,direction_vector_el,azccw_flagandelplsz_flagmust be provided.- Parameters:
elplsz_flag (bool) – ag indicating how elevation is measured.
- Raises:
CalculationUndefinedAttr – If
direction_vector_elis not provided.CalculationInvalidAttr – If the value provided is invalid.
- property aberration_correction
SPICE aberration correction.
- Parameters:
aberration_correction (str) –
The SPICE aberration correction string.
For
POSITIONorVELOCITY, one of:NONELTLT+SCNCN+SXLTXLT+SXCNXCN+S
For
VECTOR, light time correction is applied to the rotation from the vector frame toJ2000, while stellar aberration corrections apply to the vector direction. One of:NONELTCNXLTXCNSXS
- Raises:
CalculationInvalidAttr – If the value provided is invalid.
CalculationRequiredAttr – If this
DIRECTION_TYPEisVECTORandABERRATION_CORRECTIONisNONEbutobserveris not provided.
- property anti_vector_flag
Anti-vector flag.
- Parameters:
anti_vector_flag (bool) –
True if the anti-vector shall be used for the direction, and False otherwise.
In type
POSITION, required when the target shape is POINT (default). If provided when the target shape is SPHERE, it must be set to false, i.e., using anti-vector direction is not supported for target bodies modeled as spheres.- Raises:
CalculationInvalidAttr – If the value provided is invalid.
CalculationInvalidAttr – If this
direction_typeisPOSITIONandSHAPEisSPHEREbutobserveris not provided.