refactor(biogeophys): Rename frac_sno and frac_sno_eff to clarify albedo vs flux roles - #4185
johnpaulalex wants to merge 18 commits into
Conversation
|
Thanks for tackeling this, @johnpaulalex. Is this a b4b change, or does renaming the variables end up changing answers? |
|
Hey @wwieder, it should be b4b! I have had problems logging in to derecho for a while - recently resolved - so I thought now I'd run the aux_clm tests to verify (lmk if that's wrong). I did run the pfunit test cases just now and they surfaced one renaming (compilation) error. Oh and derecho appears to be down right now (not responding to pings or ssh's) so I'll have to try later, hopefully later today. |
|
Thanks @johnpaulalex. Derecho is down, but may come online again this afternoon. |
|
Also, can you modify this PR to come to b4b_dev, not master? I don't seem to have those permissions. |
|
Now set to b4b_dev. I'll ping this thread again when I've run the aux_clm tests on derecho (which still appears to be down, fingers crossed...) |
|
Ok aux_clm passed except for 4 issues, which appear orthogonal, but I'd love for someone who Knows Things to verify. I'm happy to dig further into any of them - and if there are infra bugs causing them, I could fix them too. Update 2 of the issues are known errors. The other two I should be able to fix with a rerun. 1.
|
|
Hi @johnpaulalex , I've been assigned to review this PR. I'm half-time, so I'll be able to start looking at this on Tuesday/Wednesday. Happy to look further at this next week. |
|
Thanks @olyson, on deeper inspection it looks like the two date|time_written warnings were bogus, that was just AI misinterpreting warnings as real errors. Your command line should solve my numpy import warning (thank you!), and doing the proper subrepo import should fix the other one. I'm going to rerun with your command, which should make it all clean. |
|
Regarding the first failure, I think it is due to some differences in the coupler history file, i.e., |
|
Wow, ok, I had forgotten some layers here. Turns out the second case - also with the bogus date|time_written warnings that AI flagged - also had genuine science diffs (as you're saying @olyson for the first test). But those are both known issues and auto-ignored in ExpectedTestFails.xml:
|
|
Sorry, you run the systems tests and compare against whatever ctsm tag b4b-dev is up to date with. Corrected above but here it is again: |
|
ah yeah that -c b4b-dev run did fail, complaining there's no baseline dir with that name. Rerunning with -c ctsm5.4.048, which I see has a baseline dir and is the most recent tag to be an ancestor of b4b-dev. |
I believe it is up to date with ctsm5.4.052 |
|
hah, wow, well this is a good re-education, thank you. It's yet another layer I'd forgotten: 48 was the latest tag in my local repo, which had fallen behind the main repo. After syncing, I'm up to 52. And then merging those updates into my branch has now added another commit to this PR. Now restarting aux_clm on derecho at 52... |
|
Ok, results here: /glade/derecho/scratch/jpalex/tests_issue822_052/cs.status One tweak to your command line: The results were not totally clean and I'm not sure whether that's ok. I don't see how renaming variables could cause a problem in one compiler and not the others, but looking at those 3:
|
|
Ok, I'm not sure what you have and haven't done, sorry. You would need to create ctsm_pylib using py_env_create. |
|
Wow, agreed. I need to find a way to manually review all the things, the old-fashioned way. Do you happen to have a way to do this with the github UI (or any other tool) - my two ideas were:
Assuming there's no easy way to do this, I have some other ideas of how to wrangle something up that gets around AI being spotty, but want to make sure I'm not missing something obvious. |
|
I don't have a ton of experience with this part, I have manual methods. I'll bring this up with the software engineers at the next meeting to see what suggestions they might have. |
…sno_* variable declarations
…no_(albedo|fluxes) pattern and comment descriptions Assisted-by: gemini-3-pro-preview
|
Hey @olyson, I did a rethink and a bunch of manual work and I think I’ve fixed the things. Hopefully you’ll agree. Some learnings: I didn’t realize how many edits resulted from my initial search & replace (~200 over 32 files). The scale of this was a big factor in defeating both my traditional and newer AI workflows:
To get around the problems with traditional tools, I eventually hacked up a tool (had the LLM write python) to emit a structured file with all the git diffs, but which I could hand-edit and then reapply back to the files. That let me hand-review all ~200 diffs, and I ended up hand-modifying ~60 of them. This is the core of my fix, see commit ce95b87. Nearly all those edits were about fixing alignment/formatting. That was another error on my part, thinking there was a simple rule I could auto-apply everywhere to get the right whitespace. I still think such a rule does exist, and actually at the end I’ve used my hand-edits as training data for AI to come up with such a rule (it’s complicated) – but hopefully that alignment prompt could be useful in the future. I’ll have to see if it holds up (and I'm happy to share it if you're curious). To get around the LLM attention drift issues, I eventually found two methods:
I didn’t touch review comments, but did reply to one to clarify a history file variable syntax. In terms of how you will review this, I'm curious :) but I have two suggestions:
|
|
Thanks @johnpaulalex , I've reviewed this, it is looking pretty good. I have a couple of small changes I'd like to make. Can you give me collaborator access to this branch? The changes are some realigning of a few associate statements and making one function more generic for frac_sno. |
|
Glad to hear it. I haven't given someone collaborator access before but I checked the "Allow edits and access to secrets by maintainer" box on this PR, which apparently means "If checked, users with write access to ESCOMP/CTSM can add new commits to your issue822-rename-frac-sno branch." lmk if there's some other button to push. |
That didn't seem to work. There should be a settings icon (gear) on your fork (ctsm_jp) page which you can click and it will open up a side bar on the left and you can click collaborators and add me. |
|
@olyson Done. It claims to have sent you an invite. fwiw I apparently already had several CTSM folk listed as collaborators, so I must have done this a while ago and forgot. |
That worked, thanks. |
|
aux_clm testing on Derecho compared to ctsm5.4.052 all passed and b4b as expected, after rerunning a couple of tests. aux_clm testing on Izumi compared to ctsm5.4.052 all passed and b4b as expected. So this looks ready to go, although it does touch 32 files so, SEs, I'm wondering if any other testing should be done? |
|
Per the SE meeting today, no additional testing recommended. However, b4b-dev is locked so will have to wait for the next go-around. Will need to rerun the aux_clm testing once b4b-dev is up to date with the latest main. |
Description of changes
This PR addresses ESCOMP/CTSM Issue #822 to resolve ambiguity around snow fraction variables by renaming them according to their primary intended physical roles:
frac_sno->frac_sno_albedo(snow cover fraction for radiation and surface albedo)frac_sno_eff->frac_sno_fluxes(effective snow cover fraction for fluxes and thermodynamics)The changes are structured across two stacked commits:
444d2e18b): Corrects 8 subroutineassociateblocks wherewaterdiagnosticbulk_inst%frac_sno_eff_colwas incorrectly aliased to the local namefrac_sno.450531d65): Performs global renaming across 32 source and test modules while adding colon-delimited restart fallback variable names (frac_sno_albedo:frac_snoandfrac_sno_fluxes:frac_sno_eff) inWaterDiagnosticBulkType.F90to preserve restart backward compatibility.History output field names (
FSNO,FSNO_ICE,FSNO_EFF) remain unchanged.Specific notes
Contributors other than yourself, if any:
CTSM issues resolved or otherwise addressed, if any:
Description of generative AI usage:
Any user interface changes (namelist or namelist defaults changes)?
Testing planned or performed, if any:
git log -n 2).frac_sno/frac_sno_effvariable references.test_DustEmisLeung2023.pf,test_DustEmisZender2003.pf, andunittestDustEmisInputs.F90.Requirements before merge: