# Path: paegan/cdm/dsg/collections/base/profile_collection.py
# class ProfileCollection(NestedPointCollection):
#     """
#         A collection of Profiles
#     """
# 
#     def __init__(self, **kwargs):
#         super(ProfileCollection,self).__init__(**kwargs)
# 
# Path: paegan/utils/asalist.py
# class AsaList(object):
# 
#     @classmethod
#     def flatten(cls, lst):
#         """
#             Returns Generator of non-iterable values
#         """
#         for x in lst:
#             if not isinstance(x, collections.Iterable):
#                 yield x
#             else:
#                 for x in AsaList.flatten(x):
#                     yield x


from shapely.geometry import MultiPoint
from paegan.cdm.dsg.collections.base.profile_collection import ProfileCollection
from paegan.utils.asalist import AsaList
        keys = ["name", "description", "standard", "units"]
        mwhat = []
        for mg in all_members:
            for m in mg:
                mwhat.append( { key: m[key] for key in keys if key in m } )

        # Now unique them on name
        mwhat = { x['name']:x for x in mwhat }.values()

        return mwhat

    def calculate_bounds(self):
        """
            Calculate the time_range, depth_range, bbox, and size of this collection.
            Will scan all data.
            Ensures that .size, .bbox and .time_range return non-null.

            If the collection already knows its bbox; time_range; and/or size,
            they are recomputed.
        """
        # tell all contained profiles to calculate their bounds
        map(lambda x: x.calculate_bounds(), self._elements)

        # @TODO size is just number of timesteps?
        self.size = len(self._elements)

        # bbox is just this point
        self.bbox = MultiPoint([self.location, self.location]).envelope

        time_set = set()

# Path: paegan/cdm/dsg/collections/base/profile_collection.py
# class ProfileCollection(NestedPointCollection):
#     """
#         A collection of Profiles
#     """
# 
#     def __init__(self, **kwargs):
#         super(ProfileCollection,self).__init__(**kwargs)
# 
# Path: paegan/utils/asalist.py
# class AsaList(object):
# 
#     @classmethod
#     def flatten(cls, lst):
#         """
#             Returns Generator of non-iterable values
#         """
#         for x in lst:
#             if not isinstance(x, collections.Iterable):
#                 yield x
#             else:
#                 for x in AsaList.flatten(x):
#                     yield x


# Path: paegan/cdm/dsg/features/station_profile.py
from shapely.geometry import MultiPoint
from paegan.cdm.dsg.collections.base.profile_collection import ProfileCollection
from paegan.utils.asalist import AsaList

        keys = ["name", "description", "standard", "units"]
        mwhat = []
        for mg in all_members:
            for m in mg:
                mwhat.append( { key: m[key] for key in keys if key in m } )

        # Now unique them on name
        mwhat = { x['name']:x for x in mwhat }.values()

        return mwhat

    def calculate_bounds(self):
        """
            Calculate the time_range, depth_range, bbox, and size of this collection.
            Will scan all data.
            Ensures that .size, .bbox and .time_range return non-null.

            If the collection already knows its bbox; time_range; and/or size,
            they are recomputed.
        """
        # tell all contained profiles to calculate their bounds
        map(lambda x: x.calculate_bounds(), self._elements)

        # @TODO size is just number of timesteps?
        self.size = len(self._elements)

        # bbox is just this point
        self.bbox = MultiPoint([self.location, self.location]).envelope

        time_set = set()

        map(time_set.add, AsaList.flatten([p.time for p in self._elements]))