Skip to content

Combine global timeseries scripts #382

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

Draft
wants to merge 5 commits into
base: clm-diags
Choose a base branch
from

Conversation

samsrabin
Copy link
Member

@samsrabin samsrabin commented Apr 10, 2025

The clm-diags branch currently has two very similar scripts: scripts/plotting/global_mean_timeseries.py and scripts/plotting/global_mean_timeseries_lnd.py. This PR will combine them (and a related pair of functions) to reduce duplicated code.

My plan here:

  1. Combine spatial_average_lnd function into spatial_average.
  2. Hard-code model_component = "lnd" everywhere it's needed in global_mean_timeseries_lnd to handle land-specific behaviors
  3. Add handling for model_component != "lnd" in global_mean_timeseries_lnd to handle behaviors only in global_mean_timeseries.
  4. Paste the contents of global_mean_timeseries_lnd into global_mean_timeseries, deleting the former.
  5. Add model_component input args to all functions there as needed.
  6. Clean up, including by deleting repeated code.

As of b144327, I'm nearing the end of step 2.

…meseries.

The idea here is:
1. Hard-code model_component="lnd" everywhere it's needed in global_mean_timeseries_lnd to handle land-specific behaviors
2. Add handling for model_component!="lnd" in global_mean_timeseries_lnd to handle behaviors only in global_mean_timeseries.
3. Paste the contents of global_mean_timeseries_lnd into global_mean_timeseries, deleting the former.
4. Add model_component inputs to all functions there as needed.
5. Optimize, including by deleting repeated code.
@samsrabin samsrabin added code clean-up Made code simpler and/or easier to read. LDF Specific request for land diagnostics labels Apr 10, 2025
@samsrabin samsrabin self-assigned this Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code clean-up Made code simpler and/or easier to read. LDF Specific request for land diagnostics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Land: Combine global_mean_timeseries_lnd.py into global_mean_timeseries.py
1 participant