Пример #1
0
    def get_iterator(self, missing_data_for_missing_sample, coord_map, coords, data_points, shape, points, output_data):
        """
        Iterator to iterate through the points needed to be calculated.
        The default iterator, iterates through all the sample points calling :meth:`.Constraint.constrain_points` for
        each one.

        :param missing_data_for_missing_sample: If true anywhere there is missing data on the sample then final point is
         missing; otherwise just use the sample
        :param coord_map: Coordinate map - list of tuples of indexes of hyperpoint coord, data coords and output coords
        :param coords: The coordinates to map the data onto
        :param data_points: The (non-masked) data points
        :param shape: Shape of the final data values
        :param points: The original points object, these are the points to collocate
        :param output_data: Output data set
        :return: Iterator which iterates through (sample indices, hyper point and constrained points) to be placed in
         these points
        """
        from cis.collocation.col_implementations import HyperPoint
        if missing_data_for_missing_sample:
            iterator = index_iterator_for_non_masked_data(shape, points)
        else:
            iterator = index_iterator_nditer(shape, output_data[0])

        for indices in iterator:
            hp_values = [None] * HyperPoint.number_standard_names
            for (hpi, ci, shi) in coord_map:
                hp_values[hpi] = coords[ci].points[indices[shi]]

            hp = HyperPoint(*hp_values)
            constrained_points = self.constrain_points(hp, data_points)
            yield indices, hp, constrained_points
Пример #2
0
    def get_iterator(self, missing_data_for_missing_sample, coord_map, coords,
                     data_points, shape, points, output_data):
        """
        Iterator to iterate through the points needed to be calculated.
        The default iterator, iterates through all the sample points calling :meth:`.Constraint.constrain_points` for
        each one.

        :param missing_data_for_missing_sample: If true anywhere there is missing data on the sample then final point is
         missing; otherwise just use the sample
        :param coord_map: Coordinate map - list of tuples of indexes of hyperpoint coord, data coords and output coords
        :param coords: The coordinates to map the data onto
        :param data_points: The (non-masked) data points
        :param shape: Shape of the final data values
        :param points: The original points object, these are the points to collocate
        :param output_data: Output data set
        :return: Iterator which iterates through (sample indices, hyper point and constrained points) to be placed in
         these points
        """
        from cis.collocation.col_implementations import HyperPoint
        if missing_data_for_missing_sample:
            iterator = index_iterator_for_non_masked_data(shape, points)
        else:
            iterator = index_iterator_nditer(shape, output_data[0])

        for indices in iterator:
            hp_values = [None] * HyperPoint.number_standard_names
            for (hpi, ci, shi) in coord_map:
                hp_values[hpi] = coords[ci].points[indices[shi]]

            hp = HyperPoint(*hp_values)
            constrained_points = self.constrain_points(hp, data_points)
            yield indices, hp, constrained_points
Пример #3
0
    def get_iterator(self, missing_data_for_missing_sample, coord_map, coords, data_points, shape, points, output_data):
        from cis.collocation.col_implementations import HyperPoint
        if missing_data_for_missing_sample:
            iterator = index_iterator_for_non_masked_data(shape, points)
        else:
            iterator = index_iterator_nditer(shape, output_data[0])

        for indices in iterator:
            hp_values = [None] * HyperPoint.number_standard_names
            for (hpi, ci, shi) in coord_map:
                hp_values[hpi] = coords[ci].points[indices[shi]]

            hp = HyperPoint(*hp_values)
            constrained_points = self.constrain_points(indices, data_points)
            yield indices, hp, constrained_points
Пример #4
0
    def get_iterator(self, missing_data_for_missing_sample, coord_map, coords,
                     data_points, shape, points, output_data):
        from cis.collocation.col_implementations import HyperPoint
        if missing_data_for_missing_sample:
            iterator = index_iterator_for_non_masked_data(shape, points)
        else:
            iterator = index_iterator_nditer(shape, output_data[0])

        for indices in iterator:
            hp_values = [None] * HyperPoint.number_standard_names
            for (hpi, ci, shi) in coord_map:
                hp_values[hpi] = coords[ci].points[indices[shi]]

            hp = HyperPoint(*hp_values)
            constrained_points = self.constrain_points(indices, data_points)
            yield indices, hp, constrained_points