Exemplo n.º 1
0
 def perform_removal(self, eo_object):
     self.begin_time, self.end_time, self.footprint = collect_eo_metadata(
         self.eo_objects.all(), exclude=[eo_object], bbox=True
     )
     self.full_clean()
     self.save()
     return
Exemplo n.º 2
0
 def perform_removal(self, eo_object):
     self.begin_time, self.end_time, self.footprint = collect_eo_metadata(
         self.eo_objects.all(), exclude=[eo_object])
     # TODO: recalculate size and extent!
     self.full_clean()
     self.save()
     return
Exemplo n.º 3
0
 def perform_insertion(self, eo_object, through=None):
     self.begin_time, self.end_time, self.footprint = collect_eo_metadata(
         self.eo_objects.all(), insert=[eo_object], bbox=True
     )
     self.full_clean()
     self.save()
     return
Exemplo n.º 4
0
    def perform_insertion(self, eo_object, through=None):
        if eo_object.real_type != RectifiedDataset:
            raise ValidationError("In a %s only %s can be inserted." % (
                RectifiedStitchedMosaic._meta.verbose_name,
                RectifiedDataset._meta.verbose_name_plural
            ))

        rectified_dataset = eo_object.cast()
        if self.range_type != rectified_dataset.range_type:
            raise ValidationError(
                "Dataset '%s' has a different Range Type as the Rectified "
                "Stitched Mosaic '%s'." % (rectified_dataset, self.identifier)
            )

        if not is_same_grid((self, rectified_dataset)):
            raise ValidationError(
                "Dataset '%s' has not the same base grid as the Rectified "
                "Stitched Mosaic '%s'." % (rectified_dataset, self.identifier)
            )

        self.begin_time, self.end_time, self.footprint = collect_eo_metadata(
            self.eo_objects.all(), insert=[eo_object]
        )
        # TODO: recalculate size and extent!
        self.full_clean()
        self.save()
        return
Exemplo n.º 5
0
 def perform_removal(self, eo_object):
     self.begin_time, self.end_time, self.footprint = collect_eo_metadata(
         self.eo_objects.all(), exclude=[eo_object]
     )
     # TODO: recalculate size and extent!
     self.full_clean()
     self.save()
     return
Exemplo n.º 6
0
    def perform_insertion(self, eo_object, through=None):
        if eo_object.real_type != RectifiedDataset:
            raise ValidationError("In a %s only %s can be inserted." %
                                  (RectifiedStitchedMosaic._meta.verbose_name,
                                   RectifiedDataset._meta.verbose_name_plural))

        rectified_dataset = eo_object.cast()
        if self.range_type != rectified_dataset.range_type:
            raise ValidationError(
                "Dataset '%s' has a different Range Type as the Rectified "
                "Stitched Mosaic '%s'." % (rectified_dataset, self.identifier))

        if not is_same_grid((self, rectified_dataset)):
            raise ValidationError(
                "Dataset '%s' has not the same base grid as the Rectified "
                "Stitched Mosaic '%s'." % (rectified_dataset, self.identifier))

        self.begin_time, self.end_time, self.footprint = collect_eo_metadata(
            self.eo_objects.all(), insert=[eo_object])
        # TODO: recalculate size and extent!
        self.full_clean()
        self.save()
        return
Exemplo n.º 7
0
 def perform_removal(self, eo_object):
     self.begin_time, self.end_time, self.footprint = collect_eo_metadata(
         self.eo_objects.all(), exclude=[eo_object], bbox=True)
     self.full_clean()
     self.save()
     return
Exemplo n.º 8
0
 def perform_insertion(self, eo_object, through=None):
     self.begin_time, self.end_time, self.footprint = collect_eo_metadata(
         self.eo_objects.all(), insert=[eo_object], bbox=True)
     self.full_clean()
     self.save()
     return
Exemplo n.º 9
0
 def update_eo_metadata(self):
     logger.debug("Updating EO Metadata for %s." % self)
     self.begin_time, self.end_time, self.footprint = collect_eo_metadata(
         self.eo_objects.all())
     self.full_clean()
     self.save()
Exemplo n.º 10
0
    def test_insertion(self):
        rectified_1, rectified_2, rectified_3 = (self.rectified_1,
                                                 self.rectified_2,
                                                 self.rectified_3)
        mosaic, series_1, series_2 = self.mosaic, self.series_1, self.series_2

        mosaic_insert_coverage(mosaic, rectified_1)
        mosaic_insert_coverage(mosaic, rectified_2)
        mosaic_insert_coverage(mosaic, rectified_3)
        mosaic_list = mosaic.coverages.all()

        self.assertIn(rectified_1, mosaic_list)
        self.assertIn(rectified_2, mosaic_list)
        self.assertIn(rectified_3, mosaic_list)

        collection_insert_eo_object(series_1, rectified_1)
        collection_insert_eo_object(series_1, rectified_2)
        collection_insert_eo_object(series_1, rectified_3)

        series_1_list = series_1.coverages.all()

        self.assertIn(rectified_1, series_1_list)
        self.assertIn(rectified_2, series_1_list)
        self.assertIn(rectified_3, series_1_list)

        collection_insert_eo_object(series_2, rectified_1)
        collection_insert_eo_object(series_2, rectified_2)
        collection_insert_eo_object(series_2, rectified_3)

        series_2_list = series_2.coverages.all()

        self.assertIn(rectified_1, series_2_list)
        self.assertIn(rectified_2, series_2_list)
        self.assertIn(rectified_3, series_2_list)

        self.assertEqual(len(mosaic_list), 3)
        self.assertEqual(len(series_1_list), 3)
        self.assertEqual(len(series_2_list), 3)

        mosaic = Mosaic.objects.get(identifier="mosaic-1")
        mosaic, series_1, series_2 = refresh(mosaic, series_1, series_2)

        # TODO: further check metadata
        self.assertTrue(series_1.begin_time is not None)

        begin_time, end_time, all_rectified_footprints = collect_eo_metadata(
            Coverage.objects.all())
        time_extent = begin_time, end_time

        extent_footprint = MultiPolygon(
            Polygon.from_bbox(all_rectified_footprints.extent))

        self.assertGeometryEqual(series_1.footprint, all_rectified_footprints)
        self.assertGeometryEqual(series_2.footprint, all_rectified_footprints)
        self.assertGeometryEqual(mosaic.footprint, all_rectified_footprints)

        series_1_time_extent = series_1.begin_time, series_1.end_time
        series_2_time_extent = series_2.begin_time, series_2.end_time
        mosaic_time_extent = mosaic.begin_time, mosaic.end_time

        self.assertEqual(series_1_time_extent, time_extent)
        self.assertEqual(series_2_time_extent, time_extent)
        self.assertEqual(mosaic_time_extent, time_extent)

        for eo_obj in series_1_list:
            pass
Exemplo n.º 11
0
 def update_eo_metadata(self):
     logger.debug("Updating EO Metadata for %s." % self)
     self.begin_time, self.end_time, self.footprint = collect_eo_metadata(self.eo_objects.all())
     self.full_clean()
     self.save()