# -*- coding: utf-8 -*- """ Created on Mon Dec 30 15:56:49 2019 @author: ppantina """ ##Import some libraries from matplotlib import pyplot as plt import platform import sys import time import matplotlib import datetime ##Define paths matplotlib.use('Agg') plot_path = '/eraid2a/webshare/GLOVE/radar_rt_plot/health/' sys.path.append('/home/ppantina/programs/subroutines') import sub_radar_telemetry_ARENA ##Determine radar name radar_name_idx = input('Which RADAR are you running?\n\ CRS = 1\n\ EXRAD = 2\n\ HIWRAP = 3\n\ MBARS = 4\n\ QUIT = q\n') #problem = input('Do you need to alter the start time? Y or N? ') if radar_name_idx == '1': radar_name = 'CRS' elif radar_name_idx == '2': radar_name = 'EXRAD' elif radar_name_idx == '3': radar_name = 'HIWRAP' elif radar_name_idx == '4': radar_name = 'MBARS' else: sys.exit() save_step = 100 ##Save every x images #if problem == 'Y': end_time = int(input('Enter correct Linux time: ')) if radar_name == 'MBARS': fig = plt.figure(figsize = (17,17)) else: fig = plt.figure(figsize = (11,8.5)) plt.ioff() ##Main loop for k in range(10000): print ('Step' + str(k)) end_time = int(time.time()) ##set the end-time (RHS of plot) to current time #end_time = 1721246951 + 3600*4 ##set the end-time (RHS of plot) to current time start_time = end_time - 3600*8 ##grab 8 hr of data (LHS of initial plot) ##Run data subroutine sdate, epoch, data, code1, code2 = sub_radar_telemetry_ARENA.sub_radar_health(radar_name, start_time, end_time) if datetime.datetime.timestamp(sdate[-1]) - datetime.datetime.timestamp(sdate[0]) > 50000: #sometimes we lose NTP and have bad data stretches sdate = sdate[65:] data = data [65:] #Run plot subroutine sub_radar_telemetry_ARENA.sub_radar_health_plot (k, fig, save_step, plot_path, radar_name, start_time, end_time, sdate, data)