# Path: paegan/cdm/dsg/member.py
# class Member(dict):
#     def __init__(self, *args, **kwargs):
#         super(Member, self).__init__(*args, **kwargs)
# 
# Path: paegan/cdm/dsg/features/base/profile.py
# class Profile(PointCollection):
#     """
#         A collection of points along a vertical (z) access
#         ie. A single profile from an ADCP or CTD
# 
#         A profile has a nominal lat/lon and time.
#         Actual time may be constant, or vary with z.
#         The z coordinates are monotonic, and may be increasing or decreasing.
#     """
#     def __init__(self, **kwargs):
#         super(Profile,self).__init__(**kwargs)
#         self._type = "Profile"
# 
#     def get_location(self):
#         return self._location
#     def set_location(self, location):
#         self._location = location
#     location = property(get_location, set_location)
# 
#     def get_time(self):
#         """
#             Nominal time of the profile.  This is usually the first time a reading was taken,
#             since a profile's time can be constant or vary with z.
#         """
#         return self._time
#     def set_time(self, time):
#         self._time = time
#     time = property(get_time, set_time)


import unittest
from datetime import datetime
from shapely.geometry import Point as sPoint
from paegan.cdm.dsg.member import Member
from paegan.cdm.dsg.features.base.point import Point
from paegan.cdm.dsg.features.base.profile import Profile

class ProfileTest(unittest.TestCase):
    def test_profile(self):
        dt1 = datetime(2012, 1, 1, 12, 0)
        p1 = Point()
        p1.time = dt1
        p1.location = sPoint(-120, 50, 0)
        member1 = Member(value=34.7, unit='°C', name='Water Temperatire', description='water temperature', standard='sea_water_temperature')
        member2 = Member(value=80, unit='PSU', name='Salinity', description='salinity', standard='salinity')
        p1.add_member(member1)
        p1.add_member(member2)

        dt2 = datetime(2012, 1, 1, 12, 10)
        p2 = Point()
        p2.time = dt2
        p2.location = sPoint(-120, 50, 10)
        member3 = Member(value=34.1, unit='°C', name='Water Temperatire', description='water temperature', standard='sea_water_temperature')
        member4 = Member(value=70, unit='PSU', name='Salinity', description='salinity', standard='salinity')
        p2.add_member(member3)
        p2.add_member(member4)

        dt3 = datetime(2012, 1, 1, 12, 20)
        p3 = Point()
        p3.time = dt3
        p3.location = sPoint(-120, 50, 20)
        member5 = Member(value=32.6, unit='°C', name='Water Temperatire', description='water temperature', standard='sea_water_temperature')
        member6 = Member(value=60, unit='PSU', name='Salinity', description='salinity', standard='salinity')
        p3.add_member(member5)
        p3.add_member(member6)


# Path: paegan/cdm/dsg/member.py
# class Member(dict):
#     def __init__(self, *args, **kwargs):
#         super(Member, self).__init__(*args, **kwargs)
# 
# Path: paegan/cdm/dsg/features/base/profile.py
# class Profile(PointCollection):
#     """
#         A collection of points along a vertical (z) access
#         ie. A single profile from an ADCP or CTD
# 
#         A profile has a nominal lat/lon and time.
#         Actual time may be constant, or vary with z.
#         The z coordinates are monotonic, and may be increasing or decreasing.
#     """
#     def __init__(self, **kwargs):
#         super(Profile,self).__init__(**kwargs)
#         self._type = "Profile"
# 
#     def get_location(self):
#         return self._location
#     def set_location(self, location):
#         self._location = location
#     location = property(get_location, set_location)
# 
#     def get_time(self):
#         """
#             Nominal time of the profile.  This is usually the first time a reading was taken,
#             since a profile's time can be constant or vary with z.
#         """
#         return self._time
#     def set_time(self, time):
#         self._time = time
#     time = property(get_time, set_time)


# Path: tests/cdm/dsg/features/base/test_profile.py
import unittest
from datetime import datetime
from shapely.geometry import Point as sPoint
from paegan.cdm.dsg.member import Member
from paegan.cdm.dsg.features.base.point import Point
from paegan.cdm.dsg.features.base.profile import Profile


class ProfileTest(unittest.TestCase):
    def test_profile(self):
        dt1 = datetime(2012, 1, 1, 12, 0)
        p1 = Point()
        p1.time = dt1
        p1.location = sPoint(-120, 50, 0)
        member1 = Member(value=34.7, unit='°C', name='Water Temperatire', description='water temperature', standard='sea_water_temperature')
        member2 = Member(value=80, unit='PSU', name='Salinity', description='salinity', standard='salinity')
        p1.add_member(member1)
        p1.add_member(member2)

        dt2 = datetime(2012, 1, 1, 12, 10)
        p2 = Point()
        p2.time = dt2
        p2.location = sPoint(-120, 50, 10)
        member3 = Member(value=34.1, unit='°C', name='Water Temperatire', description='water temperature', standard='sea_water_temperature')
        member4 = Member(value=70, unit='PSU', name='Salinity', description='salinity', standard='salinity')
        p2.add_member(member3)
        p2.add_member(member4)

        dt3 = datetime(2012, 1, 1, 12, 20)
        p3 = Point()
        p3.time = dt3
        p3.location = sPoint(-120, 50, 20)
        member5 = Member(value=32.6, unit='°C', name='Water Temperatire', description='water temperature', standard='sea_water_temperature')
        member6 = Member(value=60, unit='PSU', name='Salinity', description='salinity', standard='salinity')
        p3.add_member(member5)
        p3.add_member(member6)


        pc = Profile(elements=[p1,p2,p3])