1
- """VIIRS Vessel Detection Service."""
1
+ """Landsat Vessel Detection Service."""
2
2
3
3
from __future__ import annotations
4
4
@@ -47,24 +47,10 @@ class LandsatRequest(BaseModel):
47
47
scratch_path : str
48
48
json_path : str
49
49
50
- # class Config:
51
- # """example configuration for a request where files are stored in cloud"""
52
-
53
- # schema_extra = {
54
- # "example": {
55
- # "input_dir": "input",
56
- # "output_dir": "output",
57
- # "filename": "VJ102DNB.A2022362.0154.021.2022362055600.nc",
58
- # "geo_filename": "VJ103DNB.A2022362.0154.021.2022362052511.nc",
59
- # "modraw_filename": "VJ102MOD.A2022362.0154.002.2022362115107.nc",
60
- # "modgeo_filename": "VJ103MOD.A2022362.0154.002.2022362095104.nc",
61
- # },
62
- # }
63
-
64
50
65
51
@app .on_event ("startup" )
66
52
async def rslp_init () -> None :
67
- """VIIRS Vessel Service Initialization."""
53
+ """Landsat Vessel Service Initialization."""
68
54
logger .info ("Initializing" )
69
55
70
56
@@ -90,38 +76,6 @@ async def get_detections(info: LandsatRequest, response: Response) -> LandsatRes
90
76
logger .error (f"Error during prediction pipeline: { e } " )
91
77
return LandsatResponse (status = ["error" ], predictions = [])
92
78
93
- # ves_detections = all_detections["vessel_detections"]
94
-
95
- # satellite_name = utils.get_provider_name(dnb_dataset)
96
- # acquisition_time, end_time = utils.get_acquisition_time(dnb_dataset)
97
- # chips_dict = utils.get_chips(image, ves_detections, dnb_dataset)
98
- # if info.gcp_bucket is not None:
99
- # chips_dict = utils.upload_image(
100
- # info.gcp_bucket, chips_dict, info.output_dir, dnb_path
101
- # )
102
- # else:
103
- # utils.save_chips_locally(
104
- # chips_dict,
105
- # destination_path=info.output_dir,
106
- # chip_features=ves_detections,
107
- # )
108
-
109
- # average_moonlight = RoundedFloat(utils.get_average_moonlight(dnb_dataset), 2)
110
-
111
- # frame_extents = utils.get_frame_extents(dnb_dataset)
112
-
113
- # predictions = utils.format_detections(chips_dict)
114
- # time_s = round(perf_counter() - start)
115
- # n_ves = len(chips_dict)
116
- # logger.info(
117
- # f"In frame: {dnb_path}, vvd detected {n_ves} vessels in ({time_s} seconds)"
118
- # )
119
- # response.headers["n_detections"] = str(len(chips_dict))
120
- # response.headers["avg_moonlight"] = str(average_moonlight)
121
- # response.headers["lightning_count"] = str(all_detections["lightning_count"])
122
- # response.headers["gas_flare_count"] = str(all_detections["gas_flare_count"])
123
- # response.headers["inference_time"] = str("elapsed_time")
124
-
125
79
126
80
if __name__ == "__main__" :
127
81
uvicorn .run ("api_main:app" , host = HOST , port = PORT , proxy_headers = True )
0 commit comments