We had discussed improving the API for derived variables a while back but I think I have a clear idea on how to move forward.
As I had shown in #405 thinking about adding in AI detection models to act as "variables", a derived variable should:
- Input any n number of variables which are codified in the class as required
- Define the shape of the output and whether it's lead-time or init-time-based (or both)
- Output a single variable
Where, given EWB's ability to use different variables for analysis, e.g. CBSS and PPH, the expected shape of the output can be used as a guard against running an evaluation that ultimately fails due to a shape mismatch.
This would simplify the derived variables approach from:
variables=[
ewb.derived.AtmosphericRiverVariables(
output_variables=["atmospheric_river_land_intersection"]
)
],
to:
variables=[ewb.derived.AtmosphericRiver()],
A user can invoke ewb.derived.AtmosphericRiver() to get a unique repr of what the output is, what variables are required, and (if #405 ends up being implemented) whether or not it's model-based.
This way, we can also create a registry of derived variables that can be used inside EWB with minimal effort. The registry could also be easily extended by our community.
We had discussed improving the API for derived variables a while back but I think I have a clear idea on how to move forward.
As I had shown in #405 thinking about adding in AI detection models to act as "variables", a derived variable should:
Where, given EWB's ability to use different variables for analysis, e.g. CBSS and PPH, the expected shape of the output can be used as a guard against running an evaluation that ultimately fails due to a shape mismatch.
This would simplify the derived variables approach from:
to:
A user can invoke
ewb.derived.AtmosphericRiver()to get a uniquereprof what the output is, what variables are required, and (if #405 ends up being implemented) whether or not it's model-based.This way, we can also create a registry of derived variables that can be used inside EWB with minimal effort. The registry could also be easily extended by our community.