-
Notifications
You must be signed in to change notification settings - Fork 3
/
output_PyEphem.py
72 lines (51 loc) · 2.26 KB
/
output_PyEphem.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
################################################################################
# Copyright 2015 Samuel Gongora Garcia (s.gongoragarcia@gmail.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
# Author: s.gongoragarcia[at]gmail.com
################################################################################
class Read_pyephem_data:
def __init__(self, index_satellite):
import os
index_satellite = index_satellite + 1
directorio_script = os.getcwd()
# Pyephem routine
self.open_pyephem(directorio_script)
self.open_files_pyephem(index_satellite)
os.chdir(directorio_script)
def open_pyephem(self, directorio_script):
import os
# PyEphem data
os.chdir(directorio_script + '/results/PyEphem')
self.files_pyephem = os.listdir(os.getcwd())
self.files_pyephem.sort()
def open_files_pyephem(self, index_satellite):
for i in range(index_satellite):
self.open_file_pyephem(self.files_pyephem[i])
self.satellite_name = self.files_pyephem[i]
def open_file_pyephem(self, name):
self.pyephem_simulation_time = []
self.pyephem_alt_satellite = []
self.pyephem_az_satellite = []
import csv
with open(name) as tsv:
for line in csv.reader(tsv, delimiter = "\t"):
self.pyephem_simulation_time.append(int(line[0]))
self.pyephem_alt_satellite.append(float(line[1]))
self.pyephem_az_satellite.append(float(line[2]))
self.pyephem_simulation_time = [int(item) for item in self.pyephem_simulation_time]
self.pyephem_alt_satellite = [float(item) for item in self.pyephem_alt_satellite]
self.pyephem_az_satellite = [float(item) for item in self.pyephem_az_satellite]