1
"""Classes for working with known data servers"""
6
"""Class for interacting with data servers."""
7
def __init__(self, uri):
9
self.pause = datetime.timedelta(minutes=3)
11
# Example: 2011_11_17__08_13_08_13__SDO_AIA_AIA_304.jp2
12
self.filename_regex = (
13
"^(?P<year>\d{4})_(?P<month>\d{2})_(?P<day>\d{2})__" +
14
"(?P<hour>\d{2})_(?P<min>\d{2})_(?P<sec>\d{2})_" +
15
"(?P<microsec>\d{2,3})__" +
16
"(?P<obs>[a-zA-Z0-9]{3})_(?P<inst>[a-zA-Z0-9]{3})_" +
17
"(?P<det>[a-zA-Z0-9]{3})_(?P<meas>[a-zA-Z0-9]{2,11})\.jp2$")
19
def get_starttime(self):
20
"""Default start time to use when retrieving data"""
21
return datetime.datetime.utcnow() - datetime.timedelta(days=1)
23
def get_dates(self, start, end):
24
"""Get a complete list of dates between the start and the end time"""
27
def get_file_regex(self):
28
"""Returns a regex which described the expected format of filenames on
30
return self.filename_regex
32
def get_nicknames(self):
33
"""Get a list of nicknames at the root of the data server"""
36
def get_measurements(self, nicknames, dates):
37
"""Get a list of all the URIs down to the measurement"""
41
"""Return the server URI"""
44
def get_locations(self, start, end):
45
"""This scans the URI and finds all the possible nicknames, then adds in the requested
46
dates, then scans for all the measurements.
48
nicknames = self.get_nicknames()
49
#dates = self.get_dates(self,start,end)
50
#measurements = self.get_measurements(self,nicknames,dates)