1 /* Copyright 2022-2025 Thales Alenia Space
2 * Licensed to CS GROUP (CS) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * CS licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.orekit.models.earth.weather;
18
19 import org.hipparchus.CalculusFieldElement;
20 import org.hipparchus.util.SinCos;
21 import org.hipparchus.util.FieldSinCos;
22
23 /** Seasonal model used in Global Pressure Temperature models.
24 * @see "Landskron, D. & Böhm, J. J Geod (2018)
25 * VMF3/GPT3: refined discrete and empirical troposphere mapping functions
26 * 92: 349. https://doi.org/10.1007/s00190-017-1066-2"
27 * @author Luc Maisonobe
28 * @since 12.1
29 */
30 class SeasonalModel {
31
32 /** Constant. */
33 private final double a0;
34
35 /** Annual cosine amplitude. */
36 private final double a1;
37
38 /** Annual sine amplitude. */
39 private final double b1;
40
41 /** Semi-annual cosine amplitude. */
42 private final double a2;
43
44 /** Semi-annual sine amplitude. */
45 private final double b2;
46
47 /** Simple constructor.
48 * @param a0 constant
49 * @param a1 annual cosine amplitude
50 * @param b1 annual sine amplitude
51 * @param a2 semi-annual cosine amplitude
52 * @param b2 semi-annual sine amplitude
53 */
54 SeasonalModel(final double a0, final double a1, final double b1, final double a2, final double b2) {
55 this.a0 = a0;
56 this.a1 = a1;
57 this.b1 = b1;
58 this.a2 = a2;
59 this.b2 = b2;
60 }
61
62 /** Evaluate a model for some day.
63 * @param sc1 sine and cosine of yearly harmonic term
64 * @param sc2 sine and cosine of bi-yearly harmonic term
65 * @return model value at specified day
66 * @since 13.0
67 */
68 public double evaluate(final SinCos sc1, final SinCos sc2) {
69 return a0 + a1 * sc1.cos() + b1 * sc1.sin() + a2 * sc2.cos() + b2 * sc2.sin();
70 }
71
72 /** Evaluate a model for some day.
73 * @param <T> type of the field elements
74 * @param sc1 sine and cosine of yearly harmonic term
75 * @param sc2 sine and cosine of bi-yearly harmonic term
76 * @return model value at specified day
77 * @since 13.0
78 */
79 public <T extends CalculusFieldElement<T>> T evaluate(final FieldSinCos<T> sc1, final FieldSinCos<T> sc2) {
80 return sc1.cos().multiply(a1).
81 add(sc1.sin().multiply(b1)).
82 add(sc2.cos().multiply(a2)).
83 add(sc2.sin().multiply(b2)).
84 add(a0);
85 }
86
87 }