From 331e38a0f512217c48f67e3fe9855bcc688b19d4 Mon Sep 17 00:00:00 2001 From: David LeBauer Date: Mon, 20 Oct 2025 12:44:38 -0700 Subject: [PATCH 1/7] document woodCreation as output --- docs/CHANGELOG.md | 2 ++ docs/user-guide/model-outputs.md | 50 +++++++++++++++++--------------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index fbe21f2d..f569559a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -13,6 +13,8 @@ sections to include in release notes: ### Added +- Add woodCreation to sipnet.out (#161) + ### Fixed ### Changed diff --git a/docs/user-guide/model-outputs.md b/docs/user-guide/model-outputs.md index bfc2bb90..b2887b02 100644 --- a/docs/user-guide/model-outputs.md +++ b/docs/user-guide/model-outputs.md @@ -16,40 +16,42 @@ The `sipnet.out` file contains a time series of state variables and fluxes from | 3 | | time | Hour-of-day (fractional) at start of timestep | hours | | 4 | | plantWoodC | Woody plant carbon | g C m$^{-2}$ | | 5 | | plantLeafC | Leaf carbon | g C m$^{-2}$ | -| 6 | | soil | (Single) soil organic carbon (or mineral soil C pool) | g C m$^{-2}$ | -| 7 | | microbeC | Microbial carbon (0 if microbes flag off) | g C m$^{-2}$ | -| 8 | | coarseRootC | Coarse root carbon | g C m$^{-2}$ | -| 9 | | fineRootC | Fine root carbon | g C m$^{-2}$ | -| 10 | | litter | Litter carbon (0 if litter pool disabled) | g C m$^{-2}$ | -| 11 | | soilWater | Soil water content | cm | -| 12 | $f_{\text{WHC}}$ | soilWetnessFrac | Soil water as fraction of holding capacity | unitless | -| 13 | | snow | Snow water equivalent | cm | -| 14 | | npp | Net primary production for timestep | g C m$^{-2}$ | -| 15 | | nee | Net ecosystem exchange (sign convention per code: - (NPP - RH)) | g C m$^{-2}$ | -| 16 | | cumNEE | Cumulative NEE since simulation start | g C m$^{-2}$ | -| 17 | $GPP$ | gpp | Gross primary production | g C m$^{-2}$ | -| 18 | | rAboveground | Aboveground autotrophic respiration (leaves + wood) | g C m$^{-2}$ | -| 19 | $R_H$ | rSoil | Heterotrophic respiration (maintenance + microbe terms per configuration) | g C m$^{-2}$ | -| 20 | | rRoot | Root (autotrophic) respiration | g C m$^{-2}$ | -| 21 | | ra | Total autotrophic respiration (rAboveground + rRoot) | g C m$^{-2}$ | -| 22 | | rh | Total heterotrophic respiration (litter + soil components) | g C m$^{-2}$ | -| 23 | $R$ | rtot | Total ecosystem respiration (ra + rh) | g C m$^{-2}$ | -| 24 | | evapotranspiration | ET (transpiration + immedEvap + evaporation + sublimation) for timestep | cm | -| 25 | | fluxestranspiration | Transpiration component only | cm | +| 6 | | woodCreation | Carbon allocated to wood during timestep | g C m$^{-2}$ | +| 7 | | soil | (Single) soil organic carbon (or mineral soil C pool) | g C m$^{-2}$ | +| 8 | | microbeC | Microbial carbon (0 if microbes flag off) | g C m$^{-2}$ | +| 9 | | coarseRootC | Coarse root carbon | g C m$^{-2}$ | +| 10 | | fineRootC | Fine root carbon | g C m$^{-2}$ | +| 11 | | litter | Litter carbon (0 if litter pool disabled) | g C m$^{-2}$ | +| 12 | | soilWater | Soil water content | cm | +| 13 | $f_{\text{WHC}}$ | soilWetnessFrac | Soil water as fraction of holding capacity | unitless | +| 14 | | snow | Snow water equivalent | cm | +| 15 | | npp | Net primary production for timestep | g C m$^{-2}$ | +| 16 | | nee | Net ecosystem exchange (sign convention per code: - (NPP - RH)) | g C m$^{-2}$ | +| 17 | | cumNEE | Cumulative NEE since simulation start | g C m$^{-2}$ | +| 18 | $GPP$ | gpp | Gross primary production | g C m$^{-2}$ | +| 19 | | rAboveground | Aboveground autotrophic respiration (leaves + wood) | g C m$^{-2}$ | +| 20 | $R_H$ | rSoil | Heterotrophic respiration (maintenance + microbe terms per configuration) | g C m$^{-2}$ | +| 21 | | rRoot | Root (autotrophic) respiration | g C m$^{-2}$ | +| 22 | | ra | Total autotrophic respiration (rAboveground + rRoot) | g C m$^{-2}$ | +| 23 | | rh | Total heterotrophic respiration (litter + soil components) | g C m$^{-2}$ | +| 24 | $R$ | rtot | Total ecosystem respiration (ra + rh) | g C m$^{-2}$ | +| 25 | | evapotranspiration | ET (transpiration + immedEvap + evaporation + sublimation) for timestep | cm | +| 26 | | fluxestranspiration | Transpiration component only | cm | + An example output file can be found in [tests/smoke/sipnet.out](https://github.com/PecanProject/sipnet/blob/master/tests/smoke/niwot/sipnet.out). ``` Notes: PlantWoodC, PlantLeafC, Soil and Litter in g C/m^2; Water and Snow in cm; SoilWetness is fraction of WHC; -year day time plantWoodC plantLeafC soil microbeC coarseRootC fineRootC litter litterWater soilWater soilWetnessFrac snow npp nee cumNEE gpp rAboveground rSoil rRoot ra rh rtot evapotranspiration fluxestranspiration -1998 305 0.00 5759.77 1133.88 16000.06 8.00 1919.90 1919.64 0.500 6.00 0.500 0.00 -0.32 0.74 0.74 0.00 0.164 0.578 0.159 0.324 0.419 0.742 0.00302126 0.0000 -1998 305 7.00 5759.63 1133.71 16000.08 8.00 1919.77 1919.10 0.500 5.99 0.500 0.00 -0.30 0.97 1.71 0.22 0.271 0.917 0.251 0.522 0.666 1.188 0.00240544 0.0022 -1998 305 17.00 5759.16 1133.48 16000.15 8.00 1919.57 1918.37 0.500 5.99 0.499 0.00 -0.67 1.56 3.27 0.00 0.338 1.219 0.335 0.673 0.884 1.557 0.00662149 0.0000 +year day time plantWoodC plantLeafC woodCreation soil microbeC coarseRootC fineRootC litter soilWater soilWetnessFrac snow npp nee cumNEE gpp rAboveground rSoil rRoot ra rh rtot evapotranspiration fluxestranspiration +1998 305 0.00 5759.77 1133.88 0.00 16000.06 0.00 1919.90 1919.64 0.00 6.00 0.500 0.00 -0.32 0.74 0.74 0.00 0.164 0.578 0.159 0.324 0.419 0.742 0.00302126 0.0000 +1998 305 7.00 5759.63 1133.71 0.00 16000.08 0.00 1919.77 1919.10 0.00 5.99 0.500 0.00 -0.30 0.97 1.71 0.22 0.271 0.917 0.251 0.522 0.666 1.188 0.00240544 0.0022 +1998 305 17.00 5759.16 1133.48 0.00 16000.15 0.00 1919.57 1918.37 0.00 5.99 0.499 0.00 -0.67 1.56 3.27 0.00 0.338 1.219 0.335 0.673 0.884 1.557 0.00662149 0.0000 ``` ## Events output From cd72ab4dbb4be64f8d9cde1f7699243f0bd5bcd8 Mon Sep 17 00:00:00 2001 From: David LeBauer Date: Thu, 30 Oct 2025 21:35:21 -0700 Subject: [PATCH 2/7] Add build and publish binaries to draft release action that is run when a version is tagged; bump actions to v4 --- .github/workflows/release.yml | 94 +++++++++++++++++++++++++++++++---- docs/CHANGELOG.md | 2 + 2 files changed, 86 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75a5b90c..eafd207b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,20 +6,94 @@ on: - 'v*.*.*' # Trigger on version tags jobs: - release: - runs-on: ubuntu-latest + build: + strategy: + matrix: + include: + - os: ubuntu-latest + artifact_os: ubuntu + binary_path: sipnet + - os: macos-latest + artifact_os: macos + binary_path: sipnet + - os: windows-latest + artifact_os: windows + binary_path: sipnet.exe + runs-on: ${{ matrix.os }} steps: - # Checkout the repository - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 + + - name: Setup MSYS2 toolchain + if: runner.os == 'Windows' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: >- + base-devel + mingw-w64-x86_64-toolchain + + - name: Build SIPNET (Ubuntu/MacOS) + if: runner.os != 'Windows' + run: make + shell: bash - # Build SIPNET binary - - name: Build SIPNET + - name: Build SIPNET (windows) + if: runner.os == 'Windows' run: make + shell: msys2 {0} + + - name: Prepare release binary (Ubuntu/MacOS) + if: runner.os != 'Windows' + shell: bash + run: | + tag="${GITHUB_REF_NAME}" + src="${{ matrix.binary_path }}" + dest="sipnet-${tag}-${{ matrix.artifact_os }}" + + if [ ! -f "$src" ]; then + echo "Expected build artifact '${src}' not found" >&2 + exit 1 + fi + + mkdir -p dist + mv "$src" "dist/${dest}" + + - name: Prepare release binary (windows) + if: runner.os == 'Windows' + shell: msys2 {0} + run: | + tag="${GITHUB_REF_NAME}" + src="${{ matrix.binary_path }}" + dest="sipnet-${tag}-${{ matrix.artifact_os }}" + + if [ ! -f "$src" ]; then + echo "Expected build artifact '${src}' not found" >&2 + exit 1 + fi + + mkdir -p dist + mv "$src" "dist/${dest}" + + - name: Upload release artifact + uses: actions/upload-artifact@v4 + with: + name: sipnet-${{ github.ref_name }}-${{ matrix.artifact_os }} + path: dist/sipnet-${{ github.ref_name }}-${{ matrix.artifact_os }} + if-no-files-found: error + + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download release artifacts + uses: actions/download-artifact@v4 + with: + path: dist + merge-multiple: true - # Create GitHub Release and Upload Asset - - name: Create Release and Upload Asset - id: create_release + - name: Create Release and Upload Assets uses: softprops/action-gh-release@v2 with: tag_name: ${{ github.ref_name }} @@ -27,6 +101,6 @@ jobs: body: | This release includes the latest SIPNET binary. draft: true # Create the release as a draft - files: ./sipnet # Path to the compiled binary + files: dist/* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f569559a..1c361f6e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -28,6 +28,8 @@ sections to include in release notes: ### Added +- Build and release binaries for MacOS and Windows on release (in addition to existing Linux builds) + ### Fixed ### Changed From 6a9d14c3ef5483a6ebf64f8217ddf956472a59f4 Mon Sep 17 00:00:00 2001 From: David LeBauer Date: Thu, 30 Oct 2025 21:39:57 -0700 Subject: [PATCH 3/7] Apply suggestion from @dlebauer --- docs/user-guide/model-outputs.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/user-guide/model-outputs.md b/docs/user-guide/model-outputs.md index 7e317e2e..2e9882e1 100644 --- a/docs/user-guide/model-outputs.md +++ b/docs/user-guide/model-outputs.md @@ -38,7 +38,6 @@ The `sipnet.out` file contains a time series of state variables and fluxes from | 25 | | evapotranspiration | ET (transpiration + immedEvap + evaporation + sublimation) for timestep | cm | | 26 | | fluxestranspiration | Transpiration component only | cm | | 27 | $N_\textrm{min}$ | minN | Soil mineral nitrogen | g N m$^{-2}$ | -