Skip to content

Add shr_string_listGetAllNames and associated unit tests#75

Merged
billsacks merged 6 commits intoESCOMP:mainfrom
billsacks:shr_string_func_for_water_tracers
Nov 12, 2025
Merged

Add shr_string_listGetAllNames and associated unit tests#75
billsacks merged 6 commits intoESCOMP:mainfrom
billsacks:shr_string_func_for_water_tracers

Conversation

@billsacks
Copy link
Member

I plan to leverage this new subroutine in the water tracer code: From the config file, we'll read in colon-delimited lists of water tracer names, water tracer species, and water tracer initial ratios; we then will need to turn each of those into arrays of values; this new subroutine accomplishes that step.

I also added some unit tests of shr_string_listIsValid. I was originally planning to modify that routine to add some flexibility in terms of what's considered "valid", but that started to feel messy, so I'm instead planning to keep that as is. But before deciding to leave it as is, I had already written some unit tests to cover my planned rework; I figured I might as well leave them in place to cover this code for the future. If anyone is interested (probably mainly @nusbaume ): The two changes I had been thinking of making to this were (1) optionally allowing 0-length lists (in case we have 0 water tracers), and (2) optionally allowing 0-length elements (in case the species name is empty, indicating bulk water). For (1), I decided to handle this by checking this in the caller and doing special handling of 0-length lists. For (2), I decided to use "-" as the species name for bulk water rather than an empty string so that I could use the shr_string_list functionality unchanged.

@billsacks billsacks requested a review from nusbaume November 11, 2025 00:55
Copy link
Contributor

@nusbaume nusbaume left a comment

Choose a reason for hiding this comment

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

Thanks for the new functionality @billsacks! I just had some (hopefully minor) requests/questions.

billsacks and others added 2 commits November 11, 2025 13:32
Co-authored-by: Jesse Nusbaumer <nusbaume@ucar.edu>
Co-authored-by: Jesse Nusbaumer <nusbaume@ucar.edu>
@billsacks
Copy link
Member Author

Thanks a lot for your review, @nusbaume ! I accepted your suggested changes – thank you for those. I have responded to your other comments, with my explanations for why I propose not changing things; I'm very open to discussing those further if you'd like. (The pFUnit expected-error handling is something that I've had extensive discussions about both with CTSM developers - especially Adrianna - and with Tom Clune (the original developer of pFUnit)... I'd be happy to talk more with you about that if you want.)

Copy link
Contributor

@nusbaume nusbaume left a comment

Choose a reason for hiding this comment

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

Thanks for the revisions and discussion @billsacks! I found one last location that could use list markers, but otherwise everything looks great to me. Thanks again!

Co-authored-by: Jesse Nusbaumer <nusbaume@ucar.edu>
@billsacks billsacks merged commit 7e6d7a7 into ESCOMP:main Nov 12, 2025
1 check passed
@billsacks billsacks deleted the shr_string_func_for_water_tracers branch November 12, 2025 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants