Previous: Use WebGeoCalc API


Make a calculation

See: Documentation for more details on optional arguments setup and job submission.

Generic calculation

Webgeocalc calculation: (docs)

In [1]:
from webgeocalc import Calculation

Calculation(
    kernels = 5,
    times = '2012-10-19T08:24:00.000',
    calculation_type = 'STATE_VECTOR',
    target = 'CASSINI',
    observer = 'SATURN',
    reference_frame = 'IAU_SATURN',
    aberration_correction = 'NONE',
    state_representation = 'PLANETOGRAPHIC',
).run()
[Calculation submit] Phase: LOADING_KERNELS (id: 1618ab17-dd1b-40e2-8a02-5ce205c4a7cc)
[Calculation update] Phase: LOADING_KERNELS (id: 1618ab17-dd1b-40e2-8a02-5ce205c4a7cc)
[Calculation update] Phase: COMPLETE (id: 1618ab17-dd1b-40e2-8a02-5ce205c4a7cc)
Out[1]:
{'DATE': '2012-10-19 08:24:00.000000 UTC',
 'LONGITUDE': 46.18900522,
 'LATITUDE': 21.26337134,
 'ALTITUDE': 694259.8921163,
 'D_LONGITUDE_DT': 0.00888655,
 'D_LATITUDE_DT': -0.00031533,
 'D_ALTITUDE_DT': 4.77080305,
 'SPEED': 109.34997994,
 'TIME_AT_TARGET': '2012-10-19 08:24:00.000000 UTC',
 'LIGHT_TIME': 2.51438831}

By default, if no api option is provided, the query is sent to the WGC_URL API (if set in the global environment variables) or JPL API (if not). To query on the ESA WGC API, you need to add the ESA key to the any Calculation parameters:

In [2]:
Calculation(
    api = 'ESA',
    kernels = 6,
    times = '2014-01-01T01:23:45.000',
    calculation_type = 'STATE_VECTOR',
    target = '67P/CHURYUMOV-GERASIMENKO (1969 R1)',
    observer = 'ROSETTA ORBITER',
    reference_frame = '67P/C-G_CK',
    aberration_correction = 'NONE',
    state_representation = 'LATITUDINAL',
).run()
[Calculation submit] Phase: COMPLETE (id: b1c189c8-2824-43a8-a682-24613d6e6dae)
Out[2]:
{'DATE': '2014-01-01 01:23:45.000000 UTC',
 'LONGITUDE': -4.5904441,
 'LATITUDE': -39.43153956,
 'RADIUS': 10514625.76042228,
 'D_LONGITUDE_DT': -0.00806197,
 'D_LATITUDE_DT': 7.01746089e-08,
 'D_RADIUS_DT': -0.813433,
 'SPEED': 1142.73632133,
 'TIME_AT_TARGET': '2014-01-01 01:23:45.000000 UTC',
 'LIGHT_TIME': 35.07301628}

To query a 3-rd party API, you can either set WGC_URL on your system to use it a your main entry point (as mention before), or you can provide directly its url to the api parameter.

In [3]:
Calculation(
    api = 'https://wgc.obspm.fr/webgeocalc/api',
    kernels = 6,
    times = '2014-01-01T01:23:45.000',
    calculation_type = 'STATE_VECTOR',
    target = '67P/CHURYUMOV-GERASIMENKO (1969 R1)',
    observer = 'ROSETTA ORBITER',
    reference_frame = '67P/C-G_CK',
    aberration_correction = 'NONE',
    state_representation = 'LATITUDINAL',
).api
Out[3]:
<Api> https://wgc.obspm.fr/webgeocalc/api

Alternatively, the user can also create a custom Api object and use it directly:

In [4]:
from webgeocalc import Api

obs_api = Api('https://wgc.obspm.fr/webgeocalc/api')

Calculation(
    api = obs_api,
    kernels = 6,
    times = '2014-01-01T01:23:45.000',
    calculation_type = 'STATE_VECTOR',
    target = '67P/CHURYUMOV-GERASIMENKO (1969 R1)',
    observer = 'ROSETTA ORBITER',
    reference_frame = '67P/C-G_CK',
    aberration_correction = 'NONE',
    state_representation = 'LATITUDINAL',
).api
Out[4]:
<Api> https://wgc.obspm.fr/webgeocalc/api

In each cases, every new API is cached to improve the kernels loading performances.

State Vector

Calculates the position of one body relative to another, calculated in a desired reference frame: (docs)

In [5]:
from webgeocalc import StateVector

StateVector(
    kernels = 5,
    times = '2012-10-19T09:00:00',
    target = 'CASSINI',
    observer = 'SATURN',
    reference_frame = 'IAU_SATURN',
).run()
[Calculation submit] Phase: COMPLETE (id: 5f85a881-cd76-4cdc-8291-85eb25a92e3e)
Out[5]:
{'DATE': '2012-10-19 09:00:00.000000 UTC',
 'DISTANCE': 764142.63776247,
 'SPEED': 111.54765899,
 'X': 298292.85744169,
 'Y': -651606.58468976,
 'Z': 265224.81187627,
 'D_X_DT': -98.8032491,
 'D_Y_DT': -51.73211296,
 'D_Z_DT': -2.1416539,
 'TIME_AT_TARGET': '2012-10-19 08:59:57.451094 UTC',
 'LIGHT_TIME': 2.54890548}

Angular Separation

Calculates the angular separation of two bodies as seen by an observer body: (docs)

In [6]:
from webgeocalc import AngularSeparation

AngularSeparation(
    kernel_paths = ['pds/wgc/kernels/lsk/naif0012.tls', 'pds/wgc/kernels/spk/de430.bsp'],
    times = '2012-10-19T08:24:00.000',
    target_1 = 'VENUS',
    target_2 = 'MERCURY',
    observer = 'SUN',
).run()
[Calculation submit] Phase: COMPLETE (id: d2f28b90-f6de-47d4-b69c-8603e5e090d0)
Out[6]:
{'DATE': '2012-10-19 08:24:00.000000 UTC', 'ANGULAR_SEPARATION': 175.17072258}

Angular Size

Calculates the angular size of a target as seen by an observer: (docs)

In [7]:
from webgeocalc import AngularSize

AngularSize(
    kernels = 5,
    times = '2012-10-19T08:24:00.000',
    target = 'ENCELADUS',
    observer = 'CASSINI',
    aberration_correction = 'CN+S',
).run()
[Calculation submit] Phase: COMPLETE (id: 810fd7c7-635d-45d6-828c-ef24e8942524)
Out[7]:
{'DATE': '2012-10-19 08:24:00.000000 UTC', 'ANGULAR_SIZE': 0.03037939}

Frame Transformation

Calculate the transformation from one reference frame (Frame 1) to another reference frame (Frame 2): (docs)

In [8]:
from webgeocalc import FrameTransformation

FrameTransformation(
    kernels = 5,
    times = '2012-10-19T08:24:00.000',
    frame_1 = 'IAU_SATURN',
    frame_2 = 'IAU_ENCELADUS',
    aberration_correction = 'NONE',
).run()
[Calculation submit] Phase: COMPLETE (id: f81aac7c-01d2-4347-97e2-e8934ade1001)
Out[8]:
{'DATE': '2012-10-19 08:24:00.000000 UTC',
 'ANGLE3': -20.58940104,
 'ANGLE2': 0.01874004,
 'ANGLE1': 0.00136319,
 'AV_X': 9.94596495e-07,
 'AV_Y': -7.23492228e-08,
 'AV_Z': -0.00634331,
 'AV_MAG': 0.00634331}

Illumination Angles

Calculate the emission, phase and solar incidence angles at a point on a target as seen from an observer: (docs)

In [9]:
from webgeocalc import IlluminationAngles

IlluminationAngles(
    kernels = 5,
    times = '2012-10-19T08:24:00.000',
    target = 'ENCELADUS',
    target_frame = 'IAU_ENCELADUS',
    observer = 'CASSINI',
    aberration_correction = 'CN+S',
    latitude = 0.0,
    longitude = 0.0,
).run()
[Calculation submit] Phase: COMPLETE (id: a8546482-10c0-43d2-b07c-75ac1132a220)
Out[9]:
{'DATE': '2012-10-19 08:24:00.000000 UTC',
 'INCIDENCE_ANGLE': 24.78527742,
 'EMISSION_ANGLE': 25.56007298,
 'PHASE_ANGLE': 1.00079007,
 'OBSERVER_ALTITUDE': 967668.02765637,
 'TIME_AT_POINT': '2012-10-19 08:23:56.772207 UTC',
 'LIGHT_TIME': 3.2277931,
 'LTST': '13:15:59'}

Sub Solar Point

Calculates the sub-solar point on a target as seen from an observer: (docs)

In [10]:
from webgeocalc import SubSolarPoint

SubSolarPoint(
    kernels = 5,
    times = '2012-10-19T08:24:00.000',
    target = 'ENCELADUS',
    target_frame = 'IAU_ENCELADUS',
    observer = 'CASSINI',
    aberration_correction = 'CN+S',
).run()
[Calculation submit] Phase: COMPLETE (id: 47d473f2-77b9-4fe3-8388-d1c7d54b2e25)
Out[10]:
{'DATE': '2012-10-19 08:24:00.000000 UTC',
 'X': 234.00550655,
 'Y': -77.32612213,
 'Z': 67.42916937,
 'SUB_POINT_RADIUS': 255.50851089,
 'OBSERVER_ALTITUDE': 967644.15493281,
 'INCIDENCE_ANGLE': 4.49798357e-15,
 'EMISSION_ANGLE': 0.99611862,
 'PHASE_ANGLE': 0.99611862,
 'TIME_AT_POINT': '2012-10-19 08:23:56.772287 UTC',
 'LIGHT_TIME': 3.22771347}

Sub Observer Point

Calculate the sub-observer point on a target as seen from an observer: (docs)

In [11]:
from webgeocalc import SubObserverPoint

SubObserverPoint(
    kernels = 5,
    times = '2012-10-19T08:24:00.000',
    target = 'ENCELADUS',
    target_frame = 'IAU_ENCELADUS',
    observer = 'CASSINI',
    aberration_correction = 'CN+S',
).run()
[Calculation submit] Phase: COMPLETE (id: 07e5f27e-7372-4eb7-8405-55bcc6015d10)
Out[11]:
{'DATE': '2012-10-19 08:24:00.000000 UTC',
 'X': 232.5831733,
 'Y': -81.40386728,
 'Z': 67.35505213,
 'SUB_POINT_RADIUS': 255.45689491,
 'OBSERVER_ALTITUDE': 967644.11734179,
 'INCIDENCE_ANGLE': 0.99586304,
 'EMISSION_ANGLE': 1.66981544e-12,
 'PHASE_ANGLE': 0.99586304,
 'TIME_AT_POINT': '2012-10-19 08:23:56.772287 UTC',
 'LIGHT_TIME': 3.22771334,
 'LTST': '11:58:49'}

Surface Intercept Point

Calculate the intercept point of a vector or vectors on a target as seen from an observer: (docs)

In [12]:
from webgeocalc import SurfaceInterceptPoint

SurfaceInterceptPoint(
    kernels = 5,
    times = '2012-10-14T00:00:00',
    target = 'SATURN',
    target_frame = 'IAU_SATURN',
    observer = 'CASSINI',
    direction_vector_type = 'INSTRUMENT_BORESIGHT',
    direction_instrument = 'CASSINI_ISS_NAC',
    aberration_correction = 'NONE',
    state_representation = 'LATITUDINAL',
).run()
[Calculation submit] Phase: COMPLETE (id: 5d9566ac-652a-4aa7-b118-42c4dff55285)
Out[12]:
{'DATE': '2012-10-14 00:00:00.000000 UTC',
 'LONGITUDE': 98.7675609,
 'LATITUDE': -38.69027976,
 'INTERCEPT_RADIUS': 57739.95803153,
 'OBSERVER_ALTITUDE': 1831047.67987589,
 'INCIDENCE_ANGLE': 123.05323675,
 'EMISSION_ANGLE': 5.8567773,
 'PHASE_ANGLE': 123.77530312,
 'TIME_AT_POINT': '2012-10-14 00:00:00.000000 UTC',
 'LIGHT_TIME': 6.10771763,
 'LTST': '20:03:06'}

Osculating Elements

Calculate the osculating elements of the orbit of a target body around a central body. The orbit may be elliptical, parabolic, or hyperbolic: (docs)

In [13]:
from webgeocalc import OsculatingElements

OsculatingElements(
    kernels = [1,5],
    times = '2012-10-19T08:24:00.000',
    orbiting_body = 'CASSINI',
    center_body = 'SATURN',
).run()
[Calculation submit] Phase: COMPLETE (id: 883bdd2d-3b7c-4aa2-b91e-f787ee69945f)
Out[13]:
{'DATE': '2012-10-19 08:24:00.000000 UTC',
 'PERIFOCAL_DISTANCE': 474789.03917271,
 'ECCENTRICITY': 0.70348463,
 'INCLINATION': 38.18727034,
 'ASCENDING_NODE_LONGITUDE': 223.98123058,
 'ARGUMENT_OF_PERIAPSE': 71.59474487,
 'MEAN_ANOMALY_AT_EPOCH': 14.65461204,
 'ORBITING_BODY_RANGE': 753794.65101401,
 'ORBITING_BODY_SPEED': 8.77222231,
 'PERIOD': 2067101.2236748,
 'CENTER_BODY_GM': 37931207.49865224}

Time Conversion

Convert times from one time system or format to another: (docs)

In [14]:
from webgeocalc import TimeConversion

TimeConversion(
    kernels = 5,
    times = '1/1729329441.04',
    time_system = 'SPACECRAFT_CLOCK',
    time_format = 'SPACECRAFT_CLOCK_STRING',
    sclk_id = -82,
).run()
[Calculation submit] Phase: COMPLETE (id: 0ec03563-002b-4225-9218-6dbc4ff80e8d)
Out[14]:
{'DATE': '1/1729329441.004', 'DATE2': '2012-10-19 08:24:02.919085 UTC'}

Find time intervals when a coordinate of an observer-target position vector satisfies a condition: (docs)

In [15]:
from webgeocalc import GFCoordinateSearch

GFCoordinateSearch(
    kernels = 5,
    intervals = ['2012-10-19T07:00:00', '2012-10-19T09:00:00'],
    observer = 'CASSINI',
    target = 'ENCELADUS',
    reference_frame = 'CASSINI_ISS_NAC',
    time_step = 1,
    time_step_units = 'MINUTES',
    aberration_correction = 'NONE',
    interval_adjustment = 'EXPAND_INTERVALS',
    interval_adjustment_amount = 1,
    interval_adjustment_units = 'SECONDS',
    interval_filtering = 'FILTER_INTERVALS',
    interval_filtering_threshold = 1,
    interval_filtering_threshold_units = 'MINUTES',
    coordinate_system = 'SPHERICAL',
    coordinate = 'COLATITUDE',
    relational_condition = '<',
    reference_value = 0.25,
).run()
[Calculation submit] Phase: COMPLETE (id: e4ceb336-05f8-47b7-9e37-c64d8791e96f)
Out[15]:
{'DATE': '2012-10-19 08:39:33.812153 UTC', 'DURATION': 3394.10937738}