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
18 package org.orekit.estimation.common;
19
20 import org.orekit.estimation.measurements.ObservableSatellite;
21 import org.orekit.estimation.measurements.Range;
22 import org.orekit.estimation.measurements.modifiers.Bias;
23
24 import java.util.Map;
25
26 /** Parser for range measurements.
27 * @author Luc Maisonobe
28 */
29 class RangeParser extends MeasurementsParser<Range> {
30 /** {@inheritDoc} */
31 @Override
32 public Range parseFields(final String[] fields,
33 final Map<String, StationData> stations,
34 final PVData pvData,
35 final ObservableSatellite satellite,
36 final Bias<Range> satRangeBias,
37 final Weights weights,
38 final String line,
39 final int lineNumber,
40 final String fileName) {
41 checkFields(4, fields, line, lineNumber, fileName);
42 final StationData stationData = getStationData(fields[2], stations, line, lineNumber, fileName);
43 final Range range = new Range(stationData.getStation(), true,
44 getDate(fields[0], line, lineNumber, fileName),
45 Double.parseDouble(fields[3]) * 1000.0,
46 stationData.getRangeSigma(),
47 weights.getRangeBaseWeight(),
48 satellite);
49 if (stationData.getRangeBias() != null) {
50 range.addModifier(stationData.getRangeBias());
51 }
52 if (satRangeBias != null) {
53 range.addModifier(satRangeBias);
54 }
55 if (stationData.getRangeTroposphericCorrection() != null) {
56 range.addModifier(stationData.getRangeTroposphericCorrection());
57 }
58 return range;
59 }
60 }