Skip to content

SIP80/SIP83 Remove multi-site support #92

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

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

Alomir
Copy link
Collaborator

@Alomir Alomir commented Jun 6, 2025

#80
#83

This PR:

  • Removes multi-site support from SIPNET
    • Removed location from all places
    • Maintains compatibility with existing *.param files; the location column is ignored for those files
    • Simplifies "spatial" params
  • For new param structures, removed obsolete members related to senstest/estimate parameters
    • Compatibility maintained here as well, extra columns are ignored
  • Updates existing tests
  • Adds new tests for reading old (and new) .clim and .param files

Note: I replaced spatialParams.h|c with modelParams.h|c (via git mv), but it appears here like a deletion and creation.

  • This is not necessarily bad, as it may be easier to review modelParams on its own
  • I am not at all locked into the name modelParams if anyone wants to suggest something else

@Alomir Alomir changed the title SIP80 Remove multi-site support SIP80/SIP83 Remove multi-site support Jun 6, 2025
@Alomir Alomir requested review from dlebauer and infotroph and removed request for dlebauer June 6, 2025 21:48
@Alomir Alomir marked this pull request as ready for review June 6, 2025 21:48
Copy link
Member

@dlebauer dlebauer left a comment

Choose a reason for hiding this comment

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

I really appreciate your thorough use of validation, checks for exceptions, use of tests, and maintaining backwards compatibility! A am impressed that you can keep all of this logic in your while dissecting and excising this code.

  • I am not sure if this was intentionally in this PR vs SIP78 Convert switches to run time options #96, but I think that it is safe to remove the moisture_bwb and moisture_pm functions (that were commented out in this PR). When removing functionality like this I'd just make it clear in the changelog when and why it was done to help facilitate discovery and resurrection in the future for anyone so motivated.
  • We discussed deprecating src/utilities/subsetData.c in which case this is just one more reason to do so - although the utility only works for files with one location, it expects there to be a location column and then confirms that there is only one location.
  • As suggested on Slack I only skimmed the tests to make sure they make sense!

@@ -0,0 +1,114 @@
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! Sipnet parameter files
!!! Modified from the original version by Bill Sacks ([email protected])
Copy link
Member

@dlebauer dlebauer Jun 12, 2025

Choose a reason for hiding this comment

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

Is there or should there be a standard set of 'reference' input files (e.g. that we can link to in docs?) I like the idea of such files being used in tests (like this one) to make sure they are up to date.

Also:

Suggested change
!!! Modified from the original version by Bill Sacks ([email protected])
!!! Modified from Bill's version by Mike Longfritz (@Alomir)
!!! Modified from the original version by Bill Sacks ([email protected])

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I like this idea! I'd go so far as to suggest a /tests/sipnet/reference_inputs directory for them (or some such) - a central place for a suite of input files. I think this would be best as a separate ticket?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Created issue #102 for this (I put it in with the more general unit test revamp that's needed once this PR gets in)

@@ -0,0 +1,29 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

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

I don't see where this file is used in the codebase - should this function be documented somewhere? should it have a #!/bin/bash and .sh extension?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All good questions!

  • I wrote (and used) this utility to trim the location columns from a lot of input test files; I thought I'd add it here in case we wanted it for similar use. (I typically don't expect scripts in a /tools directory to be used in the codebase directly)
  • Yep, it should be documented somewhere, though I'm not sure if it would ever be for more than dev use
  • And yep, it should have a .sh extension. I often don't do that with my own scripts, but that's a personal preference; having the extension is the usual expectation.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for updating this. Although simple, it seems like it could be a handy utility for someone who wants to update their old files... perhaps mentioning it in release notes would be sufficient?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

* | 3 | day | day of start of this timestep | Day of year |
* | 4 | event_type | type of event | (e.g., "irrig") |
* | 5...n| event_param| parameters specific to the event type | (varies) |
* | col | parameter | description | units |
Copy link
Member

Choose a reason for hiding this comment

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

It is great to see Doxygen docs, thank you! However, in this case, the duplicate what is in docs/parameters.md. It seems we should keep a single version that can be cross referenced.

In this specific case, I think that the end user is the key audience and thus one of the docs/*md files might be best (currently parameters.md but I suggested a separate file for inputs & outputs in #99).

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, I've been a bit worried about doc duplication; I have a few comments like "see sipnet.h" in sipnet.c for that exact reason.

I agree that this comment block should go in favor of the markdown version, wherever that ends up. We should make sure to specify where that is in the code here.

Copy link
Member

Choose a reason for hiding this comment

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

It is already in

### Agronomic Events
though this will eventually move (#99)

@@ -13,7 +13,7 @@ FILENAME = Sites/Niwot/niwot
! FILENAME.clim is the file of climate data for each time step

LOCATION = 0
! Location to run at (-1 means run at all locations)
! LOCATION is obsolete; this value is ignored
Copy link
Member

Choose a reason for hiding this comment

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

? is this correct?

Suggested change
! LOCATION is obsolete; this value is ignored
! LOCATION is obsolete and this value is ignored; maintained for backward compatibility

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, I think this should just get deleted (both here and in /tests/smoke/sipnet.in)

Copy link
Member

Choose a reason for hiding this comment

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

Works for me!

@Alomir
Copy link
Collaborator Author

Alomir commented Jun 13, 2025

  • I am not sure if this was intentionally in this PR vs SIP78 Convert switches to run time options #96, but I think that it is safe to remove the moisture_bwb and moisture_pm functions (that were commented out in this PR). When removing functionality like this I'd just make it clear in the changelog when and why it was done to help facilitate discovery and resurrection in the future for anyone so motivated.

I meant to un-comment those out before committing - I was only checking here that they actually were not needed. I'd like to restore them here, and let them get dealt with more appropriately in that other ticket

  • We discussed deprecating src/utilities/subsetData.c in which case this is just one more reason to do so - although the utility only works for files with one location, it expects there to be a location column and then confirms that there is only one location.

Agreed. If no GSOC person picks that ticket up, I'm likely to do it soon so it stops nagging at me :-)

  • As suggested on Slack I only skimmed the tests to make sure they make sense!
    👍

@Alomir Alomir requested a review from dlebauer June 13, 2025 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants