Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Just added a minor check to
vic_init()
that for each cell,nNonzero <= nveg
, wherenNnonzero
is the number of veg tiles withCv > 0
.nveg
is allowed to be greater than this number due to potentially adding extra tiles for bare soil and above treeline vegetation. Butnveg
from the parameter file should never be less thannNonzero
.Also modified warning messages for when either
Cv
orroot_frac
don't sum to what we want them to. These messages now use format.16f
to show the user more precisely what the sum comes to.The motivation for this new check is that the logic for the mapping between
veg_con_map
andveg_con
relies only onCv
to decide if a veg tile is valid. Yet elsewhere in the code,nveg
is used. It's possible that these two quantities could get out of sync for a variety of reasons, which would result in assignment of unintended parameter values (from invalid tiles) to theveg_con
structure. This check avoids that and ensures internal consistency.