Skip to content

Conversation

@peverwhee
Copy link
Collaborator

Add diagnostic_name to the constituent properties object and enable setting via instantiate calls and metadata attributes.

Includes:

  • Mods to src/ccpp_constituent_prop_mod.F90 to add the var_diag_name property and set it via instantiate. Also includes methods to retrieve the diagnostic name for a given constituent.
  • Mods to scripts/metadata.py and scripts/var_props.py to include a default diagnostic name (set to local name)
  • Mods to the advection test to confirm the new diagnostic name property is set correctly (and defaults correctly) for both run-time and build-time constituents

User interface changes?: Yes - all calls to %instantiate (dynamic, run-time constituents created during the register phase) must now include the diagnostic name in the argument list. This only impacts CAM-SIMA right now because that's the only host model using the dynamic constituents, to my knowledge.

closes #635

Copy link
Member

@dustinswales dustinswales left a comment

Choose a reason for hiding this comment

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

These changes look fine to me.
At the moment I don't see a use case for them on the NOAA side, but the added functionality doesn't hurt.

Copy link
Collaborator

@gold2718 gold2718 left a comment

Choose a reason for hiding this comment

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

I'm not sure what to say about this. This seems mostly fine (see minor request) but I think you have implemented the diagnostic_name_fixed property. I think we need to just revisit these properties and decide what we will want in the future.

Comment on lines 157 to 158
maxlen = 256
diag_name = stdname[:maxlen] if len(stdname) > maxlen else stdname
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this necessary?
From https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str
"The slice of s from i to j is defined as the sequence of items with index k such that i <= k < j. If i or j is greater than len(s), use len(s)."

Suggested change
maxlen = 256
diag_name = stdname[:maxlen] if len(stdname) > maxlen else stdname
maxlen = 256
diag_name = stdname[:maxlen]

Copy link
Collaborator

Choose a reason for hiding this comment

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

@peverwhee Do you have an answer to this question?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes sorry for the delay! I've pushed up @gold2718 's suggested change

@mkavulich
Copy link
Collaborator

@climbfuji This PR needs a review from the NEPTUNE side

Copy link
Collaborator

@climbfuji climbfuji left a comment

Choose a reason for hiding this comment

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

I don't know a lot about this part of the code but from what I understand it makes sense. Please address @gold2718's question/comment before merging.

@mkavulich
Copy link
Collaborator

@peverwhee Just checking in on the status of this PR. It'll need updating to the top of develop, and addressing Steve's latest question.

@peverwhee peverwhee requested a review from gold2718 December 15, 2025 20:51
@peverwhee
Copy link
Collaborator Author

thanks for the ping, @mkavulich !

I've re-requested @gold2718 's review

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.

Add diagnostic_name metadata field

5 participants