Explore refactoring of `acme.py` for readability and simplicity
Opened this issue · 0 comments
tomvothecoder commented
The acme.py
file is growing as more derived variables and formulas are being defined. We can explore implementation designs that might be more readable and extensible (e.g,. split file up into separate files).
Related code:
https://github.com/E3SM-Project/e3sm_diags/blob/main/e3sm_diags/derivations/acme.py
Action Items:
- Think of ways to better organize code in this file, maybe even split up the code to smaller files
- Is there a better way to implement derived variable definitions since the dictionary is growing large?
Updates:
- Remove commented out code for SST
- Refactor
adjust_prs_val_units()
- Refactor
cosp_histogram_standardize()
- Refactor
determine_tau()
- Refactor
cosp_bin_sum()
Notes from EZ Meeting on 8/30/23
So far in my CDAT migration PR, I split this file up into three files: formulas.py, derivations.py, and utils.py – Easier to maintain IMO, otherwise one file encapsulating everything will grow too large, can refactor some more in a separate PR
- formulas.py -- formula functions
- derivations.py -- derived variables dictionary
- utils.py -- general functions such as unit conversion, applying land sea mask
- convert_units() function -- non-standard units
Look into e3sm_to_cmip solution for deriving variables and see if we can port to e3sm_diags since definitions and formulas should be the same
- Need to add all formulas for deriving variables
- Need to consider edge case of nested derivations