GlobalPressureTemperatureModel.java

  1. /* Copyright 2002-2024 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.weather;

  18. import org.orekit.annotation.DefaultDataContext;
  19. import org.orekit.bodies.GeodeticPoint;
  20. import org.orekit.data.DataContext;
  21. import org.orekit.frames.Frame;
  22. import org.orekit.models.earth.Geoid;
  23. import org.orekit.models.earth.ReferenceEllipsoid;
  24. import org.orekit.models.earth.troposphere.TroposphericModelUtils;
  25. import org.orekit.time.AbsoluteDate;

  26. /** The Global Pressure and Temperature model.
  27.  * This model is an empirical model that provides the temperature and the pressure depending
  28.  * the latitude and the longitude of the station.
  29.  * <p>
  30.  * The Global Pressure and Temperature model is based on spherical harmonics up
  31.  * to degree and order of 9. The residual values ​​of this model can reach 20 hPa
  32.  * for pressure and 10 ° C for temperature. They are significant for higher latitudes and
  33.  * small near the equator (Böhm, 2007)
  34.  * </p>
  35.  *
  36.  * @see "J. Böhm, R. Heinkelmann, and H. Schuh (2007),
  37.  * Short Note: A global model of pressure and temperature for geodetic applications. J Geod,
  38.  * doi:10.1007/s00190-007-0135-3."
  39.  *
  40.  * @author Bryan Cazabonne
  41.  * @deprecated as of 12.1, replaced by {@link GlobalPressureTemperature}
  42.  */
  43. @Deprecated
  44. public class GlobalPressureTemperatureModel extends GlobalPressureTemperature implements WeatherModel {

  45.     /** Spherical harmonics degree. */
  46.     private static final int DEGREE = 9;

  47.     /** Spherical harmonics order. */
  48.     private static final int ORDER = 9;

  49.     /** Geodetic latitude, in radians. */
  50.     private final double latitude;

  51.     /** Geodetic longitude, in radians. */
  52.     private final double longitude;

  53.     /** Temperature site, in kelvins. */
  54.     private double temperature;

  55.     /** Pressure site, in hPa. */
  56.     private double pressure;

  57.     /** Build a new instance.
  58.      * <p>
  59.      * At the initialization the values of the pressure and the temperature are set to NaN.
  60.      * The user has to call {@link #weatherParameters(double, AbsoluteDate)} method before using
  61.      * the values of the pressure and the temperature.
  62.      * </p>
  63.      *
  64.      * <p>This method uses the {@link DataContext#getDefault() default data context}.
  65.      *
  66.      * @param latitude geodetic latitude, in radians
  67.      * @param longitude geodetic longitude, in radians
  68.      * @param bodyFrame the frame to attach to the ellipsoid. The origin is at
  69.      *                  the center of mass, the z axis is the minor axis.
  70.      * @see #GlobalPressureTemperatureModel(double, double, Frame, DataContext)
  71.      */
  72.     @DefaultDataContext
  73.     public GlobalPressureTemperatureModel(final double latitude, final double longitude, final Frame bodyFrame) {
  74.         this(latitude, longitude, bodyFrame, DataContext.getDefault());
  75.     }

  76.     /** Build a new instance.
  77.      * <p>
  78.      * At the initialization the values of the pressure and the temperature are set to NaN.
  79.      * The user has to call {@link #weatherParameters(double, AbsoluteDate)} method before using
  80.      * the values of the pressure and the temperature.
  81.      * </p>
  82.      * @param latitude geodetic latitude, in radians
  83.      * @param longitude geodetic longitude, in radians
  84.      * @param bodyFrame the frame to attach to the ellipsoid. The origin is at
  85.      * @param dataContext to use for time and gravity.
  86.      * @since 10.1
  87.      */
  88.     public GlobalPressureTemperatureModel(final double latitude,
  89.                                           final double longitude,
  90.                                           final Frame bodyFrame,
  91.                                           final DataContext dataContext) {
  92.         super(new Geoid(dataContext.getGravityFields().getNormalizedProvider(DEGREE, ORDER),
  93.                         ReferenceEllipsoid.getWgs84(bodyFrame)),
  94.               dataContext.getTimeScales().getUTC());
  95.         this.latitude    = latitude;
  96.         this.longitude   = longitude;
  97.         this.temperature = Double.NaN;
  98.         this.pressure    = Double.NaN;
  99.     }

  100.     /** Get the atmospheric temperature of the station depending its position.
  101.      * @return the temperature in kelvins
  102.      */
  103.     public double getTemperature() {
  104.         return temperature;
  105.     }

  106.     /** Get the atmospheric pressure of the station depending its position.
  107.      * @return the pressure in hPa
  108.      */
  109.     public double getPressure() {
  110.         return pressure;
  111.     }

  112.     @Override
  113.     public void weatherParameters(final double height, final AbsoluteDate date) {

  114.         final GeodeticPoint location = new GeodeticPoint(latitude, longitude, height);

  115.         // Pressure and temperature
  116.         final PressureTemperature pt = getWeatherParameters(location, date);
  117.         this.temperature = pt.getTemperature();
  118.         this.pressure    = TroposphericModelUtils.HECTO_PASCAL.fromSI(pt.getPressure());

  119.     }

  120. }