Package edu.gsu.cs.dmlab.datasources
Class HelioviewerImageFileDatasource
- java.lang.Object
-
- edu.gsu.cs.dmlab.datasources.HelioviewerImageFileDatasource
-
- All Implemented Interfaces:
IImageFileDataSource
public class HelioviewerImageFileDatasource extends Object implements IImageFileDataSource
This class is intended to pull images from the Helioviewer API. These images are returned in a raw byte array, which is meant to be either read as a JP2 image or saved to disk as a JP2 image file.- Author:
- Dustin Kempton, Data Mining Lab, Georgia State University
-
-
Constructor Summary
Constructors Constructor Description HelioviewerImageFileDatasource(int maxCacheSize, int cadenceMin, int expireMinutes)
Constructor builds a Helioviewer Image File puller that requires the returned image to be within as set number of minutes of the queried time.HelioviewerImageFileDatasource(int maxCacheSize, int cadenceMin, int expireMinutes, org.slf4j.Logger logger)
Constructor builds a Helioviewer Image File puller that requires the returned image to be within as set number of minutes of the queried time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.commons.math3.util.Pair<byte[],String>
getImageAtTime(org.joda.time.DateTime timeStamp, Waveband wavelength)
Method that gets an image as a byte array that corresponds to the input time and wavelength from the datasource.
-
-
-
Constructor Detail
-
HelioviewerImageFileDatasource
public HelioviewerImageFileDatasource(int maxCacheSize, int cadenceMin, int expireMinutes)
Constructor builds a Helioviewer Image File puller that requires the returned image to be within as set number of minutes of the queried time. The object uses a cache on the list of image files in a directory on the datasource that correspond to a particular day. Since the datasource is updating that list for the current day, it is necessary to purge that list to have an updated list of files available. To do this the cache is set to purge that list after a number of minutes of that list not being accessed.- Parameters:
maxCacheSize
- The maximum number of directories to cache the list of files for, this speeds up searching for files that match the date because the list doesn't need to be rebult each time.cadenceMin
- The allowed number of minutes difference between the query time and the returned image time.expireMinutes
- The number of minutes of not accessing a list of files available for a day before that list is purged from the cache and will need to be pulled from the datasource again.
-
HelioviewerImageFileDatasource
public HelioviewerImageFileDatasource(int maxCacheSize, int cadenceMin, int expireMinutes, org.slf4j.Logger logger)
Constructor builds a Helioviewer Image File puller that requires the returned image to be within as set number of minutes of the queried time. The object uses a cache on the list of image files in a directory on the datasource that correspond to a particular day. Since the datasource is updating that list for the current day, it is necessary to purge that list to have an updated list of files available. To do this the cache is set to purge that list after a number of minutes of that list not being accessed.- Parameters:
maxCacheSize
- The maximum number of directories to cache the list of files for, this speeds up searching for files that match the date because the list doesn't need to be rebult each time.cadenceMin
- The allowed number of minutes difference between the query time and the returned image time.expireMinutes
- The number of minutes of not accessing a list of files available for a day before that list is purged from the cache and will need to be pulled from the datasource again.logger
- A logging mechanism so we can see what is going on
-
-
Method Detail
-
getImageAtTime
public org.apache.commons.math3.util.Pair<byte[],String> getImageAtTime(org.joda.time.DateTime timeStamp, Waveband wavelength)
Description copied from interface:IImageFileDataSource
Method that gets an image as a byte array that corresponds to the input time and wavelength from the datasource. It returns a pair of byte array and string, where the byte array is the byte representation of the image in whatever format it is stored in its respective source and the string is the name of the image from the datasourc. The byte array is intended to be the raw file representation of the image and can be saved as a file or read into whatever decoding method is necessary to get the desired representation.- Specified by:
getImageAtTime
in interfaceIImageFileDataSource
- Parameters:
timeStamp
- The time that the image was recorded.wavelength
- The wavelength the image was recorded in.- Returns:
- The pair of byte array and string that represents the results, or null if no image was found fitting the constraints desired.
-
-