Skip to content
Snippets Groups Projects
Commit d4f25e55 authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Merge branch 'development' into 'master'

Development

See merge request socis/satnogs-orbit-determination!1
parents 9e6d6902 b2ceb39e
No related branches found
No related tags found
No related merge requests found
Showing
with 1466 additions and 0 deletions
.idea
.classpath
.project
.settings
.checkstyle
bin
target
/build
/lib
*.class
0.25 488.08443473330493 0.29770189158832444
0.5 483.5163311502993 0.2944655954886587
0.75 478.95471318441406 0.2912467956203959
1 474.38723743484337 0.2880418140735
1.1 472.5642330673466 0.28676555528898073
1.2 470.7357584759762 0.28549036916639126
1.3 468.9126499737713 0.2842192919159528
1.4 467.0868909849984 0.2829502139015025
1.5 465.26115464107914 0.2816838864620642
1.6 463.4354410889275 0.28042034832121077
1.7 461.60751395777874 0.27915951527321187
1.8 459.7819575155096 0.2779018582651417
1.9 457.9564411086718 0.27664714623575304
10 310.1663458768072 0.18968726303291547
100 1326.4003165080524 1.2856723450022063
2 456.1328099409997 0.2753948248202001
2.1 454.3055552858929 0.27414676676852706
2.2 452.48020806932936 0.2729012194471129
2.3 450.65607297743156 0.2716568460459192
2.4 448.82978815550484 0.27041976458966693
2.5 447.00476842330727 0.2691840340807601
2.6 445.1795421829279 0.2679468070415361
2.7 443.35756297347183 0.26672383778398284
2.8 441.52863712330327 0.26548954393908414
2.9 439.703219486578 0.2642658750528645
20 128.1667142534553 0.16996657794109787
3 437.8778227904029 0.26304557425378555
3.5 428.7510894376662 0.256996253066019
30 56.562278160121096 0.26277466918591574
4 419.62520376378285 0.25103849741042933
4.5 410.49980448517 0.24517888619805306
40 237.37365767721892 0.3952517678107539
5 401.37503423058445 0.239424572849367
50 419.1576485344086 0.5386703601667135
6 383.1274454712545 0.22826328287319128
60 600.8874522531091 0.6860279877184593
7 364.8825810110331 0.21762371858260315
70 782.4896648836428 0.8350976860204224
8 346.6406242246215 0.20758553318395667
80 963.945618332389 0.9849841107943327
9 328.4017874088113 0.1982394826232826
90 1145.250794037666 1.135247864326835
0.25 1071.2912306310502 1.0631087633800387
0.5 1068.1747690291759 1.0586469781772536
0.75 1065.0723450986425 1.054191002483257
1 1061.9837943916846 1.0497415977401545
1.1 1060.7523752244447 1.0479635073363562
1.2 1059.5230872021089 1.0461865682280802
1.3 1058.296125110499 1.0444105850322138
1.4 1057.0714333590424 1.0426356125762206
1.5 1055.8490212029067 1.0408617231436743
1.6 1054.6288942636902 1.0390888437048482
1.7 1053.4110634962935 1.0373170131144187
1.8 1052.195536005611 1.035546265298884
1.9 1050.9823223354251 1.0337765712550855
10 961.151300593822 0.8945155473422853
100 1529.2563596913792 1.235588004093165
2 1049.771423102685 1.0320079359890206
2.1 1048.5628494501773 1.0302403769748338
2.2 1047.3566113518848 1.0284738940493974
2.3 1046.152740234929 1.0267084755718163
2.4 1044.9511871191778 1.0249441420273444
2.5 1043.7519912589723 1.0231809328112085
2.6 1042.5551674497094 1.0214188209851345
2.7 1041.3607227069308 1.019657802381327
2.8 1040.1686610919185 1.0178978902892506
2.9 1038.9789888495827 1.0161390906660153
20 878.1970273239026 0.7383064500801098
3 1037.7917169173154 1.0143814127812913
3.5 1031.8916342212874 1.005610074933683
30 834.5512322362412 0.6118580344608961
4 1026.0525855759552 0.9968664762746933
4.5 1020.2761175932574 0.9881546335976186
40 836.2897486742056 0.5364828541773351
5 1014.562826969766 0.9794725368078596
50 883.0563626035528 0.534097606193768
6 1003.3303702906106 0.9622025696968245
60 968.2636066776083 0.6054275923702049
7 992.3640805076453 0.9450644438378111
70 1082.7996049841486 0.729035944419566
8 981.6728277156717 0.9280653341116687
80 1218.3548652213522 0.883145365593965
9 971.2654673851075 0.911212969188654
90 1368.6362781030891 1.054385908124833
0.25 4812.864044508271 0.8717183776113017
0.5 4809.7183965234035 0.8736291192167205
0.75 4806.577857412508 0.8755593726666004
1 4803.442262297149 0.8775090002960249
1.1 4802.189127023209 0.8782943496153433
1.2 4800.936926621253 0.8790827166542373
1.3 4799.68549359164 0.8798741560368821
1.4 4798.4349473406955 0.8806685997248389
1.5 4797.1850417041605 0.8814661573711801
1.6 4795.93590581111 0.8822667599270617
1.7 4794.687540798969 0.8830704011252856
1.8 4793.439946889492 0.8838770714299333
1.9 4792.193125034604 0.8846867612124423
10 4693.816047924723 0.9595261830057845
100 4030.0331387999354 2.3060885212975526
2.0 4790.947004740119 0.8854995139367371
2.1 4789.701735631261 0.8863152172646684
2.2 4788.45729742629 0.8871338676260341
2.3 4787.213518341363 0.8879555992760771
2.4 4785.970616131615 0.8887802178317938
2.5 4784.728401157809 0.889607895292568
2.6 4783.487035737612 0.8904384442479005
2.7 4782.246409276877 0.8912719908494859
2.8 4781.0065602108825 0.8921084773611248
2.9 4779.767495310867 0.8929479517670414
20 4579.8050569751 1.07278615989623
3.0 4778.529219903961 0.8937903106117244
3.5 4772.3497057611285 0.8980458341056816
30 4474.562890532245 1.2027851059396026
4.0 4766.189179873786 0.9023728463806737
4.5 4760.048548014349 0.906770915328228
40 4378.676701775214 1.3445110786236385
5 4753.927588396672 0.911238831046825
50 4292.7277806628435 1.4944806578041756
6 4741.745010340254 0.9203795377822716
60 4217.2755319673615 1.650319223785638
7 4729.642008827071 0.9297868520191652
70 4152.845712173005 1.8103840493639725
8 4717.619339102429 0.9394525164865687
80 4099.909203625457 1.9735363418551772
9 4705.676937737124 0.9493682338883552
90 4058.866930281643 2.1389664652638114
0.25 354.76973381307 0.6070721798405067
0.5 354.9356276793512 0.608852121592604
0.75 355.41568530179285 0.6106453966510366
1 356.2084673304331 0.612451786216814
1.1 356.6129638411142 0.6131781389243858
1.2 357.0668686223924 0.613906484921376
1.3 357.57014684784986 0.6146369049038225
1.4 358.12259130745986 0.6153693928971441
1.5 358.7238224489388 0.616103853753784
1.6 359.3738980223083 0.6168404542508227
1.7 360.0725492633747 0.6175791827946957
1.8 360.8190479552449 0.618319777546292
1.9 361.61368528151905 0.6190625642690883
10 543.8857033905641 0.6852501882659896
100 4218.858812862111 1.6947451425713311
2 362.45570538212195 0.6198072865201457
2.1 363.34478321256006 0.6205539419913438
2.2 364.280857073234 0.6213026803606018
2.3 365.26342321215145 0.6220534146633391
2.4 366.2921039016829 0.6228061338661095
2.5 367.36664999328445 0.6235609067032251
2.6 368.4863847471816 0.6243175746136143
2.7 369.6510345467737 0.6250762064880777
2.8 370.8600422975942 0.625836722026201
2.9 372.11336989922165 0.6265993254298479
20 906.8127101202542 0.7797555214172857
3 373.4101775605025 0.6273637983848503
3.5 380.53211244418134 0.6312149198535953
30 1305.6958179852068 0.8836245405325427
4 388.67331896598654 0.6351134224839226
4.5 397.7709992059488 0.639058278979245
40 1715.454444152186 0.9934453971180834
5 407.76104474630415 0.6430485433170423
50 2129.673789854137 1.107022845662363
6 430.16377386766555 0.6511615840085188
60 2546.048998247636 1.2229060111802594
7 455.3917047148387 0.6594452040650193
70 2963.577958976823 1.3402099916967567
8 483.00178725752033 0.6678923665492595
80 3381.727950115442 1.4582211132288163
9 512.6086383220078 0.6764962292339551
90 3800.21346531648 1.5765076603744768
0.25 1294.484126338853 0.844786513572305
0.5 1298.8674519814272 0.8486244892843968
0.75 1303.253278507788 0.8524717254036824
1 1307.6416345898895 0.8563281426488089
1.1 1309.3976728975683 0.8578732463280895
1.2 1311.1541056647184 0.8594197868020967
1.3 1312.9109318068442 0.860967757264484
1.4 1314.6681491829402 0.862517148867374
1.5 1316.4257559535333 0.8640679539639415
1.6 1318.1837520913366 0.8656201661612671
1.7 1319.9421356646856 0.8671737778068936
1.8 1321.7008996705492 0.8687287760772997
1.9 1323.460050947249 0.8702851612371327
10 1467.089900627015 1.0003300642911896
100 3122.0468514840977 2.618891651478584
2 1325.219581673427 0.8718429197004377
2.1 1326.9794929268103 0.873402046834265
2.2 1328.7397613947533 0.8749625170969207
2.3 1330.5004300184066 0.8765243598055812
2.4 1332.2614716701012 0.87808754614904
2.5 1334.022886581994 0.8796520706055233
2.6 1335.7846848612267 0.8812179184449415
2.7 1337.546835420455 0.8827851096146743
2.8 1339.3093722483595 0.8843536010579309
2.9 1341.0722616826733 0.8859234167718921
20 1646.8620716844964 1.16889930765091
3 1342.8355320899425 0.8874945230232626
3.5 1351.657285417241 0.8953693755697772
30 1828.535429548419 1.3431052377273083
4 1360.4879557353665 0.9032757492823726
4.5 1369.3273931914823 0.9112128130857498
40 2011.5327752269127 1.5209233715889898
5 1378.1753661605583 0.9191797439277292
50 2195.468905854387 1.701140872271665
6 1395.8964999181353 0.9352001913844515
60 2380.0748918193162 1.8829971051550536
7 1413.6495740655382 0.9513308398318174
70 2565.1605169799277 2.065990886807093
8 1431.4336544357848 0.9675661887282192
80 2750.5835495741367 2.249785684952239
9 1449.247492865332 0.983900938030522
90 2936.239064723558 2.434143017201528
39-CGBSAT-VHF 456.1328099409997 0.2753948248202001
F4lkd 1049.771423102685 1.0320079359890206
Kir-virt 362.45570538212195 0.6198072865201457
Marcs 1325.219581673427 0.8718429197004377
39-CGBSAT-VHF 456.1328099409997 0.2753948248202001
F4lkd 1049.771423102685 1.0320079359890206
Kir-virt 362.45570538212195 0.6198072865201457
Marcs 1325.219581673427 0.8718429197004377
39-CGBSAT-VHF 456.1328099409997 0.2753948248202001
F4lkd 1049.771423102685 1.0320079359890206
Kir-virt 362.45570538212195 0.6198072865201457
Marcs 1325.219581673427 0.8718429197004377
GREFRA 845.0631550234558 0.2565052296858331
GRENZ 708.9194914919876 0.298548152365187
KirFRA 676.8633761075581 0.7036313893187448
KIRGRE 748.6565966234257 0.7393296497734031
KirNL 252.8540368462976 0.3334341618037682
KirNZ 633.7341149408646 0.5167512674762835
MarcFRA 519.8344782685051 0.24863357249834694
MarcGre 1308.4720468533126 0.916831376202549
MarcKir 461.4685735518715 0.4810251848174545
MarcNZ 268.24785839969036 0.40913861458407014
NLFRA 791.3901460013076 0.6772349136684113
NLGRE 718.2834500515373 0.4869778081553708
NLMARC 342.3021277202149 0.2847711534960692
NZFRA 722.786869989881 0.3131806744627206
NZNL 667.6277192218672 0.3376064148607366
40.0 1363.9259488907685 0.8495893272088479
35.0 1181.426496641967 0.7347484546397415
30.0 999.2328803491457 0.6199100941810161
25.0 817.5283945510904 0.5051220454990478
20.0 636.6739868499193 0.39035068438588993
15.0 455.75573037377956 0.27509283289685454
10.0 284.17336350400967 0.1618054262992023
5.0 138.23168817114987 0.05252715708465274
2.5 115.90666571466824 0.03125448389369363
1.0 134.4669174387262 0.05552960944989553
0.5 144.8031365234076 0.06568895983445507
0.25 61905.087705295104 158.332627008348
FRAGRENZ 695.9098099302691 0.22729717207904254
KIRFRAGRE 497.51889518049455 0.10241384973571194
KIRFRANZ 611.2598114250426 0.43621101233832965
KIRNLGRE 530.8573548256849 0.4501293093678424
KIRNLNZ 562.106267311011 0.4404555846284575
KIRNZGRE 567.1871286027398 0.2666929369929294
MarcFRAGRE 849.9960396752696 0.3134616727939482
MarcFRANZ 390.0600796122167 0.3620186819081849
MARCGRENZ 346.927636410476 0.12925539718783655
MarcKIRFRA 161.72232404211053 0.33097833957646794
MarcKIRGRE 756.1411181676119 0.6950904935929567
MarcKIRNZ 312.0078919215739 0.4245872593311787
MarcNLFRA 343.2368805116687 0.29426626352945423
MarcNLGRE 762.9645886884593 0.5344583260129393
MarcNLKIR 188.90906847230795 0.32312331289599666
MarcNLNZ 341.7228288404647 0.3471027429272198
NLFRAGRE 671.1687137655671 0.12835976868585658
NLFRANZ 665.75455065804 0.33401744541406836
NLGRENZ 628.2243408427017 0.17400591318693479
NLKIRFRA 576.9956495483405 0.5364968110961842
KIRFRAGRENZ 594.295597634204 0.271190917180136
KIRNLFRAGRE 474.7701642046368 0.10764086008181226
KIRNLFRANZ 585.790530743873 0.4141956371859598
KIRNLGRENZ 539.0624209209274 0.2653282329413892
MarcFRAGRENZ 437.13496172637616 0.1830099499633259
MarcKIRFRANZ 380.85086597162166 0.4048461943940991
MarcKIRGRENZ 327.97549338053113 0.2646362836339636
MarcsKIRFRAGRE 450.49851501645924 0.2371802626052498
MarcsNLFRAGRE 593.143709721829 0.15357090119737188
MarcsNLFRAKIR 241.9447808511834 0.32647946658448446
MarcsNLFRANZ 426.5172970548656 0.3458522771259319
MarcsNLGRENZ 381.4233725191357 0.16628053861780157
MarcsNLKIRGRE 533.8355255293968 0.47877894089927275
MarcsNLKIRNZ 347.1753900834969 0.39972579726193136
NLFRAGRENZ 648.9963175865929 0.21624632010163053
KIRNLFRAGRENZ 572.6857878374437 0.2776673089342773
MarcNLKIRFRAGRE 391.2472869736831 0.1780738585910139
MarcNLKIRGRENZ 354.53700433145815 0.26394698145531403
MarcNLKIRNZFRA 406.7988007706278 0.39220419804839524
MarcsKIRFRAGRENZ 402.10961421924435 0.27067848013151347
MarcsNLFRAGRENZ 450.35291215984137 0.2071360321475815
40.0 2646.6704981880516 2.5591843790297566
35.0 2331.308931311181 2.237674495925027
25.0 1700.4741255560805 1.5944809235207191
20.0 1385.0775443877935 1.2729029098640783
15.0 1069.8724634206721 0.9514805967681926
10.0 755.3240596800913 0.6307851293378717
5.0 443.0573736505676 0.31334718894329006
2.5 32892.140101043035 61.871253147434906
1.0 97239.46387593214 27.34538179118857
0.5 290345.19785620685 164.93956871010502
0.25 161.73209366650855 0.07810655235088514
40.0 2899.7290591160217 2.878777904018636
35.0 2528.8874549778648 2.509326946400673
30.0 2158.1665807093545 2.1398159859494847
25.0 1787.762414062995 1.770306694196052
20.0 1418.0132786848594 1.4009019263822073
15.0 1049.5426719715372 1.0315816456937263
10.0 684.553658274081 0.6626038017049355
5.0 334.85037841523325 0.295330244118582
2.5 193.90503405366437 0.11764847131410022
1.0 173594.92051821397 95.06658561696655
0.5 213252.88911949206 131.20040237024048
0.25 264449.9848233747 162.65025211971502
40.0 2721.249533726759 2.747586485465717
35.0 2362.0610878042035 2.3920299066275743
30.0 2002.9561084814047 2.036533807139432
25.0 1644.0383899276742 1.6811238288156274
20.0 1285.438678050593 1.325879959844993
15.0 4790.947004740119 0.8854995139367371
10.0 571.1365512396244 0.6161302723266006
5.0 224.71793653606414 0.26330275741554415
2.5 97.08356240313314 0.09397688511318722
1.0 125.48962065044043 0.05296161979901219
0.5 151.7180882649621 0.07642228083606227
0.25 56980.82287769641 87.91202309962074
40.0 876.3044735321057 1.5972663916956371
35.0 772.347151956273 1.4016493563613521
30.0 668.6984638068035 1.2060555033426605
25.0 565.5432057035172 1.0105208182101582
20.0 463.3139722685873 0.8151538940260797
15.0 362.6698102823527 0.6200070707637516
10.0 265.49784689356846 0.425389748405284
5.0 177.58477639504412 0.23264786768289056
2.5 142.64139505843787 0.13943598403223406
1.0 127.59734996311501 0.08842609232362299
0.5 123.99922446111728 0.0740396724779652
0.25 122.47042437448711 0.06778593334912413
40.0 3260.607638807656 2.19157733267792
35.0 2873.5919030381438 1.9277236174295824
30.0 2486.5572689314363 1.66381135160019
25.0 2099.5027206386994 1.3998908710695044
20.0 1712.5032215228016 1.1360040617922165
15.0 1325.6394534026579 0.8722224171705114
10.0 939.0525931292239 0.6086794228831105
5.0 553.4946267602696 0.3461483827787556
2.5 362.09219027893687 0.21639294876424828
1.0 29723.375143557194 77.13829256406864
0.5 9908.44262479302 27.463075615699935
0.25 188229.70504816226 184.31915671662802
pom.xml 0 → 100644
This diff is collapsed.
/* Copyright 2002-2019 CS Systèmes d'Information
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package fr.cs.examples;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.hipparchus.exception.DummyLocalizable;
import org.hipparchus.exception.Localizable;
import org.hipparchus.geometry.euclidean.threed.Vector3D;
import org.hipparchus.util.FastMath;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
import org.orekit.frames.Frame;
import org.orekit.frames.FramesFactory;
import org.orekit.frames.Predefined;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeComponents;
import org.orekit.time.TimeScale;
/** Simple parser for key/value files.
* @param Key type of the parameter keys
*/
public class KeyValueFileParser<Key extends Enum<Key>> {
/** Error message for unknown frame. */
private static final Localizable UNKNOWN_FRAME =
new DummyLocalizable("unknown frame {0}");
/** Error message for not Earth frame. */
private static final Localizable NOT_EARTH_FRAME =
new DummyLocalizable("frame {0} is not an Earth frame");
/** Enum type. */
private final Class<Key> enumType;
/** Key/scalar value map. */
private final Map<Key, String> scalarMap;
/** Key/array value map. */
private final Map<Key, List<String>> arrayMap;
/** Simple constructor.
* @param enumType type of the parameters keys enumerate
*/
public KeyValueFileParser(Class<Key> enumType) {
this.enumType = enumType;
this.scalarMap = new HashMap<Key, String>();
this.arrayMap = new HashMap<Key, List<String>>();
}
/** Parse an input file.
* <p>
* The input file syntax is a set of {@code key=value} lines or
* {@code key[i]=value} lines. Blank lines and lines starting with '#'
* (after whitespace trimming) are silently ignored. The equal sign may
* be surrounded by space characters. Keys must correspond to the
* {@link Key} enumerate constants, given that matching is not case
* sensitive and that '_' characters may appear as '.' characters in
* the file. This means that the lines:
* <pre>
* # this is the semi-major axis
* orbit.circular.a = 7231582
* </pre>
* are perfectly right and correspond to key {@code Key#ORBIT_CIRCULAR_A} if
* such a constant exists in the enumerate.
* </p>
* <p>
* When the key[i] notation is used, all the values extracted from lines
* with the same key will be put in a general array that will be retrieved
* using one of the {@code getXxxArray(key)} methods. They will <em>not</em>
* be available with the {@code getXxx(key)} methods without the {@code Array}.
* </p>
* @param input input stream
* @exception IOException if input file cannot be read
*/
public void parseInput(final String name, final InputStream input)
throws IOException, OrekitException {
final Pattern arrayPattern = Pattern.compile("([\\w\\.]+)\\s*\\[([0-9]+)\\]");
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(input, "UTF-8"))) {
int lineNumber = 0;
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
++lineNumber;
line = line.trim();
// we ignore blank lines and line starting with '#'
if ((line.length() > 0) && !line.startsWith("#")) {
String[] fields = line.split("\\s*=\\s*");
if (fields.length != 2) {
throw new OrekitException(OrekitMessages.UNABLE_TO_PARSE_LINE_IN_FILE,
lineNumber, name, line);
}
final Matcher matcher = arrayPattern.matcher(fields[0]);
if (matcher.matches()) {
// this is a key[i]=value line
String canonicalized = matcher.group(1).toUpperCase().replaceAll("\\.", "_");
Key key = Key.valueOf(enumType, canonicalized);
Integer index = Integer.valueOf(matcher.group(2));
List<String> list = arrayMap.get(key);
if (list == null) {
list = new ArrayList<String>();
arrayMap.put(key, list);
}
while (index >= list.size()) {
// insert empty strings for missing elements
list.add("");
}
list.set(index, fields[1]);
} else {
// this is a key=value line
String canonicalized = fields[0].toUpperCase().replaceAll("\\.", "_");
Key key = Key.valueOf(enumType, canonicalized);
scalarMap.put(key, fields[1]);
}
}
}
}
}
/** Check if a key is contained in the map.
* @param key parameter key
* @return true if the key is contained in the map
*/
public boolean containsKey(final Key key) {
return scalarMap.containsKey(key) || arrayMap.containsKey(key);
}
/** Get a raw string value from a parameters map.
* @param key parameter key
* @return string value corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public String getString(final Key key) throws NoSuchElementException {
final String value = scalarMap.get(key);
if (value == null) {
throw new NoSuchElementException(key.toString());
}
return value.trim();
}
/** Get a raw string values array from a parameters map.
* @param key parameter key
* @return string values array corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public String[] getStringArray(final Key key) throws NoSuchElementException {
final List<String> list = arrayMap.get(key);
if (list == null) {
throw new NoSuchElementException(key.toString());
}
String[] array = new String[list.size()];
for (int i = 0; i < array.length; ++i) {
array[i] = list.get(i).trim();
}
return array;
}
/** Get a raw double value from a parameters map.
* @param key parameter key
* @return double value corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public double getDouble(final Key key) throws NoSuchElementException {
return Double.parseDouble(getString(key));
}
/** Get a raw double values array from a parameters map.
* @param key parameter key
* @return double values array corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public double[] getDoubleArray(final Key key) throws NoSuchElementException {
String[] strings = getStringArray(key);
double[] array = new double[strings.length];
for (int i = 0; i < array.length; ++i) {
if (!strings[i].isEmpty())
array[i] = Double.parseDouble(strings[i]);
else {
array[i] = 0.;
}
}
return array;
}
/** Get a raw int value from a parameters map.
* @param key parameter key
* @return int value corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public int getInt(final Key key) throws NoSuchElementException {
return Integer.parseInt(getString(key));
}
/** Get a raw int values array from a parameters map.
* @param key parameter key
* @return int values array corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public int[] getIntArray(final Key key) throws NoSuchElementException {
String[] strings = getStringArray(key);
int[] array = new int[strings.length];
for (int i = 0; i < array.length; ++i) {
array[i] = Integer.parseInt(strings[i]);
}
return array;
}
/** Get a raw boolean value from a parameters map.
* @param key parameter key
* @return boolean value corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public boolean getBoolean(final Key key) throws NoSuchElementException {
return Boolean.parseBoolean(getString(key));
}
/** Get a raw boolean values array from a parameters map.
* @param key parameter key
* @return boolean values array corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public boolean[] getBooleanArray(final Key key) throws NoSuchElementException {
String[] strings = getStringArray(key);
boolean[] array = new boolean[strings.length];
for (int i = 0; i < array.length; ++i) {
array[i] = Boolean.parseBoolean(strings[i]);
}
return array;
}
/** Get an angle value from a parameters map.
* <p>
* The angle is considered to be in degrees in the file, it will be returned in radians
* </p>
* @param key parameter key
* @return angular value corresponding to the key, in radians
* @exception NoSuchElementException if key is not in the map
*/
public double getAngle(final Key key) throws NoSuchElementException {
return FastMath.toRadians(getDouble(key));
}
/** Get an angle values array from a parameters map.
* @param key parameter key
* @return angle values array corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public double[] getAngleArray(final Key key) throws NoSuchElementException {
double[] array = getDoubleArray(key);
for (int i = 0; i < array.length; ++i) {
array[i] = FastMath.toRadians(array[i]);
}
return array;
}
/** Get a date value from a parameters map.
* @param key parameter key
* @param scale time scale in which the date is to be parsed
* @return date value corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public AbsoluteDate getDate(final Key key, TimeScale scale) throws NoSuchElementException {
return new AbsoluteDate(getString(key), scale);
}
/** Get a date values array from a parameters map.
* @param key parameter key
* @param scale time scale in which the date is to be parsed
* @return date values array corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public AbsoluteDate[] getDateArray(final Key key, TimeScale scale) throws NoSuchElementException {
String[] strings = getStringArray(key);
AbsoluteDate[] array = new AbsoluteDate[strings.length];
for (int i = 0; i < array.length; ++i) {
array[i] = new AbsoluteDate(strings[i], scale);
}
return array;
}
/** Get a time value from a parameters map.
* @param key parameter key
* @return time value corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public TimeComponents getTime(final Key key) throws NoSuchElementException {
return TimeComponents.parseTime(getString(key));
}
/** Get a time values array from a parameters map.
* @param key parameter key
* @return time values array corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public TimeComponents[] getTimeArray(final Key key) throws NoSuchElementException {
String[] strings = getStringArray(key);
TimeComponents[] array = new TimeComponents[strings.length];
for (int i = 0; i < array.length; ++i) {
array[i] = TimeComponents.parseTime(strings[i]);
}
return array;
}
/** Get a vector value from a parameters map.
* @param xKey parameter key for abscissa
* @param yKey parameter key for ordinate
* @param zKey parameter key for height
* @param scale time scale in which the date is to be parsed
* @return date value corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public Vector3D getVector(final Key xKey, final Key yKey, final Key zKey)
throws NoSuchElementException {
return new Vector3D(getDouble(xKey), getDouble(yKey), getDouble(zKey));
}
/** Get a vector values array from a parameters map.
* @param xKey parameter key for abscissa
* @param yKey parameter key for ordinate
* @param zKey parameter key for height
* @param scale time scale in which the date is to be parsed
* @return date value corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public Vector3D[] getVectorArray(final Key xKey, final Key yKey, final Key zKey)
throws NoSuchElementException {
String[] xStrings = getStringArray(xKey);
String[] yStrings = getStringArray(yKey);
String[] zStrings = getStringArray(zKey);
Vector3D[] array = new Vector3D[xStrings.length];
for (int i = 0; i < array.length; ++i) {
array[i] = new Vector3D(Double.parseDouble(xStrings[i]),
Double.parseDouble(yStrings[i]),
Double.parseDouble(zStrings[i]));
}
return array;
}
/** Get a strings list from a parameters map.
* @param key parameter key
* @param separator elements separator
* @return strings list value corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public List<String> getStringsList(final Key key, final char separator)
throws NoSuchElementException {
final String value = scalarMap.get(key);
if (value == null) {
throw new NoSuchElementException(key.toString());
}
return Arrays.asList(value.trim().split("\\s*" + separator + "\\s*"));
}
/** Get a strings list array from a parameters map.
* @param key parameter key
* @param separator elements separator
* @return strings list array corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public List<String>[] getStringsListArray(final Key key, final char separator)
throws NoSuchElementException {
final String[] strings = getStringArray(key);
@SuppressWarnings("unchecked")
final List<String>[] array = (List<String>[]) Array.newInstance(List.class, strings.length);
for (int i = 0; i < array.length; ++i) {
array[i] = Arrays.asList(strings[i].trim().split("\\s*" + separator + "\\s*"));
}
return array;
}
/** Get an inertial frame from a parameters map.
* @param key parameter key
* @return inertial frame corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public Frame getInertialFrame(final Key key) throws NoSuchElementException, OrekitException {
// get the name of the desired frame
final String frameName = getString(key);
// check the name against predefined frames
for (Predefined predefined : Predefined.values()) {
if (frameName.equals(predefined.getName())) {
if (FramesFactory.getFrame(predefined).isPseudoInertial()) {
return FramesFactory.getFrame(predefined);
} else {
throw new OrekitException(OrekitMessages.NON_PSEUDO_INERTIAL_FRAME,
frameName);
}
}
}
// none of the frames match the name
throw new OrekitException(UNKNOWN_FRAME, frameName);
}
/** Get an Earth frame from a parameters map.
* <p>
* We consider Earth frames are the frames with name starting with "ITRF".
* </p>
* @param key parameter key
* @param parameters key/value map containing the parameters
* @return Earth frame corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
public Frame getEarthFrame(final Key key)
throws NoSuchElementException, OrekitException {
// get the name of the desired frame
final String frameName = getString(key);
// check the name against predefined frames
for (Predefined predefined : Predefined.values()) {
if (frameName.equals(predefined.getName())) {
if (predefined.toString().startsWith("ITRF") ||
predefined.toString().startsWith("GTOD")) {
return FramesFactory.getFrame(predefined);
} else {
throw new OrekitException(NOT_EARTH_FRAME, frameName);
}
}
}
// none of the frames match the name
throw new OrekitException(UNKNOWN_FRAME, frameName);
}
}
package fr.cs.examples.estimation;
import org.hipparchus.util.FastMath;
import org.orekit.estimation.measurements.AngularAzEl;
import org.orekit.estimation.measurements.ObservableSatellite;
import org.orekit.estimation.measurements.Range;
import org.orekit.estimation.measurements.modifiers.Bias;
import java.util.Map;
public class AzElParser extends OrbitDetermination.MeasurementsParser<AngularAzEl>{
/** Parser for azimuth-elevation measurements. */
/** {@inheritDoc} */
@Override
public AngularAzEl parseFields(final String[] fields,
final Map<String, StationData> stations,
final PVData pvData,
final ObservableSatellite satellite,
final Bias<Range> satRangeBias,
final Weights weights,
final String line,
final int lineNumber,
final String fileName) {
checkFields(5, fields, line, lineNumber, fileName);
final StationData stationData = getStationData(fields[2], stations, line, lineNumber, fileName);
final AngularAzEl azEl = new AngularAzEl(stationData.station,
getDate(fields[0], line, lineNumber, fileName),
new double[] {
FastMath.toRadians(Double.parseDouble(fields[3])),
FastMath.toRadians(Double.parseDouble(fields[4]))
},
stationData.azElSigma,
weights.azElBaseWeight,
satellite);
if (stationData.refractionCorrection != null) {
azEl.addModifier(stationData.refractionCorrection);
}
if (stationData.azELBias != null) {
azEl.addModifier(stationData.azELBias);
}
return azEl;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment