-
Notifications
You must be signed in to change notification settings - Fork 100
EPPT-2590: Fire Severity Index: Add a FireSeverityIndex class to IMPROVER #2255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mo-philrelton
wants to merge
5
commits into
metoppv:EPPT_2411_fire_severity_index_workflow_development
Choose a base branch
from
mo-philrelton:EPPT_2590_fireseverityindex
base: EPPT_2411_fire_severity_index_workflow_development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1ac2942
Adding a working FSI calculation and tests
mo-philrelton 4e25834
Changes from ABC refactor
mo-philrelton 64b16f1
Adding unit tests for valid inputs/outputs
mo-philrelton 04acd85
Removing merge conflict line
mo-philrelton 851ae55
Comments from the first round of review
mo-philrelton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,50 @@ | ||
| # (C) Crown Copyright, Met Office. All rights reserved. | ||
| # | ||
| # This file is part of 'IMPROVER' and is released under the BSD 3-Clause license. | ||
| # See LICENSE in the root of the repository for full licensing details. | ||
| """Plugin to calculate the Fire Severity Index (Daily Severity Rating).""" | ||
|
|
||
| import numpy as np | ||
| from iris.cube import Cube | ||
|
|
||
| from improver.fire_weather import FireWeatherIndexBase | ||
|
|
||
|
|
||
| class FireSeverityIndex(FireWeatherIndexBase): | ||
| """ | ||
| Plugin to calculate the Fire Severity Index, also known as the | ||
| Daily Severity Rating (DSR). | ||
|
|
||
| The DSR provides a numerical rating of the difficulty of controlling fires. | ||
| It is derived from the Fire Weather Index (FWI) and represents the daily | ||
| fire load and the expected effort required for fire suppression. | ||
|
|
||
| This process is adapted directly from: | ||
| Equations and FORTRAN Program for the | ||
| Canadian Forest Fire Weather Index System | ||
| (C.E. Van Wagner and T.L. Pickett, 1985). | ||
| Page 8, Equation 31. | ||
|
|
||
| Expected input units: | ||
| - Fire Weather Index (FWI): dimensionless | ||
| """ | ||
|
|
||
| INPUT_CUBE_NAMES = ["canadian_forest_fire_weather_index"] | ||
| OUTPUT_CUBE_NAME = "fire_severity_index" | ||
|
|
||
| canadian_forest_fire_weather_index: Cube | ||
|
|
||
| def _calculate(self) -> np.ndarray: | ||
| """Calculates the Daily Severity Rating (DSR) from FWI. | ||
|
|
||
| From Van Wagner and Pickett (1985), Page 8: Equation 31. | ||
|
|
||
| Returns: | ||
| np.ndarray: The calculated DSR values. | ||
| """ | ||
| fwi_data = self.canadian_forest_fire_weather_index.data | ||
|
|
||
| # Equation 31: DSR = 0.0272 * FWI^1.77 | ||
| dsr = 0.0272 * fwi_data**1.77 | ||
|
|
||
| return dsr | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return type in docstring not required. Sphinx/Read the Docs infers from return type hint.