def fetch_aia(self, product, correct=True, median_kernel=5):
        """
        pull halpha from that time from Virtual Solar Observatory GONG archive
        :param product: aia-[REQUESTED CHANNEL IN ANGSTROMS], e.g. aia-131 gets the 131 angstrom image
        :param correct: remove nans and negatives
        :return: tuple of product name, fits header, and data object
            the header and data object will be None if the request failed
        """

        if self.verbose:
            print("Requesting {}".format(product))

        wavelength = product.split("-")[1]

        def time_interval(time):
            """ get a window of three minutes around the requested time to ensure an image at GONG cadence"""
            return time - timedelta(minutes=15), time + timedelta(minutes=15)

        # setup the query for an halpha image and fetch, saving the image in the current directory
        client = vso.VSOClient()
        wave, source = Quantity(wavelength, "angstrom"), "aia"
        query = client.search(vso.attrs.Time(*time_interval(self.date)),
                              vso.attrs.Instrument(source),
                              vso.attrs.Wavelength(wave))
        if self.verbose:
            print("Query length for {} is {}".format(product, len(query)))

        if not query: # failed to get a result
            return product, None, None
        else:
            query = query[0]

        result = client.fetch([query], path="./").wait(progress=False)
        time.sleep(1)  # sleep because on macs there's sometimes a bug where the file isn't recognized if you dont...

        # open the image and remove the file
        with fits.open(result[0]) as hdu:
            hdu.verify('fix')
            head = hdu[1].header
            data = hdu[1].data
        os.remove(result[0])

        data, head = self.align_solar_fov(head, data, 2.5, 1280, rotate=False)
        data = resize(data, (1280, 1280))
        head['NAXIS1'] = 1280
        head['NAXIS2'] = 1280
        head['CRPIX1'] = 640
        head['CRPIX2'] = 640
        head['CDELT1'] = 2.5
        head['CDELT2'] = 2.5

        if correct:
            data[np.isnan(data)] = 0
            data[data < 0] = 0

        if median_kernel:
            data = medfilt(data, median_kernel)

        return product, head, data
def fetch_aia ( self , product , correct = True , median_kernel = 5 ) : if self . verbose : print ( "Requesting {}" . format ( product ) ) wavelength = product . split ( "-" ) [ 1 ] def time_interval ( time ) : return time - timedelta ( minutes = 15 ) , time + timedelta ( minutes = 15 ) client = vso . VSOClient ( ) wave , source = Quantity ( wavelength , "angstrom" ) , "aia" query = client . search ( vso . attrs . Time ( * time_interval ( self . date ) ) , vso . attrs . Instrument ( source ) , vso . attrs . Wavelength ( wave ) ) if self . verbose : print ( "Query length for {} is {}" . format ( product , len ( query ) ) ) if not query : return product , None , None else : query = query [ 0 ] result = client . fetch ( [ query ] , path = "./" ) . wait ( progress = False ) time . sleep ( 1 ) with fits . open ( result [ 0 ] ) as hdu : hdu . verify ( 'fix' ) head = hdu [ 1 ] . header data = hdu [ 1 ] . data os . remove ( result [ 0 ] ) data , head = self . align_solar_fov ( head , data , 2.5 , 1280 , rotate = False ) data = resize ( data , ( 1280 , 1280 ) ) head [ 'NAXIS1' ] = 1280 head [ 'NAXIS2' ] = 1280 head [ 'CRPIX1' ] = 640 head [ 'CRPIX2' ] = 640 head [ 'CDELT1' ] = 2.5 head [ 'CDELT2' ] = 2.5 if correct : data [ np . isnan ( data ) ] = 0 data [ data < 0 ] = 0 if median_kernel : data = medfilt ( data , median_kernel ) return product , head , data
pull halpha from that time from Virtual Solar Observatory GONG archive
        :param product: aia-[REQUESTED CHANNEL IN ANGSTROMS], e.g. aia-131 gets the 131 angstrom image
        :param correct: remove nans and negatives
        :return: tuple of product name, fits header, and data object
            the header and data object will be None if the request failed