def test_composite_off_by_one(): """The images in test_outputs/off_by_one were producing off-by-one errors""" os.chdir(os.path.dirname(os.path.abspath(__file__))) try: shutil.rmtree("test_outputs/off_by_one_error") except FileNotFoundError: pass os.mkdir("test_outputs/off_by_one_error") pyeo.composite_directory("test_data/off_by_one", "test_outputs/off_by_one_error")
log.info("Downloading for initial composite between {} and {}".format( composite_start_date, composite_end_date)) composite_products = pyeo.check_for_s2_data_by_date( aoi_path, composite_start_date, composite_end_date, conf) pyeo.download_new_s2_data(composite_products, composite_l1_image_dir) log.info("Preprocessing composite products") pyeo.atmospheric_correction(composite_l1_image_dir, composite_l2_image_dir, sen2cor_path, delete_unprocessed_image=True) log.info("Aggregating composite layers") pyeo.aggregate_and_mask_10m_bands(composite_l2_image_dir, composite_merged_dir, cloud_certainty_threshold) log.info("Building initial cloud-free composite") pyeo.composite_directory(composite_merged_dir, composite_dir) # Query and download all images since last composite if args.do_download or do_all: products = pyeo.check_for_s2_data_by_date(aoi_path, start_date, end_date, conf) log.info("Downloading") pyeo.download_new_s2_data(products, l1_image_dir) # Atmospheric correction if args.do_preprocess or do_all: log.info("Applying sen2cor") pyeo.atmospheric_correction(l1_image_dir, l2_image_dir, sen2cor_path, delete_unprocessed_image=True)
log.info("Preprocessing composite products") pyeo.atmospheric_correction(composite_l1_image_dir, composite_l2_image_dir, sen2cor_path, delete_unprocessed_image=False) if args.do_merge or do_all: log.info("Aggregating composite layers") pyeo.preprocess_sen2_images(composite_l2_image_dir, composite_merged_dir, composite_l1_image_dir, cloud_certainty_threshold, epsg=epsg, buffer_size=5) log.info("Building initial cloud-free composite") pyeo.composite_directory(composite_merged_dir, composite_dir, generate_date_images=True) # Query and download all images since last composite if args.do_download or do_all: products = pyeo.check_for_s2_data_by_date(aoi_path, start_date, end_date, conf, cloud_cover=cloud_cover) log.info("Downloading") pyeo.download_s2_data(products, l1_image_dir, l2_image_dir, args.download_source, user=sen_user,