Skip to content
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

Add functionality to convert a forecast to a climatological anomaly #2066

Closed
2 tasks done
brhooper opened this issue Dec 12, 2024 · 4 comments · Fixed by #2072
Closed
2 tasks done

Add functionality to convert a forecast to a climatological anomaly #2066

brhooper opened this issue Dec 12, 2024 · 4 comments · Fixed by #2072
Assignees
Labels
good first issue This issue is simpler to address

Comments

@brhooper
Copy link
Contributor

brhooper commented Dec 12, 2024

As an IMPROVER scientist wishing to develop SAMOS functionality in IMPROVER, I need a utility function to allow me to convert an input cube of data to a cube containing anomaly data.

This function should take as inputs:

  • a cube containing diagnostic data to be converted to anomalies (e.g screen temperature data)
  • a cube containing a mean average of that diagnostic (e.g mean screen temperature over a period)
  • (optional) a cube containing a variance of that diagnostic (e.g screen temperature variance over a period)

the following calculation should then be performed:

if variance input present:
standardised_anomaly = (data - mean) / sqrt(variance)

else:
anomaly = data - mean

Acceptance criteria

  • Plugin added to IMPROVER for creating a cube of climatological anomalies.
  • Unit tests demonstrating the proper functioning of the new plugin
@brhooper brhooper added the good first issue This issue is simpler to address label Dec 12, 2024
@brhooper
Copy link
Contributor Author

This functionality might neatly fit in improver/utilities/mathematical_operations.py.

@gavinevans
Copy link
Contributor

An example of such a function serving a similar purpose can be seen in the standardise_forecast_and_truths function in these branches:

@brhooper
Copy link
Contributor Author

@maxwhitemet and I discussed this ticket this morning to come up with an implementation plan. We expect that the new functionality will look something like as follows:

class calculate_climate_anomalies
  def init
  	# initialisation
  def verify_inputs
  	# confirm that input data makes sense
        # this could involve checking that the input data shapes are compatible,
        # and that the time bounds of the mean and variance cubes contain the time of the data cube
  def create_output_cube
  	# setup correct metadata
  def calculate_anomalies
  	# do the calculation here
  def process
        # call the previously defined functions
  output

@maxwhitemet
Copy link
Contributor

Why a reference_epoch coordinate was added to the output cube
The reference_epoch coordinate records the time-bounds of the mean cube (i.e. 'climatology') with respect to which the anomaly was calculated. Bruce identified the need to implement this coordinate to align with the conventions for anomalies discussed in this CF-convention issue.

@gavinevans gavinevans self-assigned this Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue This issue is simpler to address
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants