-
Notifications
You must be signed in to change notification settings - Fork 4
/
minxss_plot_eclipse_period_stk.pro
72 lines (64 loc) · 3.43 KB
/
minxss_plot_eclipse_period_stk.pro
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
72
;+
; NAME:
; minxss_plot_eclipse_period_stk
;
; PURPOSE:
; Make a plot of the MinXSS FM-1 eclipse period as determined by STK using the MinXSS TLE
;
; INPUTS:
; None
;
; OPTIONAL INPUTS:
; stkEclipseReportFilename [string]: The path and filename of the eclipse report generated by STK.
; A copy of it lives in the Google Drive > MinXSS Server > 8000 Ground Software/Mission Ops > MinXSS Eclispe STK report.txt.
; Defaults to the location on James Paul Mason's computer.
; stkEclipseReportAsciiTemplateFilename [string]: The template for reading this file generated by James Paul Mason on 2016/07/14.
; It lives in the same spot of the Google Drive.
; KEYWORD PARAMETERS:
; None
;
; OUTPUTS:
; Plot of eclipse period versus time, with min, mean, max overlaid
;
; OPTIONAL OUTPUTS:
; None
;
; RESTRICTIONS:
; Requires the STK eclipse report file
;
; EXAMPLE:
; minxss_plot_eclipse_period_stk, stkEclipseReportFilename = '/Users/jmason86/Drive/CubeSat/MinXSS Server/8000 Ground Software : Mission Ops/MinXSS Eclispe STK report.txt'
;
; MODIFICATION HISTORY:
; 2016/07/14: James Paul Mason: Wrote script.
;-
PRO minxss_plot_eclipse_period_stk, stkEclipseReportFilename = stkEclipseReportFilename, stkEclipseReportAsciiTemplateFilename = stkEclipseReportAsciiTemplateFilename
IF stkEclipseReportFilename EQ !NULL THEN stkEclipseReportFilename = '/Users/' + getenv('username') + '/Drive/CubeSat/MinXSS Server/8000 Ground Software : Mission Ops/MinXSS Eclispe STK report.txt'
IF stkEclipseReportAsciiTemplateFilename EQ !NULL THEN stkEclipseReportAsciiTemplateFilename = '/Users/' + getenv('username') + '/Drive/CubeSat/MinXSS Server/8000 Ground Software : Mission Ops/stkEclipseReportAsciiTemplate.sav'
; Load data
restore, stkEclipseReportAsciiTemplateFilename
eclipseData = read_ascii(stkEclipseReportFilename, TEMPLATE = stkEclipseReportAsciiTemplate)
; Reformat time to be single string (in the human format of yyyy-mm-dd hh:mm:ss) rather than 4 element string
month = reform(eclipseData.timeOfMaxShadow[1, *])
mm = JPMmon2mm(month)
timeOfMaxShadow = reform(eclipseData.timeOfMaxShadow[2, *] + '-' + mm + '-' + eclipseData.timeOfMaxShadow[0, *] + ' ' + strmid(eclipseData.timeOfMaxShadow[3, *], 0, 8))
; Convert time in human units to jd
jd = JPMyyyymmddhhmmss2jd(timeOfMaxShadow)
; Convert eclispe duration to minutes
eclipseDurationMinutes = eclipseData.durationSec / 60.
; Determine statistics
minEclipse = min(eclipseDurationMinutes, minEclipseIndex)
meanEclipse = mean(eclipseDurationMinutes)
maxEclipse = max(eclipseDurationMinutes, maxEclipseIndex)
; Create plot
labelDate = label_date(DATE_FORMAT = ['%M', '%Y'])
p1 = plot(jd, eclipseDurationMinutes, '2', DIMENSIONS = [700, 680], $
TITLE = 'MinXSS-1 Eclipse Durations Over Mission Life', $
XTITLE = 'Time [UTC]', XMINOR = 2, XTICKFORMAT = ['LABEL_DATE', 'LABEL_DATE'], XTICKUNITS = ['Month', 'Year'], $
YTITLE = 'Eclipse Duration [min]')
p2 = plot([jd[minEclipseIndex], jd[minEclipseIndex]], p1.yrange, 'r2--', /OVERPLOT)
p3 = plot([jd[maxEclipseIndex], jd[maxEclipseIndex]], p1.yrange, 'b2--', /OVERPLOT)
t1 = text(0.65, 0.30, 'Min = ' + JPMPrintNumber(minEclipse), COLOR = 'red')
t2 = text(0.65, 0.26, 'Mean = ' + JPMPrintNumber(meanEclipse))
t3 = text(0.65, 0.22, 'Max = ' + JPMPrintNumber(maxEclipse), COLOR = 'blue')
END