Created
March 31, 2019 10:22
-
-
Save jains8844/fc55cb2c4c6bafa3e336f5ab3b4e2c8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sunpy.time import parse_time | |
from astropy.coordinates import SkyCoord | |
from sunpy.coordinates import frames | |
from astropy import units as u | |
from sunpy.net import hek | |
def coordinate_conversion(query): | |
if query["hpc_bbox"]: | |
coordinate_string = query["hpc_bbox"][9:-2] | |
coordinate_list = coordinate_string.split(",") | |
for i in range(len(coordinate_list)): | |
coordinate_list[i] = coordinate_list[i].split() | |
coordinate_list[i] = [ | |
float(coordinate_list[i][0]), | |
float(coordinate_list[i][1]), | |
] | |
print(coordinate_list) | |
return SkyCoord(coordinate_list * u.arcsec, frame=frames.Helioprojective) | |
class FE(object): | |
def __init__(self, query, **kwargs): | |
self.starttime = parse_time(query["event_starttime"]) | |
self.endtime = parse_time(query["event_endtime"]) | |
self.boundary = coordinate_conversion(query) | |
x = hek.HEKClient() | |
y = x.search(hek.attrs.Time("2018/01/01", "2018/01/30"), hek.attrs.CH) | |
z = FE(y[0]) | |
print(z.starttime, z.endtime, z.boundary) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment