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.troposphere.iturp834;
18  
19  import org.hipparchus.util.FastMath;
20  import org.junit.jupiter.api.Assertions;
21  import org.junit.jupiter.api.Test;
22  import org.orekit.Utils;
23  import org.orekit.bodies.GeodeticPoint;
24  import org.orekit.data.DataSource;
25  import org.orekit.models.earth.weather.GlobalPressureTemperature3;
26  import org.orekit.models.earth.weather.PressureTemperatureHumidity;
27  import org.orekit.time.AbsoluteDate;
28  import org.orekit.time.TimeScale;
29  import org.orekit.time.TimeScalesFactory;
30  
31  import java.io.IOException;
32  import java.net.URISyntaxException;
33  import java.net.URL;
34  
35  public class ITURP834WeatherParameterProviderTest {
36  
37      @Test
38      public void testVsGPT3() throws IOException, URISyntaxException {
39          Utils.setDataRoot("regular-data");
40          final TimeScale utc = TimeScalesFactory.getUTC();
41          final AbsoluteDate date = new AbsoluteDate(2018, 11, 25, 12, 0, 0, utc);
42          final GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(47.71675), FastMath.toRadians(6.12264), 300.0);
43          final URL url = ITURP834WeatherParameterProviderTest.class.getClassLoader().getResource("gpt-grid/gpt3_5.grd");
44          final GlobalPressureTemperature3 gpt3 = new GlobalPressureTemperature3(new DataSource(url.toURI()),
45                                                                                 TimeScalesFactory.getUTC());
46          final ITURP834WeatherParametersProvider itu = new ITURP834WeatherParametersProvider(utc);
47  
48          final PressureTemperatureHumidity pth    = gpt3.getWeatherParameters(point, date);
49          final PressureTemperatureHumidity pthITU = itu.getWeatherParameters(point, date);
50          Assertions.assertEquals(pth.getAltitude(),           pthITU.getAltitude(),           1.0e-15);
51          Assertions.assertEquals(pth.getTemperature(),        pthITU.getTemperature(),        0.051);
52          Assertions.assertEquals(pth.getPressure(),           pthITU.getPressure(),           540.0);
53          Assertions.assertEquals(pth.getWaterVaporPressure(), pthITU.getWaterVaporPressure(),  89.0);
54          Assertions.assertEquals(pth.getTm(),                 pthITU.getTm(),                 1.8);
55          Assertions.assertEquals(pth.getLambda(),             pthITU.getLambda(),             0.84);
56  
57      }
58  
59  }