1   /* Copyright 2002-2025 CS GROUP
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.troposphere;
18  
19  import org.hipparchus.util.FastMath;
20  import org.junit.jupiter.api.Test;
21  import org.orekit.bodies.GeodeticPoint;
22  import org.orekit.models.earth.weather.ConstantPressureTemperatureHumidityProvider;
23  import org.orekit.models.earth.weather.PressureTemperatureHumidity;
24  import org.orekit.models.earth.weather.water.CIPM2007;
25  import org.orekit.time.AbsoluteDate;
26  import org.orekit.time.TimeScalesFactory;
27  import org.orekit.utils.TrackingCoordinates;
28  
29  public class MendesPavlisMappingFunctionTest extends AbstractMappingFunctionTest<MendesPavlisModel> {
30  
31      protected MendesPavlisModel buildMappingFunction() {
32          final double height      = 2010.344;
33          final double pressure    = TroposphericModelUtils.HECTO_PASCAL.toSI(798.4188);
34          final double temperature = 300.15;
35          final double humidity    = 0.4;
36          final PressureTemperatureHumidity pth =
37              new PressureTemperatureHumidity(height, pressure, temperature,
38                                              new CIPM2007().waterVaporPressure(pressure, temperature, humidity),
39                                              Double.NaN,  Double.NaN);
40          return new MendesPavlisModel(new ConstantPressureTemperatureHumidityProvider(pth),
41                                       0.532, TroposphericModelUtils.MICRO_M);
42      }
43  
44      @Test
45      public void testMappingFactors() {
46  
47          // Site:   McDonald Observatory
48          //         latitude:  30.67166667 °
49          //         longitude: -104.0250 °
50          //         height:    2075 m
51          //
52          // Meteo:  pressure:            798.4188 hPa
53          //         water vapor presure: 14.322 hPa
54          //         temperature:         300.15 K
55          //         humidity:            40 %
56          //
57          // Ref:    Petit, G. and Luzum, B. (eds.), IERS Conventions (2010),
58          //         IERS Technical Note No. 36, BKG (2010)
59          doTestMappingFactors(new AbsoluteDate(2009, 8, 12, 12, 0, 0, TimeScalesFactory.getUTC()),
60                               new GeodeticPoint(FastMath.toRadians(30.67166667), FastMath.toRadians(-104.0250), 2075),
61                               new TrackingCoordinates(0.0, FastMath.toRadians(15.0), 0.0),
62                               3.8002, 3.8002);
63  
64      }
65  
66      @Test
67      @Override
68      public void testDerivatives() {
69          doTestDerivatives(5.0e-16, 1.0e-100, 1.0e-100, 2.0e-8, 1.0e-100);
70      }
71  
72  }