Commit c56f457d authored by David's avatar David
Browse files

fix: error on CreateInputsModel with node RunModel_Lag and area=NA

Refs #107
Showing with 7 additions and 5 deletions
+7 -5
......@@ -278,11 +278,13 @@ CreateOneGRiwrmInputsModel <- function(id, griwrm, ..., Qobs, Qmin) {
griwrm$area[UpstreamNodeRows],
node$area - sum(griwrm$area[UpstreamNodeRows], na.rm = TRUE)
)
if (BasinAreas[length(BasinAreas)] < 0) {
stop(sprintf(
"Area of the catchment %s must be greater than the sum of the areas of its upstream catchments",
id
))
if (!is.na(node$area)) {
if (BasinAreas[length(BasinAreas)] < 0) {
stop(sprintf(
"Area of the catchment %s must be greater than the sum of the areas of its upstream catchments",
id
))
}
}
names(BasinAreas) <- c(griwrm$id[UpstreamNodeRows], id)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment