Skip to content

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
@wwieder wwieder moved this to In Progress in LDF on ADF May 9, 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

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Land: Combine global_mean_timeseries_lnd.py into global_mean_timeseries.py

1 participant