Skip to content

Commit

Permalink
fwi key logic
Browse files Browse the repository at this point in the history
  • Loading branch information
brettedw committed Oct 24, 2024
1 parent 4cd212d commit 20de630
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions api/app/sfms/date_range_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,18 @@ async def process_bui(self):
logging.warning(f"No weather keys found for {model_run_for_hour(self.start_datetime.hour):02} model run")
break

Check warning on line 49 in api/app/sfms/date_range_processor.py

View check run for this annotation

Codecov / codecov/patch

api/app/sfms/date_range_processor.py#L47-L49

Added lines #L47 - L49 were not covered by tests

dc_key = raster_addresser.get_uploaded_index_key(previous_fwi_datetime, FWIParameter.DC)
dmc_key = raster_addresser.get_uploaded_index_key(previous_fwi_datetime, FWIParameter.DMC)

fwi_keys_exist = await all_objects_exist(dc_key, dmc_key)

if not fwi_keys_exist:
if day == 0: # if we're running the first day of the calculation, use previously uploaded actuals
dc_key = raster_addresser.get_uploaded_index_key(previous_fwi_datetime, FWIParameter.DC)
dmc_key = raster_addresser.get_uploaded_index_key(previous_fwi_datetime, FWIParameter.DMC)

Check warning on line 53 in api/app/sfms/date_range_processor.py

View check run for this annotation

Codecov / codecov/patch

api/app/sfms/date_range_processor.py#L51-L53

Added lines #L51 - L53 were not covered by tests
else: # otherwise use the last calculated key
dc_key = raster_addresser.get_calculated_index_key(previous_fwi_datetime, FWIParameter.DC)
dmc_key = raster_addresser.get_calculated_index_key(previous_fwi_datetime, FWIParameter.DMC)

Check warning on line 56 in api/app/sfms/date_range_processor.py

View check run for this annotation

Codecov / codecov/patch

api/app/sfms/date_range_processor.py#L55-L56

Added lines #L55 - L56 were not covered by tests

fwi_keys_exist = await all_objects_exist(dc_key, dmc_key)
fwi_keys_exist = await all_objects_exist(dc_key, dmc_key)

Check warning on line 58 in api/app/sfms/date_range_processor.py

View check run for this annotation

Codecov / codecov/patch

api/app/sfms/date_range_processor.py#L58

Added line #L58 was not covered by tests

if not fwi_keys_exist:
logging.warning(f"No previous DMC/DC keys found for {previous_fwi_datetime.date().isoformat()}")
break
if not fwi_keys_exist:
logging.warning(f"No previous DMC/DC keys found for {previous_fwi_datetime.date().isoformat()}")
break

Check warning on line 62 in api/app/sfms/date_range_processor.py

View check run for this annotation

Codecov / codecov/patch

api/app/sfms/date_range_processor.py#L60-L62

Added lines #L60 - L62 were not covered by tests

temp_key, rh_key, precip_key = raster_addresser.gdal_prefix_keys(temp_key, rh_key, precip_key)
dc_key, dmc_key = raster_addresser.gdal_prefix_keys(dc_key, dmc_key)

Check warning on line 65 in api/app/sfms/date_range_processor.py

View check run for this annotation

Codecov / codecov/patch

api/app/sfms/date_range_processor.py#L64-L65

Added lines #L64 - L65 were not covered by tests
Expand Down

0 comments on commit 20de630

Please sign in to comment.