# Path: pyweed/options.py
# class Options(object, metaclass=OptionsMeta):
#     """
#     Base class for a web service request.
#     """
# 
#     def set_options(self, options):
#         """
#         Set all the options in the given dictionary
#         """
#         LOGGER.debug("Set options: %s", options)
#         for k, v in options.items():
#             if k in self._options:
#                 setattr(self, k, v)
# 
#     def get_options(self, keys=None, hidden=True, stringify=False):
#         """
#         Return the options as a dictionary, with a few options
#         @param keys: only include the options named
#         @param hidden: if True, include options where Option.hidden is set
#         @param stringify: convert the option value to a string
#         """
#         options = {}
#         if not keys:
#             keys = self.keys(hidden=hidden)
#         for attr in keys:
#             option = self._options.get(attr)
#             if option:
#                 value = getattr(self, attr, None)
#                 if value is not None:
#                     if stringify:
#                         options[attr] = option.to_string(value)
#                     else:
#                         options[attr] = value
#         LOGGER.debug("get_options: %s", options)
#         return options
# 
#     def keys(self, hidden=True):
#         """
#         Return a list of keys
# 
#         @param hidden: if True, include options where Option.hidden is set
#         """
#         return [key for key, option in self._options.items() if hidden or not option.hidden]
# 
#     def __setattr__(self, k, v):
#         if k in self._options:
#             v = self._options[k].to_option(v)
#         self.__dict__[k] = v
# 
#     def __repr__(self):
#         return repr(self.get_options())
# 
# class DateOption(Option):
#     """
#     A date parameter.
#     """
#     def to_option(self, value):
#         # Value can be a number indicating number of days relative to today
#         if isinstance(value, Number):
#             return UTCDateTime() + timedelta(days=value)
#         else:
#             return UTCDateTime(value)
# 
#     def to_string(self, value):
#         if hasattr(value, 'isoformat'):
#             return value.isoformat()
#         elif isinstance(value, str):
#             return value
#         else:
#             raise ValueError("%s is not a date" % (value,))
# 
# class FloatOption(Option):
#     """
#     A floating point value
#     """
#     def to_option(self, value):
#         return float(value)
# 
# class Option(object):
#     """
#     Defines a web service query parameter.  This allows the service API to take parameter
#     values as Python objects, and convert them to the proper string form for the service.
#     """
#     def __init__(self, option_name=None, default=None, hidden=False):
#         """
#         :param options_name: The name of the option (eg. "starttime")
#         :param default: The default to use if no value is set
#         :param hidden: Indicate that this option shouldn't be included in the actual query
#         """
#         self.option_name = option_name
#         self.default = default
#         self.hidden = hidden
# 
#     def to_option(self, value):
#         """
#         Turn the value into a "native" option type
#         """
#         return value
# 
#     def to_string(self, value):
#         return str(value)


from pyweed.options import Options, DateOption, FloatOption, Option
from pyweed.pyweed_utils import get_preferred_origin
from logging import getLogger
# -*- coding: utf-8 -*-
"""
Station Options

:copyright:
    Mazama Science, IRIS
:license:
    GNU Lesser General Public License, Version 3
    (http://www.gnu.org/copyleft/lesser.html)
"""


LOGGER = getLogger(__name__)


class StationOptions(Options):

    TIME_RANGE = 'timeBetween'
    TIME_EVENTS = 'timeFromEvents'
    time_choice = Option(hidden=True, default=TIME_RANGE)

    starttime = DateOption(default=-30)
    endtime = DateOption(default=0)


# Path: pyweed/options.py
# class Options(object, metaclass=OptionsMeta):
#     """
#     Base class for a web service request.
#     """
# 
#     def set_options(self, options):
#         """
#         Set all the options in the given dictionary
#         """
#         LOGGER.debug("Set options: %s", options)
#         for k, v in options.items():
#             if k in self._options:
#                 setattr(self, k, v)
# 
#     def get_options(self, keys=None, hidden=True, stringify=False):
#         """
#         Return the options as a dictionary, with a few options
#         @param keys: only include the options named
#         @param hidden: if True, include options where Option.hidden is set
#         @param stringify: convert the option value to a string
#         """
#         options = {}
#         if not keys:
#             keys = self.keys(hidden=hidden)
#         for attr in keys:
#             option = self._options.get(attr)
#             if option:
#                 value = getattr(self, attr, None)
#                 if value is not None:
#                     if stringify:
#                         options[attr] = option.to_string(value)
#                     else:
#                         options[attr] = value
#         LOGGER.debug("get_options: %s", options)
#         return options
# 
#     def keys(self, hidden=True):
#         """
#         Return a list of keys
# 
#         @param hidden: if True, include options where Option.hidden is set
#         """
#         return [key for key, option in self._options.items() if hidden or not option.hidden]
# 
#     def __setattr__(self, k, v):
#         if k in self._options:
#             v = self._options[k].to_option(v)
#         self.__dict__[k] = v
# 
#     def __repr__(self):
#         return repr(self.get_options())
# 
# class DateOption(Option):
#     """
#     A date parameter.
#     """
#     def to_option(self, value):
#         # Value can be a number indicating number of days relative to today
#         if isinstance(value, Number):
#             return UTCDateTime() + timedelta(days=value)
#         else:
#             return UTCDateTime(value)
# 
#     def to_string(self, value):
#         if hasattr(value, 'isoformat'):
#             return value.isoformat()
#         elif isinstance(value, str):
#             return value
#         else:
#             raise ValueError("%s is not a date" % (value,))
# 
# class FloatOption(Option):
#     """
#     A floating point value
#     """
#     def to_option(self, value):
#         return float(value)
# 
# class Option(object):
#     """
#     Defines a web service query parameter.  This allows the service API to take parameter
#     values as Python objects, and convert them to the proper string form for the service.
#     """
#     def __init__(self, option_name=None, default=None, hidden=False):
#         """
#         :param options_name: The name of the option (eg. "starttime")
#         :param default: The default to use if no value is set
#         :param hidden: Indicate that this option shouldn't be included in the actual query
#         """
#         self.option_name = option_name
#         self.default = default
#         self.hidden = hidden
# 
#     def to_option(self, value):
#         """
#         Turn the value into a "native" option type
#         """
#         return value
# 
#     def to_string(self, value):
#         return str(value)


# Path: pyweed/station_options.py
from pyweed.options import Options, DateOption, FloatOption, Option
from pyweed.pyweed_utils import get_preferred_origin
from logging import getLogger

# -*- coding: utf-8 -*-
"""
Station Options

:copyright:
    Mazama Science, IRIS
:license:
    GNU Lesser General Public License, Version 3
    (http://www.gnu.org/copyleft/lesser.html)
"""


LOGGER = getLogger(__name__)


class StationOptions(Options):

    TIME_RANGE = 'timeBetween'
    TIME_EVENTS = 'timeFromEvents'
    time_choice = Option(hidden=True, default=TIME_RANGE)

    starttime = DateOption(default=-30)
    endtime = DateOption(default=0)


    network = Option(default="_GSN")