Ejemplo n.º 1
0
    def test_query_for_sentinel_scenes_singler_eplacement_bug_2(self):
        aws = AWSSentinel2AInterface(global_config)
        result = aws.get_sentinel_urls([
            "S2A_OPER_PRD_MSIL1C_PDMC_20161031T014722_R087_V20161030T235752_20161030T235752",
        ], ["B12", "B08"])
        pprint(result)

        self.assertTrue(
            "S2A_OPER_PRD_MSIL1C_PDMC_20161031T014722_R087_V20161030T235752_20161030T235752"
            in result[0]["product_id"])
        self.validate_result(result, ["B12", "B08"])
Ejemplo n.º 2
0
    def test_query_for_sentinel_scenes_single_new(self):
        aws = AWSSentinel2AInterface(global_config)
        result = aws.get_sentinel_urls([
            "S2A_MSIL1C_20170212T104141_N0204_R008_T31TGJ_20170212T104138",
        ], ["B12", "B08"])
        pprint(result)

        self.assertTrue(
            "S2A_MSIL1C_20170212T104141_N0204_R008_T31TGJ_20170212T104138" in
            result[0]["product_id"])
        self.validate_result(result, ["B12", "B08"])
Ejemplo n.º 3
0
    def test_query_for_sentinel_scenes_single_old(self):
        aws = AWSSentinel2AInterface(global_config)
        result = aws.get_sentinel_urls([
            "S2A_OPER_PRD_MSIL1C_PDMC_20151207T031157_R102_V20151207T003302_20151207T003302",
        ], ["B12", "B08"])
        pprint(result)

        self.assertTrue(
            "S2A_OPER_PRD_MSIL1C_PDMC_20151207T031157_R102_V20151207T003302_20151207T003302"
            in result[0]["product_id"])
        self.validate_result(result, ["B12", "B08"])
Ejemplo n.º 4
0
    def test_query_for_sentinel_scenes_singler_eplacement_bug(self):
        aws = AWSSentinel2AInterface(global_config)
        result = aws.get_sentinel_urls([
            "S2A_MSIL1C_20171210T020751_N0206_R017_T50HPG_20171210T052001",
        ], ["B12", "B08"])
        pprint(result)

        self.assertTrue(
            "S2A_MSIL1C_20171210T020751_N0206_R017_T50HPG_20171210T052001" in
            result[0]["product_id"])
        self.validate_result(result, ["B12", "B08"])
Ejemplo n.º 5
0
    def test_query_for_sentinel_scenes_band_error(self):
        aws = AWSSentinel2AInterface(global_config)

        try:
            result = aws.get_sentinel_urls([
                "S2A_MSIL1C_20170212T104141_N0204_R008_T31TGJ_20170212T104138_NOPE",
            ], ["B120", "B080"])
            # pprint(result)
            self.assertTrue(False, "The error was not found")
        except Exception as e:
            self.assertTrue(
                True,
                "An exception was raised for the correct reason: %s" % str(e))
Ejemplo n.º 6
0
    def test_query_for_sentinel_scenes_single_old_geojson(self):
        aws = AWSSentinel2AInterface(global_config)
        result = aws.get_sentinel_urls([
            "S2A_OPER_PRD_MSIL1C_PDMC_20151207T031157_R102_V20151207T003302_20151207T003302",
        ], ["B12", "B08"])
        pprint(result)

        self.assertTrue(
            "S2A_OPER_PRD_MSIL1C_PDMC_20151207T031157_R102_V20151207T003302_20151207T003302"
            in result[0]["product_id"])

        for tile in result[0]["tiles"]:
            geojson = aws.get_sentinel_tile_footprint(tile)
            print(geojson)
Ejemplo n.º 7
0
    def test_query_for_sentinel_scenes_multi_error(self):
        aws = AWSSentinel2AInterface(global_config)

        try:
            result = aws.get_sentinel_urls([
                "S2A_MSIL1C_20170202T090201_N0204_R007_T36TVT_20170202T090155",
                "S2A_OPER_PRD_MSIL1C_PDMC_20151207T031157_R102_V20151207T003302_20151207T003302",
                "S2A_MSIL1C_20170218T143751_N0204_R096_T20PRT_20170218T143931_NOPE"
            ], ["B04", "B08"])
            pprint(result)
            self.assertTrue(False, "The error was not found")
        except Exception as e:
            self.assertTrue(
                True,
                "An exception was raised for the correct reason: %s" % str(e))
Ejemplo n.º 8
0
    def post(self):
        """Generate the download urls for a list of sentinel2A scenes and band numbers."""

        try:
            iface = AWSSentinel2AInterface(global_config)

            rdc = self.preprocess(has_json=True, has_xml=False)

            result = iface.get_sentinel_urls(
                product_ids=rdc.request_data["product_ids"],
                bands=rdc.request_data["bands"])

            return make_response(jsonify(result), 200)
        except Exception as e:
            result = {"status": "error", "message": str(e)}
            return make_response(jsonify(result), 400)
Ejemplo n.º 9
0
    def test_query_for_sentinel_scenes_mutli_mixed(self):
        aws = AWSSentinel2AInterface(global_config)
        result = aws.get_sentinel_urls([
            "S2A_MSIL1C_20170202T090201_N0204_R007_T36TVT_20170202T090155",
            "S2A_OPER_PRD_MSIL1C_PDMC_20151207T031157_R102_V20151207T003302_20151207T003302",
            "S2A_MSIL1C_20170218T143751_N0204_R096_T20PRT_20170218T143931"
        ], ["B04", "B08"])
        pprint(result)

        self.assertTrue(
            "S2A_MSIL1C_20170202T090201_N0204_R007_T36TVT_20170202T090155" in
            result[0]["product_id"])
        self.assertTrue(
            "S2A_OPER_PRD_MSIL1C_PDMC_20151207T031157_R102_V20151207T003302_20151207T003302"
            in result[1]["product_id"])
        self.assertTrue(
            "S2A_MSIL1C_20170218T143751_N0204_R096_T20PRT_20170218T143931" in
            result[2]["product_id"])
        self.validate_result(result, ["B04", "B08"])