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

variable name philosophy #4

Open
mvhulten opened this issue Dec 2, 2024 · 4 comments · May be fixed by #8
Open

variable name philosophy #4

mvhulten opened this issue Dec 2, 2024 · 4 comments · May be fixed by #8
Labels
enhancement New feature or request

Comments

@mvhulten
Copy link
Contributor

mvhulten commented Dec 2, 2024

Concerning naming, consistency between README and scripts and updating, is there a philosophy for the shell variables?

Some examples:

  • In control_tsmp2.sh there is $expid, gotten from either $EXP_ID further up (where user can adjust it), but in README.md there is $sim_id
  • There is CASE_ID and caseid

One sort of principle is visible, of course: user defines XXX_YYY and script picks it then up as xxxyyy, but other things work different again. Also there is npnode=$npnode_u and similar, and so on…

The actual question is rather: if I find it messy do I not understand properly (then we should talk), or is it how I think it is and should it be like that, or should I try to make it more consistent?

@s-poll, apropos, in the TSMP2 repo (at least that stages-2024 branch), in fact, lower-case hostnames are used (so they are not up-cased with ^^). Someone like-minded must've changed it thus. :-) (in retrospect, of very little importance, and I'll only touch it if I must touch the line for another reason as well)

@mvhulten
Copy link
Contributor Author

mvhulten commented Dec 2, 2024

A bit more specific to this issue (an exaple):

Say, I compile eCLM only (so ./build_tsmp2.sh --eCLM—if that would work überhaupt, but see in the relevant TSMP pull request for that—oh and here are some capital letters whereas in the wfe they are all lower-case (which I prefer, but more important is that they will be the same)) and then when I run it, by default it does coupled becasue by default

MODEL_ID=ICON-eCLM-ParFlow

@kvrigor
Copy link
Member

kvrigor commented Dec 3, 2024

I think the "right" answer here depends on which convention we adopt. Perhaps the Google shell styleguide would be a good start.

@s-poll
Copy link
Member

s-poll commented Dec 4, 2024

Just in short, I will add more information at a later stage.

The variable name philosophy is that variables which ends with _u are user-defined variables and are not used by the system itself. These are transferred to variables without _u-ending. The difference between EXP_ID (input) and the expid (wfe internal usage) are that the exp_id is a modified (lower-casing, removing of separator) version of EXP_ID, which is connected with the separation in the directory names.

I admit that the naming scheme might not always be intuitive. I am open for suggestions.

@mvhulten
Copy link
Contributor Author

mvhulten commented Dec 10, 2024

The suggestion is here, first as a separate feature branch, but it took too long and was afraid of merging conflicts arrising, so I merged it already to my main improvement branch that can be merged (if you have no more issues).

mvhulten added a commit that referenced this issue Dec 12, 2024
Instead of checking an intermediate variable and then setting the final
variable, it is just as well to directly use the final variable.

Resolves: #4
@mvhulten mvhulten linked a pull request Dec 12, 2024 that will close this issue
@mvhulten mvhulten added the enhancement New feature or request label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants