Skip to content

write.config.SIPNET() errors when the soil_physics file has no depth dimension #4218

Open

Description

@madhavzanwar

Summary

write.config.SIPNET() logs a warning for a soil_physics file with no depth dimension ("No depth info was found in the soil file. Will use the default or user-specified soil depth") and then fails in the next line:

thickness <- 100
soilWHC_total <- soil_IC_list$vals["volume_fraction_of_water_in_soil_at_saturation"]*thickness

vals[...] with single brackets returns a list, so the multiplication fails. The branch that does have depth uses unlist() on the same value.

Reproduction

x <- list(vals = list(volume_fraction_of_water_in_soil_at_saturation = 0.4))
x$vals["volume_fraction_of_water_in_soil_at_saturation"] * 100
#> Error: non-numeric argument to binary operator

In write.config.SIPNET() this stops the whole config for a soil file such as a single-layer netCDF with volume_fraction_of_water_in_soil_at_saturation and no depth.

Proposed fix

Use [[ ]] (a one-character-pair change). I have a branch with a test that builds such a soil file; it errors on current develop and passes with the fix. Happy to send a PR if wanted.

Activity

  1. madhavzanwar commented on Nov 2, 2026

    @madhavzanwar
    ContributorAuthor

    @infotroph a fix and a test are ready: https://github.com/madhavzanwar/pecan/tree/GH-4218-sipnet-soilwhc-no-depth ([ ] to [[ ]]; the new test builds a soil file without a depth dimension, errors on develop, and passes with the fix). Happy to open the PR whenever you’d like.

  2. madhavzanwar commented on Nov 19, 2026

    @madhavzanwar
    ContributorAuthor

    @infotroph PR is up: #4258

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions