GridEntry.java

  1. /* Copyright 2002-2024 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. import java.util.Map;

  19. import org.hipparchus.util.MathUtils;

  20. /** Grid entry in Global Pressure Temperature models.
  21.  * @author Luc Maisonobe
  22.  * @since 12.1
  23.  */
  24. class GridEntry {

  25.     /** Conversion factor from degrees to mill arcseconds. */
  26.     public static final int DEG_TO_MAS = 3600000;

  27.     /** Latitude (radian). */
  28.     private final double latitude;

  29.     /** Latitude key (mas). */
  30.     private final int latKey;

  31.     /** Longitude (radian). */
  32.     private final double longitude;

  33.     /** Longitude key (mas). */
  34.     private final int lonKey;

  35.     /** Undulation. */
  36.     private final double undulation;

  37.     /** Height correction. */
  38.     private final double hS;

  39.     /** Seasonal models. */
  40.     private Map<SeasonalModelType, SeasonalModel> models;

  41.     /** Build an entry from its components.
  42.      * @param latitude latitude (radian)
  43.      * @param latKey latitude key (mas)
  44.      * @param longitude longitude (radian)
  45.      * @param lonKey longitude key (mas)
  46.      * @param undulation undulation (m)
  47.      * @param hS height correction
  48.      * @param models seasonal models
  49.      */
  50.     GridEntry(final double latitude, final int latKey, final double longitude, final int lonKey,
  51.               final double undulation, final double hS, final Map<SeasonalModelType, SeasonalModel> models) {

  52.         this.latitude     = latitude;
  53.         this.latKey       = latKey;
  54.         this.longitude    = longitude;
  55.         this.lonKey       = lonKey;
  56.         this.undulation   = undulation;
  57.         this.hS           = hS;
  58.         this.models       = models;
  59.     }

  60.     /** Build a new entry 360° to the East of instance.
  61.      * @return new wrapping entry (always same type as instance)
  62.      */
  63.     public GridEntry buildWrappedEntry() {
  64.         return new GridEntry(latitude, latKey,
  65.                              longitude + MathUtils.TWO_PI,
  66.                              lonKey + DEG_TO_MAS * 360,
  67.                              undulation, hS,
  68.                              models);
  69.     }

  70.     /** Get latitude (radian).
  71.      * @return latitude (radian)
  72.      */
  73.     double getLatitude() {
  74.         return latitude;
  75.     }

  76.     /** Get latitude key (mas).
  77.      * @return latitude key (mas)
  78.      */
  79.     int getLatKey() {
  80.         return latKey;
  81.     }

  82.     /** Get longitude (radian).
  83.      * @return longitude (radian)
  84.      */
  85.     double getLongitude() {
  86.         return longitude;
  87.     }

  88.     /** Get longitude key (mas).
  89.      * @return longitude key (mas)
  90.      */
  91.     int getLonKey() {
  92.         return lonKey;
  93.     }

  94.     /** Get undulation.
  95.      * @return undulation
  96.      */
  97.     double getUndulation() {
  98.         return undulation;
  99.     }

  100.     /** Get height correction.
  101.      * @return height correction
  102.      */
  103.     double getHs() {
  104.         return hS;
  105.     }

  106.     /** Get a model.
  107.      * @param type model type
  108.      * @return model
  109.      */
  110.     SeasonalModel getModel(final SeasonalModelType type) {
  111.         return models.get(type);
  112.     }

  113. }