Skip to content

Conversation

@AGonzalezNicolas
Copy link
Contributor

@AGonzalezNicolas AGonzalezNicolas commented Dec 15, 2025

PULL REQUEST info

This pull request wants to include the following developments:

Into the last eclm-commit a72229c of repo HPSCTerrSys/eCLM/ by merging branch-eclm of repo HPSCTerrSys/clm5_0. Below there is a detailed explanation how branch-eclm of repo HPSCTerrSys/clm5_0 is produced.

Before accepting this pull request, the following needs to be checked:

  • build works
  • run Wüstebach case with fields-names adapted to FT and WC (otherwise will fail)
  • check results Wüstebach case agains reference Wüstebach results
  • run FT
  • check results FT against reference FT results
  • run WC
  • check results WC agains reference WC results

Next steps should include to run these 3 cases in CI.
This should conclude issues: #94, #93, #45

This only can be done with scientific support from IBG-3 (e.g., @tboas, @Toeroeoe).


STEPS FOLLOWED TO MERGE FT and WC into clm5.0:

  1. Start two new dev-branches with the most updated clm5.0 version at that moment (commit e7285f6caeec6f0b35b25a6d49cb59f41d1a0c3e) in our HPSCTerrSys/clm5 repo

  2. Merge WC (tags/reelase_08_2020) development with one of the new dev-branches --> release-clm5.0_WinterCrops

  3. Merge FT with the other new dev-branch --> release-clm5.0_FruitTree

  4. Replace variable names on FT branch --> release-clm5.0_FruitTree_namesVar

    • The nomenclature used in release-clm5.0_WinterCrops was different from release-clm5.0_FruitTree. release-clm5.0_WinterCrops used variables as covercrop_1 and covercrop_2.
    • To support the merge of FT and WC, @tboas, @odombro, and @AGonzalezNicolas agreed to replace the following variable names within therelease-clm5.0_FruitTree:
Old name New name Comments
tropical_soybean covercrop_1 Made by @tboas in WinterCrops, Add to FruitTree branch
irrigated_tropical_soybean covercrop_2 Made by @tboas in WinterCrops, Add to FruitTree branch
ncitrus napple Add to FruitTree branch
nirrig_citrus nirrig_apple Add to FruitTree branch

These variable replacements are found in this other branch release-clm5.0_FruitTree_namesVar.

  1. Merge WC-branch into FT_new_variable_names --> release-clm5.0_FTWC
  • There were several conflicts:
README
src/biogeochem/CNPhenologyMod.F90
src/biogeochem/CropType.F90
src/biogeochem/NutrientCompetitionFlexibleCNMod.F90

I used Visual studio code to manually solve conflicts one by one (no agents, no AI involved).

The branch with both merged developments is clm5_FTWC.

  1. Check results with references after merge
  • FruitTree versus merged clm5_FTWC --> No differences
    Case files here
image image
  • WinterCrops versus merged clm5_FTWC --> No differences
    Case files here
image image

Once the merge is considered successful (after validation against the reference cases), I proceeded to change structure of clm5 to eclm while preserving the commit history of clm5.

STEPS FOLLOWED from clm5-structure to eclm-structure

  1. Starting point is branch release-clm5.0_FTWC of repo HPSCTerrSys/clm5_0.
  2. Change structure of repository to be similar to eclm-structure (HPSCTerrSys/eclm repo)
  • Work on dev-branch based on release-clm5.0_FTWC --> eclm_base_00
  • Apply bootstrap_v2_FTWC_00 --> very similar to what @kvrigor had applied to fork eclm
  • Apply git-filter-repo --> to preserve clm5 commit history
  1. Merge eclm_base_00 with eclm first commit (f6b981f) by applying:
git merge f6b981fe617dde16f8e7d814b98d12312c8f823c --allow-unrelated-histories

And solve conflicts on Viscual Code Studio manually.

  1. Add commits from the HPSCTerrSys/eCLM repo one by one

ekluzek and others added 30 commits October 11, 2019 12:10
This reverts commit 43529b6:

Revert the change in urbantv for clm4_5 as it changes answers in
some cases.
…st appears to be not necessary and second screws up the cold start
… seperate part of driver can be called from. Also add some SHR_ASSERT calls for checking it, add a new diagonstic history variable for H2OSOI as read from streams so can compare to input, make the calls to new subroutine in the original place which shouldn't change answers, but it does unexpectedly
Properly send $opts down to it, and use it in calls inside.
Also add a check that this isn't a transient use case for soil
streams with linear time-interpolation as that will likely cause
an error going from a vegetated point that is missing to not, or
vice versa. Also add a check for that. And fix the soilm test which
had phys in place of conopts.
Change h2osoi_prs to be on gridcell. Do some checking for spval
in soil moisture streams. Added a check that prints a warning
and a commented out endrun (until we have a dataset in full agreement).
Add new namelist item soilm_ignore_data_if_missing and react to it.
Also use old way for the indexing in an attempt to reproduce the
previous results. If soilm_ignore_data_if_missing is true and find
a missing point expected continue calculation as before. If not
abort when that point is found. Also comment out the section
where values greater than 10 were set to spval as that changes
answers.
OK, this is a version that is identical to release-clm5.0.27. Found out
the issue was that lai_interp can't be moved the way I did. It needs
to be divided into the streams part and non-streams part like is
being done in SoilMoistureStreams.

So this replicates answers for SMS_P720x1_D_Ld3.f09_g17.I2000Clm50SpGs.cheyenne_intel.clm-prescribed
… level and SoilMoistureInterp to the OMP clump level
…nd lai_interp called from within an OpenMP threading loop
Add tintalgo settings for most of the streams. Also
change the buildnml fatal-error for soilm_tintalgo='linear'
for transient to a warning that can be overridden if desired.
Also fix the build-namelist unit test for warnings, so it
verifies that warnings die, but will run if -ignore_warnings
is set. Also get maxpatch_pft to normally die if the two
valid settings are used (79 or 17).
…nes. First appears to be not necessary and second screws up the cold start"

This reverts commit ac16068.
AGonzalezNicolas and others added 11 commits July 23, 2024 15:12
Error message example:

```
/bin/sh: 1: ./configure: Permission denied
```
…9) Merge commit 'f06da89b136147493ee0d555429ca888621a473c' into eclm
…Nr 33), Merge commit 'c434963afc5bee1b34fbfdd4ac561a070198da29' into eclm
…commit '700e5c761b67029615c74c6ed045ce4203367ef6' into eclm
…52465bd67f1392cd5c8adf97fa91a803c405' into eclm
…ith_FT_WC_all-at-once

Merge remote-tracking branch 'https://github.com/HPSCTerrSys/clm5_0/tree/eclm' into 'https://github.com/HPSCTerrSys/eclm/tree/dev-merge-eclm_with_FT_WC_all-at-once'
This will include:
	- FruitTree developments
	- Winter Crops developments
@jjokella
Copy link
Contributor

Thanks for starting this! I have two questions

  1. There is a lot of commit history in this PR. I thought it could be possible to add the Fruit-Tree developments as a single commit.
  2. Why did you do FT and WW together? In my opinion, it would be easier to separate these!? Maybe this is not possible?

@kvrigor
Copy link
Member

kvrigor commented Dec 16, 2025

I don't think this big merge is a good idea... those TODO list should be their own individual PRs (like #45) which is small enough for a proper review

@DCaviedesV
Copy link

I don't think this big merge is a good idea... those TODO list should be their own individual PRs (like #45) which is small enough for a proper review

There is a reasoning for this. The merge between the two branches and CLM5.0 and eCLM has already been done. This PR is about bringing this code up to date with eCLM.

I understand the concerns both from @jjokella and @kvrigor about the size and scope of the PR. However, re-doing the work that was done already in resolving the divergences introduced by the branches and the CLM5/eCLM development. In my opinion, this is an exceptional case, and thus has to be handled differently than the workflow we would like to enforce.

@kvrigor
Copy link
Member

kvrigor commented Dec 16, 2025

I still think a big PR like this is basically unreviewable, and I find it unsettling to rely on a merge-and-pray approach. Some specific issues:

  • There's no way to check whether the code modifications makes sense. With a smaller PR, one can manually cross-check the modifications against with the original CLM5 branches of Olga and Theresa to see if the modifications were done accurately
  • The advantage of smaller PRs is they map to smaller features which could be reverted back individually. This is useful when hunting "buggy commits" with git bisect.
    • Case in point: if either Wuestebach, FruitTree, or WinterWheat results from this branch didn't match reference results, where can we attribute the problem? Could it be due to FruitTree changes, or WinterWheat changes, or some combination of both, or due to other extra stuff piggybacking in this PR?
    • Even if all tests pass, the result is still questionable: what if some accidental combination of feature A+B+C masked issues and luckily made all tests pass? A big PR doesn't allow isolating a single feature to analyze changes in simulation behavior.
  • Our PR workflow automatically squashes branch commits into a single commit. This is done to avoid polluting the main history with noise.

re-doing the work that was done already in resolving the divergences introduced by the branches and the CLM5/eCLM development.

I think conflict resolution only works when code is reviewable; hence the common practice of small, reviewable PRs. Also, passing tests != no code conflicts.

@jjokella
Copy link
Contributor

Hm, in the end all the history will anyway go away again, once the PR is squashed, right? So it may be cleaner to just copy the files and have a single commit...

More important in my opinion is to have a pure Fruit-Tree PR and not to mix it with the still under review #45.

My last inspection of the #45 gave me the impression that it should itself be chopped into sub-PRs that can be checked for mergeability (tests + code review that ensure backward-compatibility).

I guess, it is best to discuss this tomorrow in our meeting.

@kvrigor
Copy link
Member

kvrigor commented Dec 16, 2025

My last inspection of the #45 gave me the impression that it should itself be chopped into sub-PRs that can be checked for mergeability (tests + code review that ensure backward-compatibility).

I think that PR should be fine; the changes represent what Theresa did to support WinterWheat--no more, no less. Besides, we want to verify Theresa's change all at once, not smaller parts of her work. Also, if FruitTree would cause some problem in the future, we would want to revert a single commit, not a series of commits with legitimate commits mixed in between

@DCaviedesV
Copy link

DCaviedesV commented Dec 16, 2025

I don't disagree with @kvrigor points, in general. I think, however, we need to carefully evaluate the alternative and structure a pragmatic approach. Some specific comments:

I still think a big PR like this is basically unreviewable, and I find it unsettling to rely on a merge-and-pray approach.

I don't think this is the case. The testing has been done in the integration, and a second set of testing merging the devs with the current head of eCLM should be robust. Not really merge-and-pray, but I do agree that it is convoluted.

  • There's no way to check whether the code modifications makes sense. With a smaller PR, one can manually cross-check the modifications against with the original CLM5 branches of Olga and Theresa to see if the modifications were done accurately

In principle yes. But it is way to late in the development process of these features to engage in this. This is a failure of process. We now have to solve it.

  • The advantage of smaller PRs is they map to smaller features which could be reverted back individually. This is useful when hunting "buggy commits" with git bisect.

Fully agree. But also a failure of process. At this point in this development, this is already the spilled milk.

  • Case in point: if either Wuestebach, FruitTree, or WinterWheat results from this branch didn't match reference results, where can we attribute the problem? Could it be due to FruitTree changes, or WinterWheat changes, or some combination of both, or due to other extra stuff piggybacking in this PR?

This is the crux of the matter in my opinion. This is the testing that needs to be done. However, as far as I understand, the testing of the FruitTree + WinterWheat merge into CLM5/eCLM has already been carried out. So we have a baseline to answer this. @AGonzalezNicolas can weigh in with specifics.

  • Even if all tests pass, the result is still questionable: what if some accidental combination of feature A+B+C masked issues and luckily made all tests pass? A big PR doesn't allow isolating a single feature to analyze changes in simulation behavior.

Sure, but this is true always. I understand a big PR obfuscates this further. But assume that WinterWheat and FruitTrees had been developed as a single development. Then this simply means there is a big PR. It is not nice, but does it pay off to undo it?

  • Our PR workflow automatically squashes branch commits into a single commit. This is done to avoid polluting the main history with noise.

Fair. Nothing against this.

re-doing the work that was done already in resolving the divergences introduced by the branches and the CLM5/eCLM development. I think conflict resolution only works when code is reviewable; hence the common practice of small, reviewable PRs. Also, passing tests != no code conflicts.

I also agree with this. However, my point is that the divergences already exist. This is a fact, and therefore we have to resolve them pragmatically. Since the work of re-converging these divergences is already advances in the branch in this PR, it seems counterintuitive and counterproductive to start again from scratch. The granularity would be, at best, to split WinterCrops from FruitTrees and then have two PRs, and in each of them re-do what is already done here.
I agree that this is far more satisfying in terms of the development process, but it seems a duplication of efforts.
In general, also, passing tests != no code conflicts for sure. But we currently don't have the testing granularity to ensure this in general, so in my opinion this argument holds for any PR.

I would cast two questions:
1- how can we make this PR as safe, reviewable and testable as possible, within the context that we have this PR already in?
2- what is the cost of doing something else?

@jjokella
Copy link
Contributor

jjokella commented Dec 17, 2025

Hi all, I also agree with basically everything and think it is a matter of finding the most pragmatic and robust way forward.

Still insisting that I am a friend of splitting PRs up.

Very concrete point: There are .github/ISSUE_TEMPLATES introduced here. This could (and should imo) be an own PR. Will be very fast merged and then we have a few files less diff from this PR.

Another quick cleanup: Some permission change like src/csm_share/esmf_wrf_timemgr/unittests/go.csh, these could simply be removed from the PR.

After this, all changes of this PR should be restricted to src/clm5 as I see it.

@AGonzalezNicolas
Copy link
Contributor Author

@DCaviedesV, @jjokella, @kvrigor I updated the pull request comment with more details describing the procedure I followed. Let me know if anything is unclear or if further information would be helpful.

@kvrigor
Copy link
Member

kvrigor commented Dec 18, 2025

My biggest qualm is when in the future somebody observes a "weird model behavior" of eCLM. With this big PR there is no way to revert into an old commit that corresponds to a single feature. This makes future investigation of weird behaviors extremely difficult.

Another big problem is this PR carries the old CLM5 git history which should have been a separate PR in itself. Perhaps it should be a GitHub issue first; to be honest I'm still not fully convinced of its value. Users care about model features that is relevant to their simulation, not the particulars of our git repository.

And some comments:

Still insisting that I am a friend of splitting PRs up.

Fully agree; this is the most pragmatic approach. Small PRs are reviewable, limited scope means test results are meaningful, and the review process is smoother. Safer, reviewable, testable, faster.

also a failure of process. At this point in this development, this is already the spilled milk.

I struggle to see the problem in the process: this is the 95th PR and the ones before that went well, i.e., well-scoped and reviewable PRs. The recent eCLM-PDAF PRs of Johannes and Yorck perfectly demonstrate this process.

Very concrete point: There are .github/ISSUE_TEMPLATES introduced here. This could (and should imo) be an own PR. Will be very fast merged and then we have a few files less diff from this PR.

I actually do not like this 😅 I trust people in our group could write issues on their own without relying on a template, and so far it works. The last thing I wanna read is a GitHub issue that reads like a travel visa application form...

what is the cost of doing something else

This PR has a huge upfront cost in terms of effort and review time. Our usual approach might be slower, but it is steady and takes much less effort per iteration. Every PR is an opportunity not only to catch bugs, but to collectively learn about the codebase. I fail to see a strong argument for combining old CLM5 history+FruitTree+WinterWheat into a single PR. Too much code to review, too many results to analyze, too many steps done when much fewer could have been made. In my opinion, effort could have been much better spent in iterative changes in the form of small PRs.

@kvrigor
Copy link
Member

kvrigor commented Dec 18, 2025

To add: since PRs get squashed as a single merge commit into master, preserving the CLM5 history in this branch would have no use.

@DCaviedesV
Copy link

We had some interesting discussion in the SDLTS meeting on 17.12.2025, which included thinking over alternative in which to do this which go in the direction of minimising effort and risk. The first outcome of the discussion is @AGonzalezNicolas edited the PR description with a more detailed recollection of what was done to generate this.

This is relevant, and links to @kvrigor's comment

To add: since PRs get squashed as a single merge commit into master, preserving the CLM5 history in this branch would have no use.

I'm not sure whether we should squash the commits or not. The original reasoning and requirements for the merges of the WC and FT branches was we could propagate them both into eCLM and into the upstream CLM5. That motivated this idea of recovering the history between eCLM and CLM5. This of course relates to @kvrigor's comment :

Another big problem is this PR carries the old CLM5 git history which should have been a separate PR in itself. Perhaps it should be a GitHub issue first; to be honest I'm still not fully convinced of its value. Users care about model features that is relevant to their simulation, not the particulars of our git repository.

At some point this was agreed to be a valuable strategy. I agree this is mostly not useful for users. But useful for us to be able to reconcile eCLM-CLM5 divergences (for example to uptake new CLM5 devs from upstream, or to push eCLM devs upstream to CLM5).
Given the recent announcements about NCAR ceasing to exist, I'm not sure if this will be relevant, but that was the original plan.

With this in mind, we discussed in the meeting that it could perhaps make sense to separate the different steps that @AGonzalezNicolas did (relying on intermediate states in the history of that dev) and cast them into several PRs, the first one concerning the CLM5 git history, in the spirit of

Small PRs are reviewable, limited scope means test results are meaningful, and the review process is smoother. Safer, reviewable, testable, faster.

Concering this:

also a failure of process. At this point in this development, this is already the spilled milk.

I struggle to see the problem in the process: this is the 95th PR and the ones before that went well, i.e., well-scoped and reviewable PRs. The recent eCLM-PDAF PRs of Johannes and Yorck perfectly demonstrate this process.

The failure of the process starts many years ago when the original dev WC and FT branches started and multiple divergences occurred. It is not a failure of the current established process (with well engineered, small scoped PRs). This discussion is about recovering from a not-well-managed RSE process from long ago (aka spilled milk).

what is the cost of doing something else

This PR has a huge upfront cost in terms of effort and review time. Our usual approach might be slower, but it is steady and takes much less effort per iteration. Every PR is an opportunity not only to catch bugs, but to collectively learn about the codebase.

Yes, but a large part of that cost has been paid already. That is precisely my point. What I would like to know is the concrete alternative which satisfies all the original requirements (i.e., including recovering the CLM5 history), which does not imply paying this cost again.

I fail to see a strong argument for combining old CLM5 history+FruitTree+WinterWheat into a single PR. Too much code to review, too many results to analyze, too many steps done when much fewer could have been made. In my opinion, effort could have been much better spent in iterative changes in the form of small PRs.

Possibly yes. This is along the lines of what we discussed yesterday in the SDLTS meeting (see the beginning of my comment). But I would oppose starting the process from scratch, when so much has been done. I think we need to consider if we can use the work @AGonzalezNicolas already put in, which was quite a lot, to satisfy all the original requirements.

@kvrigor
Copy link
Member

kvrigor commented Dec 19, 2025

The failure of the process starts many years ago when the original dev WC and FT branches started and multiple divergences occurred. It is not a failure of the current established process (with well engineered, small scoped PRs). This discussion is about recovering from a not-well-managed RSE process from long ago (aka spilled milk).

From the POV of a domain expert whose job is to get things done, I don't see this as a failure. We're already lucky that Theresa and Olga encapsulated their work in a form of git repo. I believe it's part of our job to straighten up the code from domain experts (who have way better things to do than deal with code divergence) and make sure it cleanly gets into master. Again, the recent eCLM-PDAF PRs by Johannes/Yorck/Fernan already demonstrated this. We should be helping the feature authors to faithfully merge their work onto master, not spoil it.

I'm not sure whether we should squash the commits or not. The original reasoning and requirements for the merges of the WC and FT branches was we could propagate them both into eCLM and into the upstream CLM5.

I think we're trying to hit three birds at once here: add FruitTree, WinterWheat, and CLM5 history. The more relevant question here is, why bundle these three separate features in the first place? Justifying it through effort that has already done before is not really a reason.

I would oppose starting the process from scratch,

See #45. It could have been already merged if the test effort went toward that PR. And notice how brief that PR is—even the patching strategy is in a form of a shell script which anybody can easily replicate. If it helps, I could easily create a similar PR for FruitTree. The only bottlenecks in this kinds of PR is manual verification.

when so much has been done

My disappointment is there is so much wrong thing has been done that no amount of lengthy description + promise of comprehensive tests will save this PR. The most natural and easiest thing to do is one PR at a time: #45 is already there, a FruitTree PR can be easily created, and the CLM5 history discussion on a separate GH issue.

There are so many other points I'd like to discuss, but I'll stop here to not spawn new discussion threads 😅. This PR has spawned multiple points of debate which reflects the complexity of this PR. Because of that we weren't able to focus our discusion in the most important part of a PR—the features themselves!

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.