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

zppy-interfaces refactor #642

Merged
merged 13 commits into from
Nov 22, 2024
Merged

zppy-interfaces refactor #642

merged 13 commits into from
Nov 22, 2024

Conversation

forsyth2
Copy link
Collaborator

@forsyth2 forsyth2 commented Nov 5, 2024

Copy link
Collaborator Author

@forsyth2 forsyth2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xylar @chengzhuzhang Following up from E3SM-Project/zppy-interfaces#1 (review), the major changes on the zppy side so far are:

  • Better organization of the zppy/templates directory:
    • .bash files remain in zppy/templates.
    • Defaults (default.ini, campaign cfgs) are now in zppy/defaults.
    • The global_time_series .py files have been moved to zppy-interfaces/global-time-series, outside of this repo entirely.
    • e3sm_diags/lat_lon_conus.cfg didn't appear to be used anywhere, so I created zppy/examples to house that.
    • Some files are included into the bash templates, so I've placed these in zppy/templates/inclusions
  • As mentioned in Initial implementation zppy-interfaces#1 (comment), the .bash template for Global Time Series has been greatly simplified by moving much of that code over to Python in zppy-interfaces.

exit 6
fi

zppy-interfaces global-time-series --use_ocn={{ use_ocn }} --global_ts_dir={{ global_time_series_dir }} --input={{ input }} --input_subdir={{ input_subdir }} --moc_file={{ moc_file }} --case_dir={{ output }} --experiment_name={{ experiment_name }} --figstr={{ figstr }} --color={{ color }} --ts_num_years={{ ts_num_years }} --plots_original={{ plots_original }} --atmosphere_only={{ atmosphere_only }} --plots_atm={{ plots_atm }} --plots_ice={{ plots_ice }} --plots_lnd={{ plots_lnd }} --plots_ocn={{ plots_ocn }} --regions={{ regions }} --start_yr={{ year1 }} --end_yr={{ year2 }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your idea of a config file instead of this. It would be good to break the command into multiple lines with \ for better readability if you do keep this approach.

@xylar
Copy link
Contributor

xylar commented Nov 5, 2024

Yep, so far, I like the changes you're proposing!

@forsyth2 forsyth2 marked this pull request as ready for review November 21, 2024 21:57
Copy link
Contributor

@xylar xylar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! Just a few comments that don't need addressing in this PR.

@@ -0,0 +1,67 @@
"""Logger module for setting up a logger. Based on xcdat/xcdat/_logger.py"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is redundant with https://github.com/E3SM-Project/zppy-interfaces/blob/initial-implementation/zppy_interfaces/multi_utils/logger.py but I think that's pretty hard to avoid.

Still, worth keeping an eye on this kind of redundancy and having a backup plan if it gets bad.

@@ -34,6 +34,7 @@ years = "1985:1995:5",

[global_time_series]
active = True
environment_commands = "source /gpfs/fs1/home/ac.forsyth2/miniforge3/etc/profile.d/conda.sh; conda activate zppy_interfaces_dev_pr_1_20241121v4"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably, this will be removed once there are shared environments that support zppy-interfaces?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, realistically this will remain because we'll always want to test zppy with the latest zppy-interfaces code, not whatever the last release was. But yes, for cfgs written by users they could rely on Unified having zppy-interfaces in it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem I see is that this environment is only on Chrysalis (or Anvil). What if you want to test somewhere else?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or is this just a placeholder?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that's the responsibility of tests/integration/utils.py. This file is auto-generated by that one. I currently only have a Chrysalis environment set up, so it's the only one defined.
Screenshot 2024-11-22 at 11 27 46 AM

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think it is a little odd to have machine and user specific path here, but don't know how to get around.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well we could use $USER to get my name out of it but ultimately whoever runs this cfg will need to create their own conda environment for the latest developments or else use Unified.

I think maybe the best solution is to always keep the environment_commands lines on the main branch filled in as <path to YOUR conda>; conda activate <environment YOU create>.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, the commit dbd74f3 implements the idea I mentioned in the previous comment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like it would be better to have some examples somewhere but not to update them very often. This is the approach we use in MPAS-Analysis.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with that is I fear they will very quickly go out-of-date. This approach (the auto-generation of scripts from templates) updates everything together.

@chengzhuzhang
Copy link
Collaborator

  • e3sm_diags/lat_lon_conus.cfg didn't appear to be used anywhere, so I created zppy/examples to house that.

@forsyth2 this .cfg file is actually referenced here: https://github.com/E3SM-Project/zppy/blob/408e9ade87db8d0d5322c01186564df1392282be/docs/source/post.rrm_simulation.cfg#L59C1-L62C39

@forsyth2
Copy link
Collaborator Author

@chengzhuzhang Ah thank you. Ok, so this should actually be included under inclusions then as a possible cfg a user can use?

@forsyth2
Copy link
Collaborator Author

@chengzhuzhang The commit be06191 addresses your comment.

@forsyth2 forsyth2 merged commit 6561a45 into main Nov 22, 2024
4 checks passed
@forsyth2 forsyth2 deleted the discussion-641-refactor branch November 22, 2024 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants