Example #1
0
print(t1)
print(delta_t.sec)

# sunpy time ranges
from sunpy.time import TimeRange
time_range = TimeRange(t0, t1)
print(time_range.center)
tc = Time(time_range.center, scale='utc')
print(tc.mjd)
print(tc.datetime)
print(time_range.seconds)
print(time_range.next())

# example of windowing time ranges at a candence in sunpy (potentially very useful!)
import astropy.units as u
w = time_range.window(600 * u.second, 60 * u.second)
for win in w:
    print(win.center)
"""
illustration of how I think I will use Astropy and Sunpy time objects
- start with a set of dates that spans your range of interest
- convert these to astropy time objects
- generate a sunpy time range that spans the whole interval
- divide up this interval into entries
"""
print('\n---------------------\n')
date_start = '2012-07-01T00:00:00.000'
date_end = '2012-08-01T00:00:00.000'
time_start = Time(date_start, scale='utc')
time_end = Time(date_end, scale='utc')
cadence = 2 * u.hour
Example #2
0
                                         filter_str, ','.join(segments))

    keys, segs = client.query(query_string, key=keystr, seg=segstr)

    return keys, segs


# test a time interval
time_start = Time('2011-02-01T00:00:00.000', scale='utc')
time_end = Time('2011-02-04T00:00:00.000', scale='utc')
interval_cadence = 2 * u.min
aia_search_cadence = 12 * u.second

# generate the list of time intervals
full_range = TimeRange(time_start, time_end)
time_ranges = full_range.window(interval_cadence, interval_cadence)

# pick a time range to experiement with
time_range = time_ranges[0]

print(len(time_ranges))
print(time_range)

#print(jsoc_build_time_string_from_range(time_range,aia_search_cadence))

keys, segs = jsoc_query_time_interval(time_range, 193, aia_search_cadence)

# = client.query(query_string, key=keystr, seg=segstr)

if len(keys) > 0:
    timestrings = keys['T_OBS'].get_values().astype('str')
Example #3
0
from sunpy.time import TimeRange
from sunpy.lightcurve import GOESLightCurve

dt = TimeRange('1981/01/10 00:00', '2014/04/18 23:00')

tr_not_found = []

time_ranges = dt.window(60*60*24, 60*60*24)
total_days = len(time_ranges)
total_fails = 0

# missing files http://umbra.nascom.nasa.gov/goes/fits/2005/go1220051116.fits
# http://umbra.nascom.nasa.gov/goes/fits/2005/go1220051116.fits
for time_range in time_ranges:
    print(time_range.start())
    try:
        goes = GOESLightCurve.create(time_range)
        print(goes.data['xrsa'].max())
        print(goes.data['xrsb'].max())
    except:
        print("File Not Found!")
        tr_not_found.append(time_range)
        total_fails = total_fails + 1

print('Number of fails:%i' % total_fails)
print('Number of tries:%i' % total_days)
print('Percent Fail: %d' % (float(total_fails)/total_days * 100))

for tr in tr_not_found:
    print(tr.start())