@@ -122,25 +122,25 @@ def sat_index_service(
122122):
123123 # Temporary implementation of GEE Caching strategy
124124 current_cache_end_date = datetime (
125- 2024 , 9 , 29 , tzinfo = timezone .utc
125+ 2024 , 9 , 29 , 23 , 59 , 59 , tzinfo = timezone .utc
126126 ) # current end of cache
127127
128128 # Entire range is within the cache,
129129 # get entire range from cache, process nothing.
130- if start_date < current_cache_end_date and end_date < current_cache_end_date :
130+ if start_date < current_cache_end_date and end_date <= current_cache_end_date :
131131 cache_start_date = start_date
132132 cache_end_date = end_date
133133 processing_start_date = None
134134 processing_end_date = None
135135
136136 # Partial overlap with the cache,
137137 # get cached part from cache, process the rest until end of range.
138- elif start_date < current_cache_end_date and end_date > current_cache_end_date :
138+ elif start_date <= current_cache_end_date and end_date > current_cache_end_date :
139139 cache_start_date = start_date
140140 cache_end_date = current_cache_end_date
141141 processing_start_date = (
142- current_cache_end_date + timedelta (days = 1 )
143- ) # WARNING: this can cause an empty range request to GEE, TODO: fix empty range case
142+ current_cache_end_date + timedelta (seconds = 1 )
143+ )
144144 processing_end_date = end_date
145145
146146 # Entire range is outside the cache,
@@ -151,6 +151,11 @@ def sat_index_service(
151151 processing_start_date = start_date
152152 processing_end_date = end_date
153153
154+ else :
155+ raise HTTPException (
156+ status_code = 422 ,
157+ detail = "Unprocessable input: Input value is not supported."
158+ )
154159 # Get and process uncached range
155160 if processing_start_date :
156161 print (
0 commit comments