-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wind speed and wind speed informed variables use cffdrs (#3123)
- Loading branch information
Showing
105 changed files
with
2,178 additions
and
978 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
|
||
from app.fire_behaviour import cffdrs | ||
from app.schemas.fba_calc import StationRequest, WindResult | ||
|
||
""" | ||
If user has not specified wind speed, use the values retrieved from WFWX, always re-calculate FFMC & ISI | ||
""" | ||
|
||
|
||
def calculate_wind_speed_result(requested_station: StationRequest, yesterday: dict, raw_daily: dict) -> WindResult: | ||
# extract variable from wf1 that we need to calculate the fire behaviour advisory. | ||
bui = cffdrs.bui_calc(raw_daily.get('duffMoistureCode', None), raw_daily.get('droughtCode', None)) | ||
temperature = raw_daily.get('temperature', None) | ||
relative_humidity = raw_daily.get('relativeHumidity', None) | ||
precipitation = raw_daily.get('precipitation', None) | ||
|
||
wind_speed = raw_daily.get('windSpeed', None) | ||
status = raw_daily.get('recordType').get('id') | ||
|
||
if requested_station.wind_speed is not None: | ||
wind_speed = requested_station.wind_speed | ||
status = 'ADJUSTED' | ||
|
||
ffmc = cffdrs.fine_fuel_moisture_code( | ||
yesterday.get('fineFuelMoistureCode', None), | ||
temperature, | ||
relative_humidity, | ||
precipitation, | ||
wind_speed) | ||
isi = cffdrs.initial_spread_index(ffmc, wind_speed) | ||
fwi = cffdrs.fire_weather_index(isi, bui) | ||
return WindResult(ffmc=ffmc, isi=isi, bui=bui, wind_speed=wind_speed, fwi=fwi, status=status) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.