Trajectory and ROIs intersections#
traj in roi
#
A Trajectory
object can be compared with an ROI
object
to know if, at least, one point of the Trajectory
is inside the ROI
.
For that, you can use the python in
keyword between the Trajectory
and the ROI
:
sc_traj in GanymedeROIs[1, 0, 1]
True
sc_traj in GanymedeROIs[1, 0, 3]
False
The intersection can also be computed for a ROIsCollection
:
sc_traj in GanymedeROIs[1]
True
sc_traj in GanymedeROIs
True
In all cases, the results will always be a single boolean.
traj & roi
#
Danger
The intersection operators (&
and ^
) are not commutative.
If you need to compute the actual intersection between the Trajectory
and a ROI
, you need to use the intersection operator &
:
sc_traj & GanymedeROIs[1, 0, 1]
<MaskedSpacecraftTrajectory> Observer: JUICE | Target: GANYMEDE
- First UTC start time: 2035-06-01T10:32:00.000
- Last UTC stop time: 2035-06-01T16:44:00.000
- Nb of pts: 18 (+1,423 masked)
- Nb of segments: 3
In this case, you will get a MaskedSpacecraftTrajectory
object that contains only the portion of the trajectory that intersects the ROI
.
Here, only 13
points were kept out of the initial 1441
.
The intersection also works on a ROIsCollection
:
sc_traj & GanymedeROIs[1]
<MaskedSpacecraftTrajectory> Observer: JUICE | Target: GANYMEDE
- First UTC start time: 2035-06-01T00:33:00.000
- Last UTC stop time: 2035-06-01T23:52:00.000
- Nb of pts: 278 (+1,163 masked)
- Nb of segments: 54
traj ^ roi
#
If you need the complementary Trajectory
not in the ROIsCollection
, you can use the symmetrical difference operator ^
:
sc_traj ^ GanymedeROIs[1, 0, 1]
<MaskedSpacecraftTrajectory> Observer: JUICE | Target: GANYMEDE
- First UTC start time: 2035-06-01T00:00:00.000
- Last UTC stop time: 2035-06-02T00:00:00.000
- Nb of pts: 1,423 (+18 masked)
- Nb of segments: 4
roi & traj
#
When you intersect an ROIsCollection
you will get a sub-selection of the ROIs that are intersected by the Trajectory
:
GanymedeROIs[1] & sc_traj
<ROIsCollection> 12 rois
- JUICE_ROI_GAN_1_0_01
- JUICE_ROI_GAN_1_0_02
- JUICE_ROI_GAN_1_0_04
- JUICE_ROI_GAN_1_0_05
- JUICE_ROI_GAN_1_0_06
- JUICE_ROI_GAN_1_0_08
- JUICE_ROI_GAN_1_0_10
- JUICE_ROI_GAN_1_0_12
- JUICE_ROI_GAN_1_0_13
- JUICE_ROI_GAN_1_0_14
- JUICE_ROI_GAN_1_0_17
- JUICE_ROI_GAN_1_0_19
If you intersect an ROI
with a Trajectory
, you will get the ROI
object itself if the intersection is valid or an EmptyROI
if it is not.
GanymedeROIs[1, 0, 3] & sc_traj
<EmptyROI>
Important
If a target
attribute is available in the Trajectory
and in the ROI
, the intersection will also check their values to make sure that they correspond to the same target:
>>> CallistoROIs & sc_traj
<ROIsCollection> No roi
roi ^ traj
#
The symmetrical difference can also be reversed to get a ROIsCollection
of all the ROI
that are not intersected by the Trajectory
:
GanymedeROIs[1] ^ sc_traj
<ROIsCollection> 7 rois
- JUICE_ROI_GAN_1_0_03
- JUICE_ROI_GAN_1_0_07
- JUICE_ROI_GAN_1_0_09
- JUICE_ROI_GAN_1_0_11
- JUICE_ROI_GAN_1_0_15
- JUICE_ROI_GAN_1_0_16
- JUICE_ROI_GAN_1_0_18
fovs & roi
#
Caution
The intersection between an FovsCollection
and an ROI
is not implemented yet.
You should use the intersection with the InstrumentTrajectory
for now.
In that case, the intersection is performed with the instrument boresight.
Representation on a Map#
Using the logical operator you can quickly represent the intersection between the groundtrack trajectory and Ganymede polar deposits (i.e. in the sub-category 1
):
fig = plt.figure(figsize=(12, 9))
ax = fig.add_subplot(projection=GANYMEDE)
ax.plot(sc_traj & GanymedeROIs[1], color='r', linewidth=3)
ax.plot(sc_traj ^ GanymedeROIs[1], color='w', linestyle='--')
ax.add_collection((GanymedeROIs[1] & sc_traj)(edgecolors='r', linewidth=3))
ax.add_collection((GanymedeROIs[1] ^ sc_traj)(edgecolors='w', linestyle='--'));
ax.set_title('JUICE groundtrack intersecting the Ganymede polar deposits');

Export ROI temporal coverage#
Similarly to the Trajectory
segments, you can export the intersection between your Trajectory
and your ROI
/ROIsCollection
with the esa.export_timeline()
function presented here.