|
| 1 | +""" |
| 2 | + DCM_MOON_PA440_TO_ME421 |
| 3 | +
|
| 4 | +DCM for the rotation from the Moon Principal Axis 440 (PA440) to the Moon Mean |
| 5 | +Earth/Mean Rotation DE421 (ME421) axes. |
| 6 | +
|
| 7 | +### References |
| 8 | + - Park, S. R. et al. (2021), _The JPL Planetary and Lunar Ephemerides DE440 and DE441_, |
| 9 | + [DOI: 10.3847/1538-3881/abd414](https://doi.org/10.3847/1538-3881/abd414) |
| 10 | +
|
| 11 | +""" |
| 12 | +const DCM_MOON_PA440_TO_ME421 = angle_to_dcm( |
| 13 | + arcsec2rad(-67.8526), arcsec2rad(-78.6944), arcsec2rad(-0.2785), :ZYX |
| 14 | +) |
| 15 | + |
| 16 | +""" |
| 17 | + DCM_MOON_PA430_TO_ME430 |
| 18 | +
|
| 19 | +DCM for the rotation from the Moon Principal Axis 430 (PA430) to the Moon Mean |
| 20 | +Earth/Mean Rotation DE430 (ME430) axes. |
| 21 | +
|
| 22 | +### References |
| 23 | +- Folkner M. William et al. (2014), _The Planetary and Lunar EphemeridesDE430 and DE431_ |
| 24 | +
|
| 25 | +- J. G. Williams et al. (2013), _DE430 Lunar Orbit, Physical Librations, and Surface Coordinates_, |
| 26 | + [DE430 Lunar Ephemeris and Orientation](https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de430_moon_coord.pdf) |
| 27 | +
|
| 28 | +""" |
| 29 | +const DCM_MOON_PA430_TO_ME430 = angle_to_dcm( |
| 30 | + arcsec2rad(-67.573), arcsec2rad(-78.58), arcsec2rad(-0.285), :ZYX |
| 31 | +) |
| 32 | + |
| 33 | +""" |
| 34 | + DCM_MOON_PA430_TO_ME421 |
| 35 | +
|
| 36 | +DCM for the rotation from the Moon Principal Axis 430 (PA430) to the Moon Mean |
| 37 | +Earth/Mean Rotation DE421 (ME421) axes. |
| 38 | +
|
| 39 | +### References |
| 40 | +- Folkner M. William et al. (2014), _The Planetary and Lunar EphemeridesDE430 and DE431_ |
| 41 | +
|
| 42 | +- J. G. Williams et al. (2013), _DE430 Lunar Orbit, Physical Librations, and Surface Coordinates_, |
| 43 | + [DE430 Lunar Ephemeris and Orientation](https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de430_moon_coord.pdf) |
| 44 | +
|
| 45 | +""" |
| 46 | +const DCM_MOON_PA430_TO_ME421 = angle_to_dcm( |
| 47 | + arcsec2rad(-67.737), arcsec2rad(-78.627), arcsec2rad(-0.295), :ZYX |
| 48 | +) |
| 49 | + |
| 50 | +""" |
| 51 | + DCM_MOON_PA421_TO_ME421 |
| 52 | +
|
| 53 | +DCM for the rotation from the Moon Principal Axis 421 (PA421) to the Moon Mean |
| 54 | +Earth/Mean Rotation DE421 (ME421) axes. |
| 55 | +
|
| 56 | +### References |
| 57 | +- J. G. Williams et al. (2008), _DE421 Lunar Orbit, Physical Librations, and Surface Coordinates_, |
| 58 | + [DE421 Lunar Ephemeris and Orientation](https://naif.jpl.nasa.gov/pub/naif/generic_kernels/fk/satellites/de421_lunar_ephemeris_and_orientation.pdf) |
| 59 | +
|
| 60 | +""" |
| 61 | +const DCM_MOON_PA421_TO_ME421 = angle_to_dcm( |
| 62 | + arcsec2rad(-67.92), arcsec2rad(-78.56), arcsec2rad(-0.3), :ZYX |
| 63 | +) |
| 64 | + |
| 65 | +""" |
| 66 | + add_axes_pa440!(frames, eph::AbstractEphemerisProvider, name::Symbol, |
| 67 | + id::Int=AXESID_MOONPA_DE440) |
| 68 | +
|
| 69 | +Add DE440 Moon's Principal Axes (PA) axes to `frames`. The libration angles are extracted |
| 70 | +from the `eph` ephemeris kernels, an error is thrown if such orientation data is not available. |
| 71 | +
|
| 72 | +!!! warning |
| 73 | + The parent axes are automatically set to the ICRF (ID = $(AXESID_ICRF)). If such |
| 74 | + axes are not registered in the frame system, an error is thrown. |
| 75 | +
|
| 76 | +!!! warning |
| 77 | + To properly read the ephemeris kernels, the ID associated to the input `axes` must match |
| 78 | + NAIF's FRAME ID for the Moon PA DE440 axes ($(AXESID_MOONPA_DE440)). |
| 79 | +""" |
| 80 | +function add_axes_pa440!( |
| 81 | + frames::FrameSystem, eph::AbstractEphemerisProvider, name::Symbol, |
| 82 | + id::Int=AXESID_MOONPA_DE440 |
| 83 | +) |
| 84 | + if !(has_axes(frames, AXESID_ICRF)) |
| 85 | + throw( |
| 86 | + ErrorException( |
| 87 | + "The DE440 Moon Principal Axes (PA) can only be defined w.r.t. the" * |
| 88 | + " ICRF (ID = $(AXESID_ICRF)), which is not defined" * |
| 89 | + " in the current frames graph." |
| 90 | + ) |
| 91 | + ) |
| 92 | + end |
| 93 | + |
| 94 | + # Throw a warning if the ID does not match the standard one. |
| 95 | + if id != AXESID_MOONPA_DE440 |
| 96 | + throw( |
| 97 | + ArgumentError( |
| 98 | + "$name is aliasing an ID that is not the standard PA440" * |
| 99 | + " ID ($(AXESID_MOONPA_DE440))." |
| 100 | + ) |
| 101 | + ) |
| 102 | + end |
| 103 | + |
| 104 | + return add_axes_ephemeris!(frames, eph, name, id, :ZXZ) |
| 105 | +end |
| 106 | + |
| 107 | +""" |
| 108 | + add_axes_pa421!(frames, eph::AbstractEphemerisProvider, name::Symbol, |
| 109 | + id::Int=AXESID_MOONPA_DE421) |
| 110 | +
|
| 111 | +Add DE421 Moon's Principal Axes (PA) axes to `frames`. The libration angles are extracted |
| 112 | +from the `eph` ephemeris kernels, an error is thrown if such orientation data is not available. |
| 113 | +
|
| 114 | +!!! warning |
| 115 | + The parent axes are automatically set to the ICRF (ID = $(AXESID_ICRF)). If such |
| 116 | + axes are not registered in the frame system, an error is thrown. |
| 117 | +
|
| 118 | +!!! warning |
| 119 | + To properly read the ephemeris kernels, the ID associated to the input `axes` must match |
| 120 | + NAIF's FRAME ID for the Moon PA DE421 axes ($(AXESID_MOONPA_DE421)). |
| 121 | +""" |
| 122 | +function add_axes_pa421!( |
| 123 | + frames::FrameSystem, eph::AbstractEphemerisProvider, name::Symbol, |
| 124 | + id::Int=AXESID_MOONPA_DE421 |
| 125 | +) |
| 126 | + if !(has_axes(frames, AXESID_ICRF)) |
| 127 | + throw( |
| 128 | + ErrorException( |
| 129 | + "The DE421 Moon Principal Axes (PA) can only be defined w.r.t. the" * |
| 130 | + " ICRF (ID = $(AXESID_ICRF)), which is not defined" * |
| 131 | + " in the current frames graph." |
| 132 | + ) |
| 133 | + ) |
| 134 | + end |
| 135 | + |
| 136 | + # Throw a warning if the ID does not match the standard one. |
| 137 | + if id != AXESID_MOONPA_DE421 |
| 138 | + throw( |
| 139 | + ArgumentError( |
| 140 | + "$name is aliasing an ID that is not the standard PA421" * |
| 141 | + " ID ($(AXESID_MOONPA_DE421))." |
| 142 | + ) |
| 143 | + ) |
| 144 | + end |
| 145 | + |
| 146 | + return add_axes_ephemeris!(frames, eph, name, id, :ZXZ) |
| 147 | +end |
| 148 | + |
| 149 | +""" |
| 150 | + add_axes_me421!(frames, name::Symbol, parentid::Int, axesid::Int=AXESID_MOONME_DE421) |
| 151 | +
|
| 152 | +Add DE421 Moon's Mean Earth/Mean Rotation (ME) axes to `frames`. |
| 153 | +
|
| 154 | +!!! warning |
| 155 | + The `parent` set of axes must either the DE440 Principal Axes (PA440, ID = |
| 156 | + $(AXESID_MOONPA_DE440)) or the DE421 Principal Axes (PA421, ID = |
| 157 | + $(AXESID_MOONPA_DE421)), otherwise an error is thrown. Depending on that, the |
| 158 | + relative axes orientation will be automatically selected by this function. |
| 159 | +""" |
| 160 | +function add_axes_me421!( |
| 161 | + frames::FrameSystem, name::Symbol, parent, id::Int=AXESID_MOONME_DE421 |
| 162 | +) |
| 163 | + pid = axes_id(frames, parent) |
| 164 | + if pid == AXESID_MOONPA_DE421 |
| 165 | + dcm = DCM_MOON_PA421_TO_ME421 |
| 166 | + |
| 167 | + elseif pid == AXESID_MOONPA_DE440 |
| 168 | + dcm = DCM_MOON_PA440_TO_ME421 |
| 169 | + |
| 170 | + else |
| 171 | + |
| 172 | + throw( |
| 173 | + ArgumentError( |
| 174 | + "The DE421 Mean Earth/Mean Rotation (ME) axes cannot be defined w.r.t." * |
| 175 | + " axes with ID $pid. Only the DE440 (ID = $(AXESID_MOONPA_DE440))" * |
| 176 | + " or DE421 (ID = $(AXESID_MOONPA_DE421)) Moon Principal Axes are" * |
| 177 | + " accepted as parent axes.", |
| 178 | + ), |
| 179 | + ) |
| 180 | + end |
| 181 | + |
| 182 | + if id != AXESID_MOONME_DE421 |
| 183 | + @warn "$(name) is aliasing an ID that is not the standard ME421" * |
| 184 | + "ID ($(AXESID_MOONME_DE421))." |
| 185 | + end |
| 186 | + |
| 187 | + return add_axes_fixedoffset!(frames, name, id, pid, dcm) |
| 188 | +end |
0 commit comments