CRDHeader.java

  1. /* Copyright 2002-2022 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.files.ilrs;

  18. import java.util.HashMap;
  19. import java.util.Map;

  20. import org.orekit.errors.OrekitException;
  21. import org.orekit.errors.OrekitMessages;

  22. /**
  23.  * Container for Consolidated laser ranging Data Format (CDR) header.
  24.  * @author Bryan Cazabonne
  25.  * @since 10.3
  26.  */
  27. public class CRDHeader extends ILRSHeader {

  28.     /** Station name from official list. */
  29.     private String stationName;

  30.     /** System identifier: Crustal Dynamics Project (CDP) Pad Identifier for SLR. */
  31.     private int systemIdentifier;

  32.     /** System number: Crustal Dynamics Project (CDP) 2-digit system number for SLR. */
  33.     private int systemNumber;

  34.     /** System occupancy: Crustal Dynamics Project (CDP) 2-digit occupancy sequence number for SLR. */
  35.     private int systemOccupancy;

  36.     /** Station Epoch Time Scale. */
  37.     private int epochIdentifier;

  38.     /** Station network. */
  39.     private String stationNetword;

  40.     /** Spacecraft Epoch Time Scale (transponders only). */
  41.     private int spacecraftEpochTimeScale;

  42.     /** Data type. */
  43.     private int dataType;

  44.     /** A flag to indicate the data release. */
  45.     private int dataReleaseFlag;

  46.     /** Tropospheric refraction correction applied indicator. */
  47.     private boolean isTroposphericRefractionApplied;

  48.     /** Center of mass correction applied indicator. */
  49.     private boolean isCenterOfMassCorrectionApplied;

  50.     /** Receive amplitude correction applied indicator. */
  51.     private boolean isReceiveAmplitudeCorrectionApplied;

  52.     /** Station system delay applied indicator. */
  53.     private boolean isStationSystemDelayApplied;

  54.     /** Spacecraft system delay applied (transponders) indicator. */
  55.     private boolean isTransponderDelayApplied;

  56.     /** Range type. */
  57.     private RangeType rangeType;

  58.     /** Data quality indicator. */
  59.     private int qualityIndicator;

  60.     /** Prediction type (CPF or TLE). */
  61.     private int predictionType;

  62.     /** Year of century from CPF or TLE. */
  63.     private int yearOfCentury;

  64.     /**
  65.      * Date and time.
  66.      * CPF starting date and hour (MMDDHH) from CPF H2 record or
  67.      * TLE epoch day/fractional day.
  68.      */
  69.     private String dateAndTime;

  70.     /** Prediction provider (CPF provider in H1 record or TLE source). */
  71.     private String predictionProvider;

  72.     /**
  73.      * Get the station name from official list.
  74.      * @return the station name from official list
  75.      */
  76.     public String getStationName() {
  77.         return stationName;
  78.     }

  79.     /**
  80.      * Set the station name from official list.
  81.      * @param stationName the station name to set
  82.      */
  83.     public void setStationName(final String stationName) {
  84.         this.stationName = stationName;
  85.     }

  86.     /**
  87.      * Get the system identifier.
  88.      * @return the system identifier
  89.      */
  90.     public int getSystemIdentifier() {
  91.         return systemIdentifier;
  92.     }

  93.     /**
  94.      * Set the system identifier.
  95.      * @param systemIdentifier the system identifier to set
  96.      */
  97.     public void setSystemIdentifier(final int systemIdentifier) {
  98.         this.systemIdentifier = systemIdentifier;
  99.     }

  100.     /**
  101.      * Get the system number.
  102.      * @return the system number
  103.      */
  104.     public int getSystemNumber() {
  105.         return systemNumber;
  106.     }

  107.     /**
  108.      * Set the system number.
  109.      * @param systemNumber the system number to set
  110.      */
  111.     public void setSystemNumber(final int systemNumber) {
  112.         this.systemNumber = systemNumber;
  113.     }

  114.     /**
  115.      * Get the system occupancy.
  116.      * @return the system occupancy
  117.      */
  118.     public int getSystemOccupancy() {
  119.         return systemOccupancy;
  120.     }

  121.     /**
  122.      * Set the system occupancy.
  123.      * @param systemOccupancy the system occupancy to set
  124.      */
  125.     public void setSystemOccupancy(final int systemOccupancy) {
  126.         this.systemOccupancy = systemOccupancy;
  127.     }

  128.     /**
  129.      * Get the epoch identifier.
  130.      * <p>
  131.      * 3 = UTC (UNSO) ; 4 = UTC (GPS) ; 7 = UTC (BIPM) ; 10 = UTC (Station Time Scale)
  132.      * </p>
  133.      * @return the epoch identifier
  134.      */
  135.     public int getEpochIdentifier() {
  136.         return epochIdentifier;
  137.     }

  138.     /**
  139.      * Set the epoch identifier.
  140.      * @param epochIdentifier the epoch identifier to set
  141.      */
  142.     public void setEpochIdentifier(final int epochIdentifier) {
  143.         this.epochIdentifier = epochIdentifier;
  144.     }

  145.     /**
  146.      * Get the station network.
  147.      * @return the station network
  148.      */
  149.     public String getStationNetword() {
  150.         return stationNetword;
  151.     }

  152.     /**
  153.      * Set the station network.
  154.      * @param stationNetword the station network to set
  155.      */
  156.     public void setStationNetword(final String stationNetword) {
  157.         this.stationNetword = stationNetword;
  158.     }

  159.     /**
  160.      * Get the spacecraft epoch time scale.
  161.      * @return the spacecraft epoch time scale
  162.      */
  163.     public int getSpacecraftEpochTimeScale() {
  164.         return spacecraftEpochTimeScale;
  165.     }

  166.     /**
  167.      * Set the spacecraft epoch time scale.
  168.      * @param spacecraftEpochTimeScale the spacecraft epoch time scale to set
  169.      */
  170.     public void setSpacecraftEpochTimeScale(final int spacecraftEpochTimeScale) {
  171.         this.spacecraftEpochTimeScale = spacecraftEpochTimeScale;
  172.     }

  173.     /**
  174.      * Get the data type.
  175.      * <p>
  176.      * 0 = full rate ; 1 = normal point ; 2 = sampled engineering
  177.      * </p>
  178.      * @return the data type
  179.      */
  180.     public int getDataType() {
  181.         return dataType;
  182.     }

  183.     /**
  184.      * Set the data type.
  185.      * @param dataType the data type to set
  186.      */
  187.     public void setDataType(final int dataType) {
  188.         this.dataType = dataType;
  189.     }

  190.     /**
  191.      * Get the flag indicating the data release.
  192.      * @return the flag indicating the data release
  193.      */
  194.     public int getDataReleaseFlag() {
  195.         return dataReleaseFlag;
  196.     }

  197.     /**
  198.      * Set the flag indicating the data release.
  199.      * @param dataReleaseFlag the flag to set
  200.      */
  201.     public void setDataReleaseFlag(final int dataReleaseFlag) {
  202.         this.dataReleaseFlag = dataReleaseFlag;
  203.     }

  204.     /**
  205.      * Get the tropospheric refraction correction applied indicator.
  206.      * @return true if tropospheric refraction correction is applied
  207.      */
  208.     public boolean isTroposphericRefractionApplied() {
  209.         return isTroposphericRefractionApplied;
  210.     }

  211.     /**
  212.      * Set the tropospheric refraction correction applied indicator.
  213.      * @param isTroposphericRefractionApplied true if tropospheric refraction correction is applied
  214.      */
  215.     public void setIsTroposphericRefractionApplied(final boolean isTroposphericRefractionApplied) {
  216.         this.isTroposphericRefractionApplied = isTroposphericRefractionApplied;
  217.     }

  218.     /**
  219.      * Get the center of mass correction applied indicator.
  220.      * @return true if center of mass correction is applied
  221.      */
  222.     public boolean isCenterOfMassCorrectionApplied() {
  223.         return isCenterOfMassCorrectionApplied;
  224.     }

  225.     /**
  226.      * Set the center of mass correction applied indicator.
  227.      * @param isCenterOfMassCorrectionApplied true if center of mass correction is applied
  228.      */
  229.     public void setIsCenterOfMassCorrectionApplied(final boolean isCenterOfMassCorrectionApplied) {
  230.         this.isCenterOfMassCorrectionApplied = isCenterOfMassCorrectionApplied;
  231.     }

  232.     /**
  233.      * Get the receive amplitude correction applied indicator.
  234.      * @return true if receive amplitude correction is applied
  235.      */
  236.     public boolean isReceiveAmplitudeCorrectionApplied() {
  237.         return isReceiveAmplitudeCorrectionApplied;
  238.     }

  239.     /**
  240.      * Set the receive amplitude correction applied indicator.
  241.      * @param isReceiveAmplitudeCorrectionApplied true if receive amplitude correction is applied
  242.      */
  243.     public void setIsReceiveAmplitudeCorrectionApplied(final boolean isReceiveAmplitudeCorrectionApplied) {
  244.         this.isReceiveAmplitudeCorrectionApplied = isReceiveAmplitudeCorrectionApplied;
  245.     }

  246.     /**
  247.      * Get the station system delay applied indicator.
  248.      * @return true if station system delay is applied
  249.      */
  250.     public boolean isStationSystemDelayApplied() {
  251.         return isStationSystemDelayApplied;
  252.     }

  253.     /**
  254.      * Set the station system delay applied indicator.
  255.      * @param isStationSystemDelayApplied true if station system delay is applied
  256.      */
  257.     public void setIsStationSystemDelayApplied(final boolean isStationSystemDelayApplied) {
  258.         this.isStationSystemDelayApplied = isStationSystemDelayApplied;
  259.     }

  260.     /**
  261.      * Get the spacecraft system delay applied (transponders) indicator.
  262.      * @return true if transponder delay is applied
  263.      */
  264.     public boolean isTransponderDelayApplied() {
  265.         return isTransponderDelayApplied;
  266.     }

  267.     /**
  268.      * Set the spacecraft system delay applied (transponders) indicator.
  269.      * @param isTransponderDelayApplied true if transponder delay is applied
  270.      */
  271.     public void setIsTransponderDelayApplied(final boolean isTransponderDelayApplied) {
  272.         this.isTransponderDelayApplied = isTransponderDelayApplied;
  273.     }

  274.     /**
  275.      * Get the range type.
  276.      * @return the range type
  277.      */
  278.     public RangeType getRangeType() {
  279.         return rangeType;
  280.     }

  281.     /**
  282.      * Set the range type indicator.
  283.      * @param indicator range type indicator
  284.      */
  285.     public void setRangeType(final int indicator) {
  286.         this.rangeType = RangeType.getRangeType(indicator);
  287.     }

  288.     /**
  289.      * Get the data quality indicator.
  290.      * @return the data quality indicator
  291.      */
  292.     public int getQualityIndicator() {
  293.         return qualityIndicator;
  294.     }

  295.     /**
  296.      * Set the data quality indicator.
  297.      * @param qualityIndicator the indicator to set
  298.      */
  299.     public void setQualityIndicator(final int qualityIndicator) {
  300.         this.qualityIndicator = qualityIndicator;
  301.     }

  302.     /**
  303.      * Get the prediction type (CPF or TLE).
  304.      * @return the prediction type
  305.      */
  306.     public int getPredictionType() {
  307.         return predictionType;
  308.     }

  309.     /**
  310.      * Set the prediction type.
  311.      * @param predictionType the prediction type to set
  312.      */
  313.     public void setPredictionType(final int predictionType) {
  314.         this.predictionType = predictionType;
  315.     }

  316.     /**
  317.      * Get the year of century from CPF or TLE.
  318.      * @return the year of century from CPF or TLE
  319.      */
  320.     public int getYearOfCentury() {
  321.         return yearOfCentury;
  322.     }

  323.     /**
  324.      * Set the year of century from CPF or TLE.
  325.      * @param yearOfCentury the year of century to set
  326.      */
  327.     public void setYearOfCentury(final int yearOfCentury) {
  328.         this.yearOfCentury = yearOfCentury;
  329.     }


  330.     /**
  331.      * Get the date and time as the string value.
  332.      * <p>
  333.      * Depending the prediction type, this value can represent the
  334.      * CPF starting date and hour (MMDDHH) from CPF H2 record or
  335.      * TLE epoch day/fractional day
  336.      * </p>
  337.      * @return the date and time as the string value
  338.      */
  339.     public String getDateAndTime() {
  340.         return dateAndTime;
  341.     }

  342.     /**
  343.      * Set the string value of date and time.
  344.      * @param dateAndTime the date and time to set
  345.      */
  346.     public void setDateAndTime(final String dateAndTime) {
  347.         this.dateAndTime = dateAndTime;
  348.     }

  349.     /**
  350.      * Get the prediction provider.
  351.      * @return the preditction provider
  352.      */
  353.     public String getPredictionProvider() {
  354.         return predictionProvider;
  355.     }

  356.     /**
  357.      * Set the prediction provider.
  358.      * @param predictionProvider the prediction provider to set
  359.      */
  360.     public void setPredictionProvider(final String predictionProvider) {
  361.         this.predictionProvider = predictionProvider;
  362.     }

  363.     /** Range type for SLR data. */
  364.     public enum RangeType {

  365.         /** No ranges (i.e. transmit time only). */
  366.         NO_RANGES(0),

  367.         /** One-way ranging. */
  368.         ONE_WAY(1),

  369.         /** Two-way ranging. */
  370.         TWO_WAY(2),

  371.         /** Received times only. */
  372.         RECEIVED_ONLY(3),

  373.         /** Mixed. */
  374.         MIXED(4);

  375.         /** Codes map. */
  376.         private static final Map<Integer, RangeType> CODES_MAP = new HashMap<>();
  377.         static {
  378.             for (final RangeType type : values()) {
  379.                 CODES_MAP.put(type.getIndicator(), type);
  380.             }
  381.         }

  382.         /** range type indicator. */
  383.         private final int indicator;

  384.         /**
  385.          * Constructor.
  386.          * @param indicator range type indicator
  387.          */
  388.         RangeType(final int indicator) {
  389.             this.indicator = indicator;
  390.         }

  391.         /**
  392.          * Get the range type indicator.
  393.          * @return the range type indicator
  394.          */
  395.         public int getIndicator() {
  396.             return indicator;
  397.         }

  398.         /**
  399.          * Get the range type for the given indicator.
  400.          * @param id indicator
  401.          * @return the range type corresponding to the indicator
  402.          */
  403.         public static RangeType getRangeType(final int id) {
  404.             final RangeType type = CODES_MAP.get(id);
  405.             if (type == null) {
  406.                // Invalid value. An exception is thrown
  407.                 throw new OrekitException(OrekitMessages.INVALID_RANGE_INDICATOR_IN_CRD_FILE, id);
  408.             }
  409.             return type;
  410.         }

  411.     }

  412. }