Skip to content
Snippets Groups Projects
Commit 28458fff authored by Max Drexler's avatar Max Drexler
Browse files

reworked visualizer script:

parent 9ca7a813
No related branches found
No related tags found
No related merge requests found
...@@ -13,23 +13,19 @@ except ImportError as e: ...@@ -13,23 +13,19 @@ except ImportError as e:
print("Numpy is needed to generate graphs") print("Numpy is needed to generate graphs")
sys.exit(1) sys.exit(1)
SAT_ROW = 0
def init_plot(): YEAR_ROW = 1
plt.ylabel('Year') DAY_ROW = 2
plt.xlabel('Longitude') SUBPOINT_LON_ROW = 3
plt.title('Geostationary Equator Coverage') SUBPOINT_LAT_ROW = 4
plt.figure().set_figheight(15)
def genData(data):
plt.xlim(-180, 180) x_vals = np.char.partition(data[:,SUBPOINT_LAT_ROW], ':')[:,0].astype('float')
def addPlot(subptPath):
data = np.loadtxt(subptPath, dtype='str')
x_vals = np.char.partition(data[:,2], ':')[:,0].astype('float')
heights = np.full_like(data[:,0], 1/ 365, dtype = 'float') heights = np.full_like(data[:,0], 1/ 365, dtype = 'float')
widths = np.full_like(data[:,0], 60, dtype='float') widths = np.full_like(data[:,0], 60, dtype='float')
bottoms = np.add([int(x[:4]) for x in data[:,0]],[int(x[4:])/365 for x in data[:,0]]) bottoms = np.add([int(x) for x in data[:,YEAR_ROW]],[int(x)/365 for x in data[:,DAY_ROW]])
plt.bar(x_vals, heights, width = widths, bottom = bottoms) return (x_vals, heights, widths, bottoms)
def main(argv): def main(argv):
parser = argparse.ArgumentParser(description='A utility that visualizes daily positions of satellites') parser = argparse.ArgumentParser(description='A utility that visualizes daily positions of satellites')
parser.add_argument('-v','--verbose', action='store_true', help='programs verbocity') parser.add_argument('-v','--verbose', action='store_true', help='programs verbocity')
...@@ -38,9 +34,25 @@ def main(argv): ...@@ -38,9 +34,25 @@ def main(argv):
args = parser.parse_args(argv) args = parser.parse_args(argv)
init_plot() plt.ylabel('Year')
plt.xlabel('Longitude')
plt.title('Geostationary Equator Coverage')
plt.figure().set_figheight(15)
plt.xlim(-180, 180)
min_date = 9999999
max_date = -9999999
plot_list = []
for subpt in args.list: for subpt in args.list:
addPlot(subpt) data = np.loadtxt(subpt, dtype='str')
min_date = min(min_date, int(data[0][1]))
max_date = max(max_date, int(data[-1][1]))
plot_list.append(genData(data))
plt.ylim(min_date, max_date)
for dat in plot_list:
plt.bar(dat[0], dat[1], width = dat[2], bottom = dat[3])
plt.savefig(os.path.join(args.outdir, args.list[0] + '.png')) plt.savefig(os.path.join(args.outdir, args.list[0] + '.png'))
......
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