# Path: ish_parser/Distance.py
# class Distance(Observation):
#   ''' observation of a temperature, which we can convert
#   between farenheight and celsius, yay '''
#   MILLIMETERS = 1
#   METERS = 2
#   INCHES = 3
#   MISSING = [999, 99999, 999999]
#   # Inches per cm
#   INCH_CONVERSION_FACTOR = 1/2.54
# 
#   def get_inches(self):
#     ''' convert the measurement to inches '''
#     if self._obs_value in self.MISSING:
#       return 'MISSING'
#     if self._obs_units == self.MILLIMETERS:
#       return round(self._obs_value / 10 * self.INCH_CONVERSION_FACTOR, 4)
#     if self._obs_units == self.METERS:
#       return round(self._obs_value * 100 * self.INCH_CONVERSION_FACTOR, 4)
# 
#   def get_miles(self):
#     ''' convert the measurement to inches '''
#     if self._obs_value in self.MISSING:
#       return 'MISSING'
#     if self._obs_units == self.MILLIMETERS:
#       return round(self._obs_value / 10 * self.INCH_CONVERSION_FACTOR / 12 / 5280, 4)
#     if self._obs_units == self.METERS:
#       return round(self._obs_value * 100 * self.INCH_CONVERSION_FACTOR / 12 / 5280, 4)
# 
#   def __str__(self):
#     if self._obs_value in self.MISSING:
#       return 'MISSING'
#     else:
#       return str(self._obs_value)
# 
# Path: ish_parser/CloudCoverage.py
# class CloudCoverage(Observation):
#   '''okta is a unit of measurement used to 
#   describe the amount of cloud cover at any given location such 
#   as a weather station. Sky conditions are estimated in 
#   terms of how many eighths of the sky are covered in cloud, 
#   ranging from 0 oktas (completely clear sky) through to 
#   8 oktas (completely overcast).
#   '''
#   OKTA = 1
#   MISSING = ['99', 99]
# 
#   def __str__(self):
#     if self._obs_value in self.MISSING:
#       return 'MISSING'
#     else:
#       return str(self._obs_value)
# 
#   def __repr__(self):
#     return self.__str__()
# 
#   def __eq__(self, value2):
#     if self._obs_value == value2:
#       return True
#     else:
#       return False
# 
# Path: ish_parser/Constant.py
# class Constant(Observation):
#   ''' constant is for constant variables that have types
#   or indices associated with them like types of clouds, etc'''
#   MISSING = ["99"]
# 
#   def __str__(self):
#     if self._obs_value in self._obs_index.keys():
#       return self._obs_index.get(self._obs_value)
#     elif self._obs_value in self.MISSING:
#       return 'MISSING'
#     else:
#       return str(self._obs_value)
# 
#   def __repr__(self):
#     return repr(self.__str__())
# 
#   def __eq__(self, value2):
#     return("P")
#     if self._obs_value in self._obs_index.keys():
#       if self._obs_index.get(self._obs_value) == value2:
#         return True
# 
#     if str(self) == str(value2):
#       return True
#     else:
#       return False
# 
# Path: ish_parser/Components/BaseComponent.py
# class BaseComponent(object):
#   ''' base component handler '''


from ..Distance import Distance
from ..CloudCoverage import CloudCoverage
from ..Constant import Constant
from .BaseComponent import BaseComponent
    "08": "Eight oktas - 10/10, or OVC",
    "09": "Sky obscured, or cloud amount cannot be estimated",
    "10": "Partial Obscuration",
    "11": "Thin Scattered",
    "12": "Scattered",
    "13": "Dark Scattered",
    "14": "Thin Broken",
    "15": "Broken",
    "16": "Dark Broken",
    "17": "Thin Overcast",
    "18": "Overcast",
    "19": "Dark overcast",
    "99": "Missing"}
  CHARACTERISTIC = {
    "1": "Variable height",
    "2": "Variable amount",
    "3": "Thin clouds",
    "4": "Dark layer (reported in data prior to 1950)",
    "9": "Missing"}

  def loads(self, string):

    self.sky_cover_summation  = {
      'coverage': Constant(string[0:1], None,
        string[3:4], self.CLOUD_TYPES),
      'coverage_simple': Constant(string[0:1], None,
        string[3:4], self.CLOUD_TYPES_SIMPLE),
      'secondary_coverage': Constant(string[1:3], None,
        string[3:4], self.SECONDARY_TYPES),
      'height': Distance(int(string[4:10]),

# Path: ish_parser/Distance.py
# class Distance(Observation):
#   ''' observation of a temperature, which we can convert
#   between farenheight and celsius, yay '''
#   MILLIMETERS = 1
#   METERS = 2
#   INCHES = 3
#   MISSING = [999, 99999, 999999]
#   # Inches per cm
#   INCH_CONVERSION_FACTOR = 1/2.54
# 
#   def get_inches(self):
#     ''' convert the measurement to inches '''
#     if self._obs_value in self.MISSING:
#       return 'MISSING'
#     if self._obs_units == self.MILLIMETERS:
#       return round(self._obs_value / 10 * self.INCH_CONVERSION_FACTOR, 4)
#     if self._obs_units == self.METERS:
#       return round(self._obs_value * 100 * self.INCH_CONVERSION_FACTOR, 4)
# 
#   def get_miles(self):
#     ''' convert the measurement to inches '''
#     if self._obs_value in self.MISSING:
#       return 'MISSING'
#     if self._obs_units == self.MILLIMETERS:
#       return round(self._obs_value / 10 * self.INCH_CONVERSION_FACTOR / 12 / 5280, 4)
#     if self._obs_units == self.METERS:
#       return round(self._obs_value * 100 * self.INCH_CONVERSION_FACTOR / 12 / 5280, 4)
# 
#   def __str__(self):
#     if self._obs_value in self.MISSING:
#       return 'MISSING'
#     else:
#       return str(self._obs_value)
# 
# Path: ish_parser/CloudCoverage.py
# class CloudCoverage(Observation):
#   '''okta is a unit of measurement used to 
#   describe the amount of cloud cover at any given location such 
#   as a weather station. Sky conditions are estimated in 
#   terms of how many eighths of the sky are covered in cloud, 
#   ranging from 0 oktas (completely clear sky) through to 
#   8 oktas (completely overcast).
#   '''
#   OKTA = 1
#   MISSING = ['99', 99]
# 
#   def __str__(self):
#     if self._obs_value in self.MISSING:
#       return 'MISSING'
#     else:
#       return str(self._obs_value)
# 
#   def __repr__(self):
#     return self.__str__()
# 
#   def __eq__(self, value2):
#     if self._obs_value == value2:
#       return True
#     else:
#       return False
# 
# Path: ish_parser/Constant.py
# class Constant(Observation):
#   ''' constant is for constant variables that have types
#   or indices associated with them like types of clouds, etc'''
#   MISSING = ["99"]
# 
#   def __str__(self):
#     if self._obs_value in self._obs_index.keys():
#       return self._obs_index.get(self._obs_value)
#     elif self._obs_value in self.MISSING:
#       return 'MISSING'
#     else:
#       return str(self._obs_value)
# 
#   def __repr__(self):
#     return repr(self.__str__())
# 
#   def __eq__(self, value2):
#     return("P")
#     if self._obs_value in self._obs_index.keys():
#       if self._obs_index.get(self._obs_value) == value2:
#         return True
# 
#     if str(self) == str(value2):
#       return True
#     else:
#       return False
# 
# Path: ish_parser/Components/BaseComponent.py
# class BaseComponent(object):
#   ''' base component handler '''


# Path: ish_parser/Components/SkyCoverSummationComponent.py
from ..Distance import Distance
from ..CloudCoverage import CloudCoverage
from ..Constant import Constant
from .BaseComponent import BaseComponent

    "08": "Eight oktas - 10/10, or OVC",
    "09": "Sky obscured, or cloud amount cannot be estimated",
    "10": "Partial Obscuration",
    "11": "Thin Scattered",
    "12": "Scattered",
    "13": "Dark Scattered",
    "14": "Thin Broken",
    "15": "Broken",
    "16": "Dark Broken",
    "17": "Thin Overcast",
    "18": "Overcast",
    "19": "Dark overcast",
    "99": "Missing"}
  CHARACTERISTIC = {
    "1": "Variable height",
    "2": "Variable amount",
    "3": "Thin clouds",
    "4": "Dark layer (reported in data prior to 1950)",
    "9": "Missing"}

  def loads(self, string):

    self.sky_cover_summation  = {
      'coverage': Constant(string[0:1], None,
        string[3:4], self.CLOUD_TYPES),
      'coverage_simple': Constant(string[0:1], None,
        string[3:4], self.CLOUD_TYPES_SIMPLE),
      'secondary_coverage': Constant(string[1:3], None,
        string[3:4], self.SECONDARY_TYPES),
      'height': Distance(int(string[4:10]),

        Distance.METERS, string[10:11]),