Skip to content
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

Add SoilMoistureProfile and SoilFreeThaw as git submodule in ngen ext… #412

Merged
merged 6 commits into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@
path = extern/evapotranspiration/evapotranspiration
url = https://github.com/NOAA-OWP/evapotranspiration.git
branch = master
[submodule "extern/SoilFreezeThaw/SoilFreezeThaw"]
path = extern/SoilFreezeThaw/SoilFreezeThaw
url = https://github.com/NOAA-OWP/SoilFreezeThaw
branch = master
[submodule "extern/SoilMoistureProfiles/SoilMoistureProfile"]
path = extern/SoilMoistureProfiles/SoilMoistureProfile
url = https://github.com/NOAA-OWP/SoilMoistureProfiles
Copy link
Contributor

Choose a reason for hiding this comment

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

This is likely to lead to confusion... let's make these all SoilMoistureProfiles (with an s), since that is apparently the name of the repo.

Copy link
Contributor

Choose a reason for hiding this comment

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

Notably, the submodule addition itself probably needs to be changed--I am not sure that just changing the path in this file will suffice...and I'm not sure how to otherwise edit it, it may need to be removed and re-added. (?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed and re-added SoilMoistureProfiles.

branch = main
19 changes: 19 additions & 0 deletions extern/SoilFreezeThaw/INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# SFT Submodule Library Build Instructions for use in the Next Generation Water Resources Modeling Framework

**These build instructions are specific to running SoilFreezeThaw in the [Next Generation Water Resources Modeling Framework](https://github.com/NOAA-OWP/ngen)**

First, cd into the outer directory containing the submodule:

cd extern/SoilFreezeThaw/SoilFreezeThaw

Before library files can be built, a CMake build system must be generated. E.g.:

cmake -B cmake_build -S .
Copy link
Contributor

Choose a reason for hiding this comment

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

Apparently for this module the command needs to be:

cmake -B cmake_build -S . -DNGEN=1

Otherwise the library tries to find cfe.c and fails to configure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added -DNGEN=1 for both SoilFreezeThaw and SoilMoistureProfiles INSTALL.md.


Note that when there is an existing directory, it may sometimes be necessary to clear it and regenerate, especially if any changes were made to the [CMakeLists.txt](CMakeLists.txt) file.

After there is build system directory, the shared library can be built using the `sftbmi` CMake target. For example, the SFT shared library file (i.e., the build config's `sftbmi` target) can be built using:

cmake --build cmake_build --target sftbmi -- -j 2

This will build a `cmake_build/libsftbmi.<version>.<ext>` file, where the version is configured within the CMake config, and the extension depends on the local machine's operating system.
50 changes: 50 additions & 0 deletions extern/SoilFreezeThaw/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# SFT Submodule

## About

This directory wraps the *sft* Git submodule repo, which contains a clone of the repo for the OWP SFT module library that implements BMI. From here, the shared library file for the SFT module can be built for use in NGen. This is configured with the [CMakeLists.txt](CMakeLists.txt) and other files in this outer directory.

#### Extra Outer Directory

Currently there are two directory layers beneath the top-level *extern/* directory. While this module has its CMakeLists.txt within the submodule, at present this extra directory exists primarily to be consistent with other modules which have their CMakeLists.txt files in the interstitial directory (this may change in the future).

## Working with the Submodule

Some simple explanations of several command actions are included below. To better understand what these things are doing, consult the [Git Submodule documentation](https://git-scm.com/book/en/v2/Git-Tools-Submodules).

### Getting the Latest Changes

There are two steps to getting upstream submodule changes fully
1. fetching and locally checking out the changes from the remote
2. committing the new checkout revision for the submodule

To fetch and check out the latest revision (for the [currently used branch](#viewing-the-current-branch)):

git submodule update --init -- extern/SoilFreezeThaw

To commit the current submodule checkout revision to the NGen repo:

git add extern/SoilFreezeThaw
git commit

### Viewing the Commit Hash

Git submodule configurations include the specific commit to be checked out (or an implicit default). The current commit can be view with `git submodule status`:

git submodule status -- extern/SoilFreezeThaw/

This will show the **commit**, **submodule local path**, and the git description for the **commit**. The specific configuration, including the configured branch, is set in the _.gitmodules_ file in the NGen project root.

### Changing the Commit Branch

The latest commit in the configured branch can be brought in as described here. If it is ever necessary to change to a different branch, the following will do so:

git config -f .gitmodules "submodule.extern/SoilFreezeThaw/SoilFreezeThaw.branch" <branchName>

Note that this will be done in the NGen repo configuration, so it can then be committed and push to remotes. It is also possible to do something similar in just the local clone of a repo, by configuring `.git/config` instead of `.gitmodules`. See the Git documentation for more on how that works if needed.

# Usage

## Building Libraries

The instructions on how to build the submodule libraries can be found in extern/SoilFreezeThaw/INSTALL.md after the submodule has been downloaded.
1 change: 1 addition & 0 deletions extern/SoilFreezeThaw/SoilFreezeThaw
Submodule SoilFreezeThaw added at 466be8
19 changes: 19 additions & 0 deletions extern/SoilMoistureProfiles/INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# SMP Submodule Library Build Instructions for use in the Next Generation Water Resources Modeling Framework

**These build instructions are specific to running SoilMoistureProfiles in the [Next Generation Water Resources Modeling Framework](https://github.com/NOAA-OWP/ngen)**

First, cd into the outer directory containing the submodule:

cd extern/SoilMoistureProfiles/SoilMoistureProfiles

Before library files can be built, a CMake build system must be generated. E.g.:

cmake -B cmake_build -S .

Note that when there is an existing directory, it may sometimes be necessary to clear it and regenerate, especially if any changes were made to the [CMakeLists.txt](CMakeLists.txt) file.

After there is build system directory, the shared library can be built using the `smpbmi` CMake target. For example, the SMP shared library file (i.e., the build config's `smpbmi` target) can be built using:

cmake --build cmake_build --target smpbmi -- -j 2

This will build a `cmake_build/libsmpbmi.<version>.<ext>` file, where the version is configured within the CMake config, and the extension depends on the local machine's operating system.
50 changes: 50 additions & 0 deletions extern/SoilMoistureProfiles/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# SMP Submodule

## About

This directory wraps the *smp* Git submodule repo, which contains a clone of the repo for the OWP SMP module library that implements BMI. From here, the shared library file for the SMP module can be built for use in NGen. This is configured with the [CMakeLists.txt](CMakeLists.txt) and other files in this outer directory.

#### Extra Outer Directory

Currently there are two directory layers beneath the top-level *extern/* directory. While this module has its CMakeLists.txt within the submodule, at present this extra directory exists primarily to be consistent with other modules which have their CMakeLists.txt files in the interstitial directory (this may change in the future).

## Working with the Submodule

Some simple explanations of several command actions are included below. To better understand what these things are doing, consult the [Git Submodule documentation](https://git-scm.com/book/en/v2/Git-Tools-Submodules).

### Getting the Latest Changes

There are two steps to getting upstream submodule changes fully
1. fetching and locally checking out the changes from the remote
2. committing the new checkout revision for the submodule

To fetch and check out the latest revision (for the [currently used branch](#viewing-the-current-branch)):

git submodule update --init -- extern/SoilMoistureProfiles

To commit the current submodule checkout revision to the NGen repo:

git add extern/SoilMoistureProfiles
git commit

### Viewing the Commit Hash

Git submodule configurations include the specific commit to be checked out (or an implicit default). The current commit can be view with `git submodule status`:

git submodule status -- extern/SoilMoistureProfiles/
mattw-nws marked this conversation as resolved.
Show resolved Hide resolved

This will show the **commit**, **submodule local path**, and the git description for the **commit**. The specific configuration, including the configured branch, is set in the _.gitmodules_ file in the NGen project root.

### Changing the Commit Branch

The latest commit in the configured branch can be brought in as described here. If it is ever necessary to change to a different branch, the following will do so:

git config -f .gitmodules "submodule.extern/SoilMoistureProfiles/SoilMoistureProfiles.branch" <branchName>

Note that this will be done in the NGen repo configuration, so it can then be committed and push to remotes. It is also possible to do something similar in just the local clone of a repo, by configuring `.git/config` instead of `.gitmodules`. See the Git documentation for more on how that works if needed.

# Usage

## Building Libraries

The instructions on how to build the submodule libraries can be found in extern/SoilMoistureProfiles/INSTALL.md after the submodule has been downloaded.
1 change: 1 addition & 0 deletions extern/SoilMoistureProfiles/SoilMoistureProfile
Submodule SoilMoistureProfile added at 0d8569