diff --git a/geomagio/Controller.py b/geomagio/Controller.py index 0f04652cbf40a36c6ec7748e004ecb7b47ca9f3f..2584ab15ad45001343150060a30c23a9fc589c2b 100644 --- a/geomagio/Controller.py +++ b/geomagio/Controller.py @@ -299,6 +299,7 @@ def get_input_factory(args): input_factory = imfv283.GOESIMFV283Factory( directory=args.input_goes_directory, getdcpmessages=args.input_goes_getdcpmessages, + password=args.input_goes_password, server=args.input_goes_server, user=args.input_goes_user, **input_factory_args) @@ -634,6 +635,9 @@ def parse_args(args): parser.add_argument('--input-goes-getdcpmessages', default='', help='Location of getDcpMessages.') + parser.add_argument('--input-goes-password', + default='', + help='Password for goes user') parser.add_argument('--input-goes-server', nargs='*', help='The server name(s) to retrieve the GOES data from') diff --git a/geomagio/imfv283/GOESIMFV283Factory.py b/geomagio/imfv283/GOESIMFV283Factory.py index 27a9818ec23783c73c09ca29c33388e6e84b1d83..137f74cdc7eb3ec4a0292098336a82d79fe1d581 100644 --- a/geomagio/imfv283/GOESIMFV283Factory.py +++ b/geomagio/imfv283/GOESIMFV283Factory.py @@ -39,17 +39,14 @@ class GOESIMFV283Factory(IMFV283Factory): IMFV283Factory Timeseriesfactory """ - def __init__(self, observatory=None, channels=None, - type=None, interval='minute', directory=None, - getdcpmessages=None, server=None, user=None): - IMFV283Factory.__init__(self, None, observatory, channels, - type, interval) + def __init__(self, directory=None, getdcpmessages=None, + password=None, server=None, user=None, **kwargs): + IMFV283Factory.__init__(self, None, **kwargs) self.directory = directory self.getdcpmessages = getdcpmessages self.server = server self.user = user - self.observatories = observatory - self.observatory = observatory[0] + self.password = password self.javaerror = 'java.io.IOException: Socket closed' def get_timeseries(self, starttime, endtime, observatory=None, @@ -80,6 +77,19 @@ class GOESIMFV283Factory(IMFV283Factory): return timeseries + def _post_process(self, timeseries): + """And metadata to the timeseries traces. + + Parameters + ---------- + timeseries: obspy.core.Stream + timeseries object with incomplete metadata + """ + for trace in timeseries: + stats = trace.stats + self.observatoryMetadata.set_metadata(stats, stats.station, + stats.channel, 'variation', 'minute') + def _retrieve_goes_messages(self, starttime, endtime, observatory): """Retrieve goes messages, using getdcpmessages commandline tool. @@ -117,10 +127,11 @@ class GOESIMFV283Factory(IMFV283Factory): print >> sys.stderr, server proc = subprocess.Popen( [self.getdcpmessages, - '-h ' + server, - '-u ' + self.user, - '-f ' + self.directory + '/' + self.criteria_file_name, - '-t 60', + '-h', server, + '-u', self.user, + '-P', self.password, + '-f', self.directory + '/' + self.criteria_file_name, + '-t', '60', '-n'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) (output, error) = proc.communicate() print >> sys.stderr, error