From 038f6223993cfe0c6fa2d1b3c6ddd57c6483a264 Mon Sep 17 00:00:00 2001 From: jay <jlaura@asu.edu> Date: Wed, 31 Jan 2018 07:31:01 -0700 Subject: [PATCH] Adds prototype socet gpf read from @thareUSGS --- plio/examples/SocetGXP/InSightE08_XW.gpf | 803 +++++++++++++++++++++++ plio/io/io_gpf.py | 307 +++++++++ plio/io/tests/test_gpf.py | 17 + 3 files changed, 1127 insertions(+) create mode 100644 plio/examples/SocetGXP/InSightE08_XW.gpf create mode 100644 plio/io/io_gpf.py create mode 100644 plio/io/tests/test_gpf.py diff --git a/plio/examples/SocetGXP/InSightE08_XW.gpf b/plio/examples/SocetGXP/InSightE08_XW.gpf new file mode 100644 index 0000000..b901ab8 --- /dev/null +++ b/plio/examples/SocetGXP/InSightE08_XW.gpf @@ -0,0 +1,803 @@ +GROUND POINT FILE +160 +point_id,stat,known,lat_Y_North,long_X_East,ht,sig(3),res(3) +1 1 1 +0.08538133869187 2.38013146162178 -2697.23744694649990 +0.000000 0.000000 1.707214 +16.348041 -13.917623 -0.151001 + +2 1 1 +0.08508542650082 2.38081358557147 -2702.00000000000000 +0.000000 0.000000 1.000000 +15.983286 -16.869508 0.103341 + +3 1 1 +0.08626480095809 2.38708383926110 -2714.16003756809000 +0.000000 0.000000 3.828854 +12.831839 -34.360639 -2.205846 + +4 1 1 +0.08568717143105 2.38669347579564 -2720.38735743320010 +0.000000 0.000000 2.060820 +13.102864 -34.063651 0.334757 + +5 1 1 +0.08077770259688 2.38388943114341 -2692.00307359153020 +0.000000 0.000000 2.768034 +15.876249 -23.172029 -0.461974 + +6 1 1 +0.08125893072768 2.38445721412659 -2691.71435885471010 +0.000000 0.000000 1.707214 +15.410702 -25.944881 0.225806 + +7 1 1 +0.07483240230363 2.38142612657463 -2668.18002134862990 +0.000000 0.000000 1.353607 +17.789075 -15.211119 0.087284 + +8 1 1 +0.07443515640509 2.38212146862000 -2664.77477694899020 +0.000000 0.000000 1.353607 +17.273365 -18.001186 0.323137 + +9 1 1 +0.07495055817805 2.38846192836558 -2700.63760007568000 +0.000000 0.000000 1.707214 +14.324904 -35.583450 -0.288152 + +10 1 1 +0.07519371955078 2.38757259631679 -2694.18565786937010 +0.000000 0.000000 1.353607 +14.771196 -33.010921 -0.080186 + +11 1 1 +0.07010083277386 2.38492139169220 -2668.62598527203000 +0.000000 0.000000 2.414427 +15.933368 -22.780039 -0.579354 + +12 1 1 +0.06957324833251 2.38532766471499 -2670.60458011069020 +0.000000 0.000000 1.707214 +15.773590 -23.804103 -0.330565 + +13 1 1 +0.06563711957712 2.38257808976375 -2652.65436974607020 +0.000000 0.000000 1.707214 +16.419539 -15.919385 0.250239 + +14 1 1 +0.06644546786520 2.38304264645782 -2658.85707321604010 +0.000000 0.000000 1.353607 +16.313481 -17.239438 0.115140 + +15 1 1 +0.06649272348885 2.38951682947442 -2692.00000000000000 +0.000000 0.000000 1.000000 +12.517966 -36.540841 -0.063341 + +16 1 1 +0.06706972009678 2.38873585114457 -2692.00000000000000 +0.000000 0.000000 1.000000 +13.078013 -34.602107 0.027465 + +D18_034427_1842_XN_04N223W_28 1 0 +0.06642563152225 2.38304560848777 -2652.73799319802990 +0.000000 0.000000 0.000000 +16.347926 -16.786457 202.264250 + +D18_034427_1842_XN_04N223W_29 1 0 +0.06701245416812 2.38319472448874 -2655.89367872851430 +0.000000 0.000000 0.000000 +16.345939 -17.392850 202.351222 + +D18_034427_1842_XN_04N223W_30 1 0 +0.06714286922356 2.38459540070318 -2666.21812177360060 +0.000000 0.000000 0.000000 +15.560710 -21.543285 206.451357 + +D18_034427_1842_XN_04N223W_31 1 0 +0.06699131624733 2.38537597452635 -2667.91738276709700 +0.000000 0.000000 0.000000 +15.129149 -23.909211 208.666933 + +D18_034427_1842_XN_04N223W_32 1 0 +0.06688979616650 2.38667024343657 -2676.47531531688670 +0.000000 0.000000 0.000000 +14.271489 -27.786033 212.567786 + +D18_034427_1842_XN_04N223W_33 1 0 +0.06725333266900 2.38736959672679 -2680.25417957014450 +0.000000 0.000000 0.000000 +13.938915 -30.138825 214.172395 + +D18_034427_1842_XN_04N223W_34 1 0 +0.06734814823241 2.38802769571932 -2689.87618817344450 +0.000000 0.000000 0.000000 +13.586741 -32.256272 215.922505 + +D18_034427_1842_XN_04N223W_37 1 0 +0.06827861281199 2.38281829913636 -2654.65105815991460 +0.000000 0.000000 0.000000 +16.734595 -16.750685 200.728446 + +D18_034427_1842_XN_04N223W_38 1 0 +0.06785042142429 2.38358220068826 -2655.15259216329880 +0.000000 0.000000 0.000000 +16.371177 -18.807863 203.084628 + +D18_034427_1842_XN_04N223W_39 1 0 +0.06848531606765 2.38426919589790 -2665.49676185714540 +0.000000 0.000000 0.000000 +16.028295 -21.041457 204.984706 + +D18_034427_1842_XN_04N223W_40 1 0 +0.06835459149418 2.38523660668123 -2670.27617625958010 +0.000000 0.000000 0.000000 +15.360716 -23.872983 207.754116 + +D18_034427_1842_XN_04N223W_41 1 0 +0.06848765704014 2.38645368693401 -2675.94217689062730 +0.000000 0.000000 0.000000 +14.686125 -27.652577 211.133186 + +D18_034427_1842_XN_04N223W_42 1 0 +0.06853528389167 2.38716497795550 -2677.44230816081560 +0.000000 0.000000 0.000000 +14.326697 -29.917028 213.039612 + +D18_034427_1842_XN_04N223W_43 1 0 +0.06812356483518 2.38818155252588 -2687.80012432381770 +0.000000 0.000000 0.000000 +13.665585 -32.992428 215.977587 + +D18_034427_1842_XN_04N223W_46 1 0 +0.06910953643377 2.38271848114252 -2656.71591287461340 +0.000000 0.000000 0.000000 +17.002323 -16.719943 199.939328 + +D18_034427_1842_XN_04N223W_47 1 0 +0.06912052519181 2.38317372399279 -2659.62595848906990 +0.000000 0.000000 0.000000 +16.723400 -18.028160 201.397423 + +D18_034427_1842_XN_04N223W_48 1 0 +0.06921287603448 2.38370782097352 -2662.59941160586370 +0.000000 0.000000 0.000000 +16.459808 -19.611708 202.954937 + +D18_034427_1842_XN_04N223W_49 1 0 +0.06941422430034 2.38536468483276 -2676.42904783616500 +0.000000 0.000000 0.000000 +15.563282 -24.595201 207.766938 + +D18_034427_1842_XN_04N223W_50 1 0 +0.06972642994168 2.38581920841575 -2685.03953627343120 +0.000000 0.000000 0.000000 +15.397463 -26.084508 208.858854 + +D18_034427_1842_XN_04N223W_51 1 0 +0.06934741459201 2.38710391506758 -2684.77443282485820 +0.000000 0.000000 0.000000 +14.491313 -29.952594 212.704364 + +D18_034427_1842_XN_04N223W_52 1 0 +0.06942432539212 2.38733818383773 -2685.84203339891340 +0.000000 0.000000 0.000000 +14.360056 -30.699132 213.376721 + +D18_034427_1842_XN_04N223W_55 1 0 +0.07042311025238 2.38254966475176 -2652.35774094529730 +0.000000 0.000000 0.000000 +17.241636 -16.687540 198.783423 + +D18_034427_1842_XN_04N223W_56 1 0 +0.07105172422820 2.38321132895148 -2652.75012147229470 +0.000000 0.000000 0.000000 +16.922747 -18.710958 200.576912 + +D18_034427_1842_XN_04N223W_57 1 0 +0.07056080973179 2.38355435560558 -2660.45723606407770 +0.000000 0.000000 0.000000 +16.751189 -19.618982 201.807268 + +D18_034427_1842_XN_04N223W_58 1 0 +0.07096187128717 2.38487692065399 -2677.68760634964110 +0.000000 0.000000 0.000000 +16.047975 -23.608642 205.743285 + +D18_034427_1842_XN_04N223W_59 1 0 +0.07108077399242 2.38593802880140 -2675.24427993036900 +0.000000 0.000000 0.000000 +15.485341 -26.866797 208.752177 + +D18_034427_1842_XN_04N223W_60 1 0 +0.07115124246621 2.38657444101636 -2682.88162299843820 +0.000000 0.000000 0.000000 +15.132392 -28.854257 210.517027 + +D18_034427_1842_XN_04N223W_61 1 0 +0.07077295848888 2.38786580634713 -2696.88194962116900 +0.000000 0.000000 0.000000 +14.357418 -32.808412 214.199620 + +D18_034427_1842_XN_04N223W_64 1 0 +0.07148971840912 2.38247259758759 -2620.89438652133000 +0.000000 0.000000 0.000000 +17.305942 -16.751100 198.286489 + +D18_034427_1842_XN_04N223W_65 1 0 +0.07202055149403 2.38255638944198 -2615.57205279913430 +0.000000 0.000000 0.000000 +17.268113 -17.157173 198.467782 + +D18_034427_1842_XN_04N223W_66 1 0 +0.07216060168744 2.38382907403426 -2656.66511920153290 +0.000000 0.000000 0.000000 +16.631242 -20.879829 202.222367 + +D18_034427_1842_XN_04N223W_67 1 0 +0.07232352446968 2.38470773377977 -2668.96595200655840 +0.000000 0.000000 0.000000 +16.209736 -23.514046 204.924653 + +D18_034427_1842_XN_04N223W_68 1 0 +0.07269790506316 2.38565779012721 -2678.93492707850330 +0.000000 0.000000 0.000000 +15.710246 -26.538726 207.417412 + +D18_034427_1842_XN_04N223W_69 1 0 +0.07199351427375 2.38652426862862 -2678.94269819181680 +0.000000 0.000000 0.000000 +15.232723 -28.952781 210.113507 + +D18_034427_1842_XN_04N223W_70 1 0 +0.07287457185956 2.38740913225819 -2689.38338650482910 +0.000000 0.000000 0.000000 +14.790549 -32.056628 212.276935 + +D18_034427_1842_XN_04N223W_73 1 0 +0.07282103502438 2.38224105347397 -2658.90868490750470 +0.000000 0.000000 0.000000 +17.508243 -16.491750 197.259326 + +D18_034427_1842_XN_04N223W_74 1 0 +0.07360512300510 2.38236265966710 -2653.23700446959540 +0.000000 0.000000 0.000000 +17.380384 -17.141116 197.206208 + +D18_034427_1842_XN_04N223W_75 1 0 +0.07379170560024 2.38384099669321 -2672.86449936452440 +0.000000 0.000000 0.000000 +16.649670 -21.459742 201.683498 + +D18_034427_1842_XN_04N223W_76 1 0 +0.07382062370162 2.38409005492065 -2675.04986863764500 +0.000000 0.000000 0.000000 +16.539460 -22.201383 202.427081 + +D18_034427_1842_XN_04N223W_77 1 0 +0.07373556771058 2.38535831527985 -2681.03132369788410 +0.000000 0.000000 0.000000 +15.794412 -25.889234 206.354471 + +D18_034427_1842_XN_04N223W_78 1 0 +0.07413489106962 2.38652925036891 -2689.01192607459690 +0.000000 0.000000 0.000000 +15.311494 -29.705488 209.401257 + +D18_034427_1842_XN_04N223W_79 1 0 +0.07424012184321 2.38724097889804 -2692.05401765766330 +0.000000 0.000000 0.000000 +14.971244 -31.978009 211.354569 + +D18_034427_1842_XN_04N223W_82 1 0 +0.07465980169223 2.38199709172594 -2660.38283677867410 +0.000000 0.000000 0.000000 +17.458552 -16.379278 195.823681 + +D18_034427_1842_XN_04N223W_83 1 0 +0.07480666965684 2.38294587119221 -2662.10704654923480 +0.000000 0.000000 0.000000 +17.012866 -19.120053 198.739360 + +D18_034427_1842_XN_04N223W_84 1 0 +0.07486208263204 2.38345735055070 -2665.67399947212930 +0.000000 0.000000 0.000000 +16.754496 -20.610599 200.295491 + +D18_034427_1842_XN_04N223W_85 1 0 +0.07524574930831 2.38443916455468 -3067.06995590909630 +0.000000 0.000000 0.000000 +16.388751 -23.622302 203.165592 + +D18_034427_1842_XN_04N223W_86 1 0 +0.07532253697328 2.38497620501387 -2562.06727294317850 +0.000000 0.000000 0.000000 +16.118722 -25.275464 204.691139 + +D18_034427_1842_XN_04N223W_87 1 0 +0.07541028942000 2.38609511438821 -2689.07628464171330 +0.000000 0.000000 0.000000 +15.566456 -28.711112 207.924363 + +D18_034427_1842_XN_04N223W_88 1 0 +0.07502083927259 2.38712713096084 -2686.03091073949640 +0.000000 0.000000 0.000000 +14.974822 -31.788204 210.917769 + +D18_034427_1842_XN_04N223W_91 1 0 +0.07544271458467 2.38190763446656 -2663.18853431234540 +0.000000 0.000000 0.000000 +17.530485 -16.373877 195.285223 + +D18_034427_1842_XN_04N223W_92 1 0 +0.07609298537421 2.38284082344542 -2669.99111238161410 +0.000000 0.000000 0.000000 +16.981026 -19.171630 198.221173 + +D18_034427_1842_XN_04N223W_93 1 0 +0.07569262450295 2.38359485050359 -2664.36301290588470 +0.000000 0.000000 0.000000 +16.725125 -21.260144 200.487410 + +D18_034427_1842_XN_04N223W_94 1 0 +0.07568183382181 2.38386104647574 -2638.07060800862700 +0.000000 0.000000 0.000000 +16.594710 -22.044769 201.269559 + +D18_034427_1842_XN_04N223W_95 1 0 +0.07643679545117 2.38552761204278 -2690.56559560058800 +0.000000 0.000000 0.000000 +15.675845 -27.235650 206.195255 + +D18_034427_1842_XN_04N223W_96 1 0 +0.07623428585878 2.38601314591603 -2694.26057747584850 +0.000000 0.000000 0.000000 +15.544069 -28.698193 207.536093 + +D18_034427_1842_XN_04N223W_97 1 0 +0.07631737925585 2.38695978353957 -2686.27068896026460 +0.000000 0.000000 0.000000 +15.102680 -31.678234 210.172179 + +D18_034427_1842_XN_04N223W_100 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D18_034427_1842_XN_04N223W_101 1 0 +0.07710648816635 2.38244666710461 -2674.75711326221560 +0.000000 0.000000 0.000000 +17.175873 -18.333013 196.741651 + +D18_034427_1842_XN_04N223W_102 1 0 +0.07688652201011 2.38274290176313 -2677.26103566083790 +0.000000 0.000000 0.000000 +17.020941 -19.135099 197.738385 + +D18_034427_1842_XN_04N223W_103 1 0 +0.07698732512292 2.38368560312227 -2672.80581237862630 +0.000000 0.000000 0.000000 +16.564778 -21.904031 200.604555 + +D18_034427_1842_XN_04N223W_104 1 0 +0.07725781409317 2.38541132577514 -2678.97299462173530 +0.000000 0.000000 0.000000 +15.715968 -27.142064 205.653107 + +D18_034427_1842_XN_04N223W_105 1 0 +0.07754700778459 2.38608822128795 -2685.90228806323600 +0.000000 0.000000 0.000000 +15.399055 -29.288174 207.534916 + +D18_034427_1842_XN_04N223W_106 1 0 +0.07765166471801 2.38685671421688 -2692.25024063419460 +0.000000 0.000000 0.000000 +15.016573 -31.719800 209.684940 + +D18_034427_1842_XN_04N223W_109 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D18_034427_1842_XN_04N223W_110 1 0 +0.07825589007503 2.38147469879649 -2682.03698709142510 +0.000000 0.000000 0.000000 +17.451342 -15.975560 193.541643 + +D18_034427_1842_XN_04N223W_111 1 0 +0.07779096713430 2.38218134499050 -2684.29760234323250 +0.000000 0.000000 0.000000 +17.201581 -17.824538 195.726538 + +D18_034427_1842_XN_04N223W_112 1 0 +0.07895148846826 2.38389953014639 -2680.28346486988720 +0.000000 0.000000 0.000000 +16.217541 -23.119061 200.946881 + +D18_034427_1842_XN_04N223W_113 1 0 +0.07880061008219 2.38515205025766 -2681.06893234571270 +0.000000 0.000000 0.000000 +15.663326 -26.827882 204.674503 + +D18_034427_1842_XN_04N223W_114 1 0 +0.07912751338502 2.38567210517307 -2680.52417618328260 +0.000000 0.000000 0.000000 +15.318241 -28.522912 206.122973 + +D18_034427_1842_XN_04N223W_115 1 0 +0.07923871661002 2.38663912598651 -2677.99579903359970 +0.000000 0.000000 0.000000 +14.857852 -31.566579 208.848441 + +D18_034427_1842_XN_04N223W_118 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D18_034427_1842_XN_04N223W_119 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D18_034427_1842_XN_04N223W_120 1 0 +0.07909884220495 2.38200418824725 -2690.58382550017360 +0.000000 0.000000 0.000000 +17.126492 -17.662860 195.032487 + +D18_034427_1842_XN_04N223W_121 1 0 +0.07958915360864 2.38399498135818 -2686.96445581800120 +0.000000 0.000000 0.000000 +16.080707 -23.583734 201.098650 + +D18_034427_1842_XN_04N223W_122 1 0 +0.08009889425598 2.38481478771522 -2679.85462936761360 +0.000000 0.000000 0.000000 +15.554520 -26.148241 203.564889 + +D18_034427_1842_XN_04N223W_123 1 0 +0.08046910387407 2.38552789985923 -2672.55767013319750 +0.000000 0.000000 0.000000 +15.188121 -28.462495 205.522407 + +D18_034427_1842_XN_04N223W_124 1 0 +0.08061159131957 2.38642896998550 -2675.54074709196630 +0.000000 0.000000 0.000000 +14.758322 -31.292753 208.080307 + +D18_034427_1842_XN_04N223W_127 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D18_034427_1842_XN_04N223W_128 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D18_034427_1842_XN_04N223W_129 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D18_034427_1842_XN_04N223W_130 1 0 +0.08075875899760 2.38374817253972 -2692.53416277825770 +0.000000 0.000000 0.000000 +15.903652 -23.154440 200.291959 + +D18_034427_1842_XN_04N223W_131 1 0 +0.08141052509445 2.38462180213221 -2690.64617614548210 +0.000000 0.000000 0.000000 +15.367770 -25.971438 202.863648 + +D18_034427_1842_XN_04N223W_132 1 0 +0.08100258222680 2.38538947599592 -2678.63187279621020 +0.000000 0.000000 0.000000 +15.170943 -28.178754 205.079066 + +D18_034427_1842_XN_04N223W_133 1 0 +0.08107923559935 2.38638560828210 -2672.62539557690660 +0.000000 0.000000 0.000000 +14.625275 -31.282872 207.987084 + +D18_034427_1842_XN_04N223W_136 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D18_034427_1842_XN_04N223W_137 1 0 +0.08263285059475 2.38133461572435 -2683.00038196366490 +0.000000 0.000000 0.000000 +16.588436 -16.809387 192.530755 + +D18_034427_1842_XN_04N223W_138 1 0 +0.08279974960993 2.38250646805897 -2690.30869720139620 +0.000000 0.000000 0.000000 +16.003621 -20.154424 196.259151 + +D18_034427_1842_XN_04N223W_139 1 0 +0.08261031901177 2.38350852393624 -2696.65974556668330 +0.000000 0.000000 0.000000 +15.646649 -23.032201 199.362676 + +D18_034427_1842_XN_04N223W_140 1 0 +0.08251437752552 2.38470567072780 -2690.28494079613620 +0.000000 0.000000 0.000000 +15.117034 -26.571930 203.059578 + +D18_034427_1842_XN_04N223W_141 1 0 +0.08252178672164 2.38497172662923 -2687.88964480168120 +0.000000 0.000000 0.000000 +14.987133 -27.369891 203.871116 + +D18_034427_1842_XN_04N223W_142 1 0 +0.08273138568844 2.38618775838929 -2677.18514019984560 +0.000000 0.000000 0.000000 +14.373310 -31.187855 207.337956 + +D18_034427_1842_XN_04N223W_145 1 0 +0.08314384168538 2.38103274708381 -2675.84592563813790 +0.000000 0.000000 0.000000 +16.548912 -16.154316 191.481310 + +D18_034427_1842_XN_04N223W_146 1 0 +0.08317744168997 2.38120280453428 -2677.11454964607540 +0.000000 0.000000 0.000000 +16.473178 -16.631674 192.031276 + +D18_034427_1842_XN_04N223W_147 1 0 +0.08412341655091 2.38235273174240 -2694.75483305667380 +0.000000 0.000000 0.000000 +15.647118 -20.139863 195.774669 + +D18_034427_1842_XN_04N223W_148 1 0 +0.08396046283667 2.38332546147269 -2703.61428483115830 +0.000000 0.000000 0.000000 +15.352435 -22.811291 198.892823 + +D18_034427_1842_XN_04N223W_149 1 0 +0.08382969551064 2.38454234990656 -2700.14471357864390 +0.000000 0.000000 0.000000 +14.804625 -26.475214 202.404746 + +D18_034427_1842_XN_04N223W_150 1 0 +0.08415135552261 2.38500847163554 -2682.70729949434510 +0.000000 0.000000 0.000000 +14.501748 -27.899922 203.943382 + +D18_034427_1842_XN_04N223W_151 1 0 +0.08420659528157 2.38557536272079 -2709.07468876130360 +0.000000 0.000000 0.000000 +14.195810 -29.662759 205.593161 + +D18_034427_1842_XN_04N223W_154 1 0 +0.08445366128885 2.38086053908945 -2693.54931873455550 +0.000000 0.000000 0.000000 +16.318131 -16.012310 190.999982 + +D18_034427_1842_XN_04N223W_155 1 0 +0.08446746372827 2.38108913070666 -2694.48856737328290 +0.000000 0.000000 0.000000 +16.202373 -16.637541 191.756412 + +D18_034427_1842_XN_04N223W_156 1 0 +0.08516972192796 2.38221092421286 -2711.85552712086470 +0.000000 0.000000 0.000000 +15.437729 -20.014731 195.299337 + +D18_034427_1842_XN_04N223W_157 1 0 +0.08531133572734 2.38318096403792 -2714.27035147828200 +0.000000 0.000000 0.000000 +14.951565 -22.858547 198.323136 + +D18_034427_1842_XN_04N223W_158 1 0 +0.08487854784259 2.38445288388345 -2715.67254439452740 +0.000000 0.000000 0.000000 +14.556977 -26.474738 202.239417 + +D18_034427_1842_XN_04N223W_159 1 0 +0.08495335374930 2.38469780263608 -2716.06210654754610 +0.000000 0.000000 0.000000 +14.428042 -27.255460 202.936374 + +D18_034427_1842_XN_04N223W_160 1 0 +0.08508087148994 2.38571223426977 -2717.83392672337000 +0.000000 0.000000 0.000000 +13.891814 -30.403139 205.895651 + +D17_033939_1843_XN_04N223W_4 1 0 +0.06625014491544 2.38458411814898 -2660.09067583645260 +0.000000 0.000000 0.000000 +15.424957 -21.243929 206.832700 + +D17_033939_1843_XN_04N223W_5 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_9 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_13 1 0 +0.06914475802492 2.38849791571965 -2691.91042356339680 +0.000000 0.000000 0.000000 +13.677446 -34.329995 216.544848 + +D17_033939_1843_XN_04N223W_20 1 0 +0.07092973369266 2.38765296577435 -2692.56170236194340 +0.000000 0.000000 0.000000 +14.425558 -32.174750 213.546801 + +D17_033939_1843_XN_04N223W_21 1 0 +0.07124567527532 2.38791278533474 -2698.29285741303420 +0.000000 0.000000 0.000000 +14.314792 -33.073778 214.155417 + +D17_033939_1843_XN_04N223W_25 1 0 +0.07208759676714 2.38812886508459 -2688.16093887141690 +0.000000 0.000000 0.000000 +14.385124 -34.098183 214.372349 + +D17_033939_1843_XN_04N223W_29 1 0 +0.07311197710963 2.38369244257928 -2669.10775639567560 +0.000000 0.000000 0.000000 +16.732203 -20.749382 201.564945 + +D17_033939_1843_XN_04N223W_30 1 0 +0.07330293353970 2.38497442689668 -2679.81370823157480 +0.000000 0.000000 0.000000 +16.086262 -24.613590 205.332402 + +D17_033939_1843_XN_04N223W_31 1 0 +0.07330334944136 2.38736095787319 -2698.73901108766950 +0.000000 0.000000 0.000000 +14.742326 -32.001938 212.123472 + +D17_033939_1843_XN_04N223W_32 1 0 +0.07338955731292 2.38770126601367 -2689.59693509426100 +0.000000 0.000000 0.000000 +14.587052 -33.119208 212.982204 + +D17_033939_1843_XN_04N223W_36 1 0 +0.07421918441302 2.38784091138244 -2692.79569474210350 +0.000000 0.000000 0.000000 +14.609923 -33.847835 213.049021 + +D17_033939_1843_XN_04N223W_40 1 0 +0.07549747478812 2.38735704567769 -2691.91140839931040 +0.000000 0.000000 0.000000 +14.872268 -32.659216 211.512798 + +D17_033939_1843_XN_04N223W_41 1 0 +0.07150549700838 2.38544854881654 -2675.67530043736500 +0.000000 0.000000 0.000000 +15.709075 -25.469598 207.255396 + +D17_033939_1843_XN_04N223W_42 1 0 +0.07475390508307 2.38388723029626 -2661.91289259634280 +0.000000 0.000000 0.000000 +16.603867 -21.807993 201.602253 + +D17_033939_1843_XN_04N223W_43 1 0 +0.07488635602731 2.38476634230257 -2586.85682367388290 +0.000000 0.000000 0.000000 +16.132327 -24.459763 204.191010 + +D17_033939_1843_XN_04N223W_47 1 0 +0.07695260085138 2.38601355619879 -2683.89396412280620 +0.000000 0.000000 0.000000 +15.475880 -28.909092 207.410839 + +D17_033939_1843_XN_04N223W_48 1 0 +0.07711389195528 2.38750877774350 -2693.85733975658380 +0.000000 0.000000 0.000000 +14.709003 -33.643352 211.559756 + +D17_033939_1843_XN_04N223W_51 1 0 +0.07754022960353 2.38686883133015 -2692.84999015609400 +0.000000 0.000000 0.000000 +14.944764 -31.743209 209.693445 + +D17_033939_1843_XN_04N223W_54 1 0 +0.07785708479223 2.38253471372513 -2681.75485602762140 +0.000000 0.000000 0.000000 +17.079795 -18.841307 196.831341 + +D17_033939_1843_XN_04N223W_55 1 0 +0.07855211987842 2.38691355057712 -2690.66497116621580 +0.000000 0.000000 0.000000 +14.702332 -32.182937 209.712136 + +D17_033939_1843_XN_04N223W_57 1 0 +0.07889926268603 2.38238197198576 -2695.25309797486630 +0.000000 0.000000 0.000000 +16.826406 -18.666046 196.391860 + +D17_033939_1843_XN_04N223W_58 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_62 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_63 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_66 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_67 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_68 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_69 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_70 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_73 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_74 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_75 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_79 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_82 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_83 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_84 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_85 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + +D17_033939_1843_XN_04N223W_86 0 0 +0.00000000000000 0.00000000000000 0.00000000000000 +0.000000 0.000000 0.000000 +0.000000 0.000000 0.000000 + diff --git a/plio/io/io_gpf.py b/plio/io/io_gpf.py new file mode 100644 index 0000000..485dfd9 --- /dev/null +++ b/plio/io/io_gpf.py @@ -0,0 +1,307 @@ +import math +import numpy as np +import pandas as pd + + +GPF_DATA_DTYPE = np.dtype([('point_id', np.int), ('stat', np.int), ('known', np.int), + ('lat_Y_North', np.float), ('long_X_East', np.float), ('ht', np.float), + ('sigma0', np.float), ('sigma1', np.float), ('sigma2', np.float), + ('res0', np.float), ('res1', np.float), ('res2', np.float)]) + + +def read_gpf(input_data): + """ + Read a socet gpf file into a pandas data frame + + Parameters + ---------- + input_file : str + path to the input data file + + Returns + ------- + df : pd.DataFrame + containing the gfp data with appropriate column names and indices + """ + + # Mixed types requires read as unicode - let pandas soft convert + d = np.genfromtxt(input_data, skip_header=3, dtype='unicode') + d = d.reshape(-1, 12) + + #TODO: cols should be used to dynamically generate the column names + + df = pd.DataFrame(d, columns=['point_id', 'stat', 'known', + 'lat_y_North', 'long_X_East','ht', + 'sigma0', 'sigma1', 'sigma2', + 'res0', 'res1', 'res2']) + # Soft conversion of numeric types to numerics + df = df.apply(pd.to_numeric, errors='ignore') + return df + + + + +# def GPF_SAV(input_data, ave=True): + # # read the IDL .SAV file + + # data = io.readsav(input_data, python_dict=True) + + # # put the spectra into data frames and combine them + # df_UV = pd.DataFrame(data['uv'], index=data['defuv']) + # df_VIS = pd.DataFrame(data['vis'], index=data['defvis']) + # df_VNIR = pd.DataFrame(data['vnir'], index=data['defvnir']) + # df_spect = pd.concat([df_UV, df_VIS, df_VNIR]) + # df_spect.columns = ['shot' + str(i + 1) for i in + # df_spect.columns] # add 1 to the columns so they correspond to shot number + + # df_aUV = pd.DataFrame(data['auv'], index=data['defuv'], columns=['average']) + # df_aVIS = pd.DataFrame(data['avis'], index=data['defvis'], columns=['average']) + # df_aVNIR = pd.DataFrame(data['avnir'], index=data['defvnir'], columns=['average']) + # df_ave = pd.concat([df_aUV, df_aVIS, df_aVNIR]) + + # df_mUV = pd.DataFrame(data['muv'], index=data['defuv'], columns=['median']) + # df_mVIS = pd.DataFrame(data['mvis'], index=data['defvis'], columns=['median']) + # df_mVNIR = pd.DataFrame(data['mvnir'], index=data['defvnir'], columns=['median']) + # df_med = pd.concat([df_mUV, df_mVIS, df_mVNIR]) + + # df = pd.concat([df_spect, df_ave, df_med], axis=1) + # # create multiindex to access wavelength values + # # also, round the wavlength values to a more reasonable level of precision + # df.index = [['wvl'] * len(df.index), df.index.values.round(4)] + # # transpose so that spectra are rows rather than columns + # df = df.T + + # # extract metadata from the file name and add it to the data frame + # # use the multiindex label "meta" for all metadata + + # fname = os.path.basename(input_data) + + # # for some reason, some ChemCam files have the 'darkname' key, others call it 'darkspect' + # # this try-except pair converts to 'darkname' when needed + # try: + # data['darkname'] + # except: + # data['darkname'] = data['darkspec'] + + # metadata = [fname, + # fname[4:13], + # fname[25:34].upper(), + # fname[34:36], + # data['continuumvismin'], + # data['continuumvnirmin'], + # data['continuumuvmin'], + # data['continuumvnirend'], + # data['distt'], + # data['darkname'], + # data['nshots'], + # data['dnoiseiter'], + # data['dnoisesig'], + # data['matchedfilter']] + # metadata = np.tile(metadata, (len(df.index), 1)) + # metadata_cols = list(zip(['meta'] * len(df.index), ['file', + # 'sclock', + # 'seqid', + # 'Pversion', + # 'continuumvismin', + # 'continuumvnirmin', + # 'continuumuvmin', + # 'continuumvnirend', + # 'distt', + # 'dark', + # 'nshots', + # 'dnoiseiter', + # 'dnoisesig', + # 'matchedfilter'])) + # metadata = pd.DataFrame(metadata, columns=pd.MultiIndex.from_tuples(metadata_cols), index=df.index) + + # df = pd.concat([metadata, df], axis=1) + # if ave == True: + # df = df.loc['average'] + # df = df.to_frame().T + # else: + # pass + + # return df + + +# def ccam_batch(directory, searchstring='*.csv', to_csv=None, lookupfile=None, ave=True, progressbar=None): + # # Determine if the file is a .csv or .SAV + # if '.sav' in searchstring.lower(): + # is_sav = True + # else: + # is_sav = False + # filelist = file_search(directory, searchstring) + # basenames = np.zeros_like(filelist) + # sclocks = np.zeros_like(filelist) + # P_version = np.zeros_like(filelist, dtype='int') + + # # Extract the sclock and version for each file and ensure that only one + # # file per sclock is being read, and that it is the one with the highest version number + # for i, name in enumerate(filelist): + # basenames[i] = os.path.basename(name) + # sclocks[i] = basenames[i][4:13] # extract the sclock + # P_version[i] = basenames[i][-5:-4] # extract the version + + # sclocks_unique = np.unique(sclocks) # find unique sclocks + # filelist_new = np.array([], dtype='str') + # for i in sclocks_unique: + # match = (sclocks == i) # find all instances with matching sclocks + # maxP = P_version[match] == max(P_version[match]) # find the highest version among these files + # filelist_new = np.append(filelist_new, filelist[match][maxP]) # keep only the file with thei highest version + + # filelist = filelist_new + # # Should add a progress bar for importing large numbers of files + # dt = [] + + # for i, file in enumerate(filelist): + # print(file) + # if is_sav: + # tmp = CCAM_SAV(file, ave=ave) + # else: + # tmp = CCAM_CSV(file, ave=ave) + # if i == 0: + # combined = tmp + # else: + # # This ensures that rounding errors are not causing mismatches in columns + # cols1 = list(combined['wvl'].columns) + # cols2 = list(tmp['wvl'].columns) + # if set(cols1) == set(cols2): + # combined = pd.concat([combined, tmp]) + # else: + # print("Wavelengths don't match!") + + # combined.loc[:, ('meta', 'sclock')] = pd.to_numeric(combined.loc[:, ('meta', 'sclock')]) + + # if lookupfile is not None: + + # combined = lookup(combined, lookupfile=lookupfile.replace('[','').replace(']','').replace("'",'').replace(' ','').split(',')) + # if to_csv is not None: + # combined.to_csv(to_csv) + # return combined + + + +# main(int argc, char *argv[]) +# { + + # char gpfFile[FILELEN]; + # char csvFile[FILELEN]; + # char pointIDsFile[FILELEN]; + + # FILE *gpfFp; // file pointer to input csv file + # FILE *csvFp; // file pointer to output csv file + # FILE *ptsFp; // file pointer to output point ids list file + + # char gpfLine[LINELENGTH]; + + # // check number of command line args and issue help if needed + # //----------------------------------------------------------- + # if (argc != 2) { + # printf ("\nrun %s as follows:\n",argv[0]); + # printf (" %s SSgpfFile\n", + # argv[0]); + # printf ("\nwhere:\n"); + # printf (" SSgpfFile = Socet Set *.gpf file, from a geographic project\n\n"); + # printf (" This program will convert a Socet Set ground point file into a CSV\n"); + # printf (" of lat,lon,height. The output file will have the same core name\n"); + # printf (" of the input *.gpf file, but with a .csv extension\n\n"); + # printf (" Also output is the list of point IDs that were converted. This file\n"); + # printf (" will be used to port the points back to Socet Set later on. The output\n"); + # printf (" file will have the same core name as the input file, but with a .pointids\n"); + # printf (" .tiePointIds.txt extension.\n"); + # exit(1); + # } + + # //------------------------------------------------ + # // get input arguments entered at the command line + # //------------------------------------------------ + + # strcpy (gpfFile,argv[1]); + + # //----------------------------- + # // generate ouput file names + # //----------------------------- + + # char corename[FILELEN]; + # strcpy (corename,gpfFile); + # int len = strlen(corename); + # corename[len-4] = '\0'; + + # strcpy (csvFile,corename); + # strcat (csvFile,".csv"); + + # strcpy (pointIDsFile,corename); + # strcat (pointIDsFile,".tiePointIds.txt"); + + # ///////////////////////////////////////////////////////////////////////////// + # // open files + # ///////////////////////////////////////////////////////////////////////////// + + # gpfFp = fopen (gpfFile,"r"); + # if (gpfFp == NULL) { + # printf ("unable to open input gpf file: %s\n",gpfFile); + # exit (1); + # } + + # csvFp = fopen (csvFile,"w"); + # if (csvFp == NULL) { + # printf ("unable to open output csv file: %s\n",csvFile); + # fclose(gpfFp); + # exit (1); + # } + + # ptsFp = fopen (pointIDsFile,"w"); + # if (csvFp == NULL) { + # printf ("unable to open output list file of tie point ids: %s\n",pointIDsFile); + # fclose(gpfFp); + # fclose(csvFp); + # exit (1); + # } + + # //------------------------------------------------ + # //------------------------------------------------ + + # // skip the header + # fgets(gpfLine,LINELENGTH,gpfFp); + + # // read in number of points in *.gpf file + # char value[50]; + # fgets(gpfLine,LINELENGTH,gpfFp); + # sscanf (gpfLine,"%s",value); + # int numpts = atoi(value); + + # // skip next header + # fgets(gpfLine,LINELENGTH,gpfFp); + + # // Parse gpf, output csv + # char pointID[50], valStat[2], valKnown[2]; + # char valLon[50], valLat[50], Height[50]; + # double rad2dd = 57.295779513082320876798154814105; + + # for (int i=0; i<numpts; i++) { + # fgets(gpfLine,LINELENGTH,gpfFp); + # sscanf (gpfLine,"%s %s %s",pointID,valStat,valKnown); + # int stat = atoi(valStat); + # int known = atoi(valKnown); + + # // get coordinate + # fgets(gpfLine,LINELENGTH,gpfFp); + + # //only output tie points that are on + # if (stat == 1 && known == 0) { + # sscanf (gpfLine,"%s %s %s",valLat,valLon,Height); + # double radLat = atof(valLat); + # double radLon = atof(valLon); + # fprintf(csvFp,"%.14lf,%.14lf,%s\n",rad2dd*radLat,rad2dd*radLon,Height); + # fprintf(ptsFp,"%s\n",pointID); + # } + + # // skip next three lines in input *.gpf file + # for (int j=0; j<3; j++) + # fgets(gpfLine,LINELENGTH,gpfFp); + # } + + # fclose(gpfFp); + # fclose(csvFp); + +# } // end of program diff --git a/plio/io/tests/test_gpf.py b/plio/io/tests/test_gpf.py new file mode 100644 index 0000000..b92a6ab --- /dev/null +++ b/plio/io/tests/test_gpf.py @@ -0,0 +1,17 @@ +import numpy as np +import pandas as pd + +from plio.io.io_gpf import read_gpf +from plio.examples import get_path + +import pytest + +@pytest.fixture +def insight_gpf(): + return get_path('InSightE08_XW.gpf') + +@pytest.mark.parametrize('gpf, expected', [(insight_gpf(),'foo')]) +def test_read_gfp(gpf, expected): + df = read_gpf(gpf) + print(df) + assert False -- GitLab