77 LocationName ,
88 TemporalResolution ,
99 Unit ,
10- IndexType
10+ IndexType ,
1111)
1212from src .service import sat_index_service
1313from src .utils .temporal import get_optimistic_rounding
2222
2323@sat_index_router .get ("/ndvi" , response_model = NDVIResponse )
2424async def get_ndvi_data (
25- startDate : int = Query (...,
26- description = "Start date as UNIX timestamp in seconds" ),
27- endDate : int = Query (...,
28- description = "End date as UNIX timestamp in seconds" ),
29- location : LocationName = Query (..., description = "Location name" ),
25+ startDate : int = Query (
26+ ...,
27+ description = "First date of requested date range in UNIX timestamp as seconds" ,
28+ ),
29+ endDate : int = Query (
30+ ...,
31+ description = "Last date of requested date range in UNIX timestamp as seconds" ,
32+ ),
33+ location : LocationName = Query (..., description = "Name of the requested location" ),
3034 temporalResolution : TemporalResolution = Query (
31- ..., description = "Temporal resolution"
35+ ...,
36+ description = "Time interval that a single data point should represent e.g. one month" ,
37+ ),
38+ aggregation : AggregationMethod = Query (
39+ ...,
40+ description = "Method of aggregating available data into a single datapoint to represent the selected time interval e.g. mean average" ,
3241 ),
33- aggregation : AggregationMethod = Query (...,
34- description = "Aggregation method" ),
3542):
36-
3743 validate_timestamp_start_date_before_end_date (startDate , endDate )
3844 validate_timestamp_in_range_of_S2_imagery (startDate , endDate )
3945 start_date_dt = datetime .fromtimestamp (startDate , tz = timezone .utc )
@@ -49,7 +55,7 @@ async def get_ndvi_data(
4955 aggregation_method = aggregation ,
5056 start_date = rounded_start_date ,
5157 end_date = rounded_end_date ,
52- index_type = IndexType .NDVI
58+ index_type = IndexType .NDVI ,
5359 )
5460
5561 response = {
@@ -66,20 +72,27 @@ async def get_ndvi_data(
6672
6773 return JSONResponse (content = response )
6874
75+
6976@sat_index_router .get ("/msavi" , response_model = MSAVIResponse )
7077async def get_msavi_data (
71- startDate : int = Query (...,
72- description = "Start date as UNIX timestamp in seconds" ),
73- endDate : int = Query (...,
74- description = "End date as UNIX timestamp in seconds" ),
75- location : LocationName = Query (..., description = "Location name" ),
78+ startDate : int = Query (
79+ ...,
80+ description = "First date of requested date range in UNIX timestamp as seconds" ,
81+ ),
82+ endDate : int = Query (
83+ ...,
84+ description = "Last date of requested date range in UNIX timestamp as seconds" ,
85+ ),
86+ location : LocationName = Query (..., description = "Name of the requested location" ),
7687 temporalResolution : TemporalResolution = Query (
77- ..., description = "Temporal resolution"
88+ ...,
89+ description = "Time interval that a single data point should represent e.g. one month" ,
90+ ),
91+ aggregation : AggregationMethod = Query (
92+ ...,
93+ description = "Method of aggregating available data into a single datapoint to represent the selected time interval e.g. mean average" ,
7894 ),
79- aggregation : AggregationMethod = Query (...,
80- description = "Aggregation method" ),
8195):
82-
8396 validate_timestamp_start_date_before_end_date (startDate , endDate )
8497 validate_timestamp_in_range_of_S2_imagery (startDate , endDate )
8598 start_date_dt = datetime .fromtimestamp (startDate , tz = timezone .utc )
@@ -95,7 +108,7 @@ async def get_msavi_data(
95108 aggregation_method = aggregation ,
96109 start_date = rounded_start_date ,
97110 end_date = rounded_end_date ,
98- index_type = IndexType .MSAVI
111+ index_type = IndexType .MSAVI ,
99112 )
100113
101114 response = {
0 commit comments