def test_dateline_overlap_should_equal_the_two_adjecent_bboxes(self):
        dateline_bbox = [160, 43.717, -160, 43.746]
        dateline_east_side_bbox = [160, 43.717, 180, 43.746]
        dateline_west_side_bbox = [-180, 43.717, -160, 43.746]

        self.assertEqual(
            estimate_size_of_extent(self.csv_file_name, *dateline_bbox),
            estimate_size_of_extent(self.csv_file_name, *dateline_east_side_bbox) +
            estimate_size_of_extent(self.csv_file_name, *dateline_west_side_bbox)
        )
Esempio n. 2
0
def add_meta_data_to_job(*, conversion_job, rq_job):
    from pbf_file_size_estimation.app_settings import PBF_FILE_SIZE_ESTIMATION_CSV_FILE_PATH
    from pbf_file_size_estimation.estimate_size import estimate_size_of_extent
    west, south, east, north = conversion_job.parametrization.clipping_area.clipping_multi_polygon.extent

    estimated_pbf_size = None
    try:
        estimated_pbf_size = estimate_size_of_extent(
            PBF_FILE_SIZE_ESTIMATION_CSV_FILE_PATH, west, south, east, north)
    except estimate_size.OutOfBoundsError:
        logger.exception("pbf estimation failed")

    conversion_job.unzipped_result_size = rq_job.meta['unzipped_result_size']
    conversion_job.extraction_duration = rq_job.meta['duration']
    conversion_job.estimated_pbf_size = estimated_pbf_size
 def test_monaco_size_estimation(self):
     monaco_bbox = [7.400, 43.717, 7.439, 43.746]
     self.assertEqual(estimate_size_of_extent(self.csv_file_name, *monaco_bbox), 36799)
 def test_dateline_overlap_should_work(self):
     dateline_bbox = [160, 43.717, -160, 43.746]
     self.assertEqual(estimate_size_of_extent(self.csv_file_name, *dateline_bbox), 236)