OceanLoadingCoefficients.java

  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.displacement;

  18. import org.orekit.bodies.GeodeticPoint;

  19. /**
  20.  * Site specific coefficients for ocean loading.
  21.  * <p>
  22.  * Instances of this class are typically created by
  23.  * {@link OceanLoadingCoefficientsBLQFactory} that parses
  24.  * files from Onsala Space Observatory files in BLQ format
  25.  * found in the Orekit data configuration.
  26.  * </p>
  27.  * <p>
  28.  * Instances of this class are guaranteed to be immutable
  29.  * </p>
  30.  * @see org.orekit.estimation.measurements.GroundStation
  31.  * @see OceanLoadingCoefficientsBLQFactory
  32.  * @see OceanLoading
  33.  * @since 9.1
  34.  * @author Luc Maisonobe
  35.  */
  36. public class OceanLoadingCoefficients {

  37.     /** Site name. */
  38.     private final String siteName;

  39.     /** Site location. */
  40.     private final GeodeticPoint siteLocation;

  41.     /** Main tides by species and increasing rate. */
  42.     private final Tide[][] tides;

  43.     /** Amplitude along zenith axis for main tides by species and increasing rate. */
  44.     private final double[][] zAmplitude;

  45.     /** Phase along zenith axis for main tides by species and increasing rate. */
  46.     private final double[][] zPhase;

  47.     /** Amplitude along West axis for main tides by species and increasing rate. */
  48.     private final double[][] wAmplitude;

  49.     /** Phase along West axis for main tides by species and increasing rate. */
  50.     private final double[][] wPhase;

  51.     /** Amplitude along South axis for main tides by species and increasing rate. */
  52.     private final double[][] sAmplitude;

  53.     /** Phase along South axis for main tides by species and increasing rate. */
  54.     private final double[][] sPhase;

  55.     /** Simple constructor.
  56.      * <p>
  57.      * Arrays must be organized by species and sorted in increasing rate order.
  58.      * @param siteName site name
  59.      * @param siteLocation site location
  60.      * @param tides main tides, by species and increasing rate
  61.      * @param zAmplitude amplitude along zenith axis
  62.      * @param zPhase phase along zenith axis
  63.      * @param wAmplitude amplitude along West
  64.      * @param wPhase phase along West axis
  65.      * @param sAmplitude amplitude along South
  66.      * @param sPhase phase along South axis
  67.      */
  68.     public OceanLoadingCoefficients(final String siteName, final GeodeticPoint siteLocation,
  69.                                     final Tide[][] tides,
  70.                                     final double[][] zAmplitude, final double[][] zPhase,
  71.                                     final double[][] wAmplitude, final double[][] wPhase,
  72.                                     final double[][] sAmplitude, final double[][] sPhase) {
  73.         this.siteName     = siteName;
  74.         this.siteLocation = siteLocation;
  75.         this.tides        = copy(tides);
  76.         this.zAmplitude   = copy(zAmplitude);
  77.         this.zPhase       = copy(zPhase);
  78.         this.wAmplitude   = copy(wAmplitude);
  79.         this.wPhase       = copy(wPhase);
  80.         this.sAmplitude   = copy(sAmplitude);
  81.         this.sPhase       = copy(sPhase);
  82.     }

  83.     /** Deep copy of a variable rows tides array.
  84.      * @param array to copy
  85.      * @return copied array
  86.      */
  87.     private Tide[][] copy(final Tide[][] array) {
  88.         final Tide[][] copied = new Tide[array.length][];
  89.         for (int i = 0; i < array.length; ++i) {
  90.             copied[i] = array[i].clone();
  91.         }
  92.         return copied;
  93.     }

  94.     /** Deep copy of a variable rows double array.
  95.      * @param array to copy
  96.      * @return copied array
  97.      */
  98.     private double[][] copy(final double[][] array) {
  99.         final double[][] copied = new double[array.length][];
  100.         for (int i = 0; i < array.length; ++i) {
  101.             copied[i] = array[i].clone();
  102.         }
  103.         return copied;
  104.     }

  105.     /** Get the site name.
  106.      * @return site name
  107.      */
  108.     public String getSiteName() {
  109.         return siteName;
  110.     }

  111.     /** Get the site location.
  112.      * @return site location
  113.      */
  114.     public GeodeticPoint getSiteLocation() {
  115.         return siteLocation;
  116.     }

  117.     /** Get the tide.
  118.      * @param i species
  119.      * @param j tide in the species
  120.      * @return tide
  121.      */
  122.     public Tide getTide(final int i, final int j) {
  123.         return tides[i][j];
  124.     }

  125.     /** Get the amplitude along zenith axis.
  126.      * @param i species
  127.      * @param j tide in the species
  128.      * @return amplitude along zenith axis
  129.      */
  130.     public double getZenithAmplitude(final int i, final int j) {
  131.         return zAmplitude[i][j];
  132.     }

  133.     /** Get the phase along zenith axis.
  134.      * @param i species
  135.      * @param j tide in the species
  136.      * @return phase along zenith axis
  137.      */
  138.     public double getZenithPhase(final int i, final int j) {
  139.         return zPhase[i][j];
  140.     }

  141.     /** Get the amplitude along west axis.
  142.      * @param i species
  143.      * @param j tide in the species
  144.      * @return amplitude along west axis
  145.      */
  146.     public double getWestAmplitude(final int i, final int j) {
  147.         return wAmplitude[i][j];
  148.     }

  149.     /** Get the phase along West axis.
  150.      * @param i species
  151.      * @param j tide in the species
  152.      * @return phase along West axis
  153.      */
  154.     public double getWestPhase(final int i, final int j) {
  155.         return wPhase[i][j];
  156.     }

  157.     /** Get the amplitude along South axis.
  158.      * @param i species
  159.      * @param j tide in the species
  160.      * @return amplitude along South axis
  161.      */
  162.     public double getSouthAmplitude(final int i, final int j) {
  163.         return sAmplitude[i][j];
  164.     }

  165.     /** Get the phase along South axis.
  166.      * @param i species
  167.      * @param j tide in the species
  168.      * @return phase along South axis
  169.      */
  170.     public double getSouthPhase(final int i, final int j) {
  171.         return sPhase[i][j];
  172.     }

  173.     /** Get the number of species.
  174.      * @return number of species
  175.      */
  176.     public int getNbSpecies() {
  177.         return tides.length;
  178.     }

  179.     /** Get the number of tides for one species.
  180.      * @param species species index
  181.      * @return number of tides for one species
  182.      */
  183.     public int getNbTides(final int species) {
  184.         return tides[species].length;
  185.     }

  186. }