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) { ...@@ -278,11 +278,13 @@ CreateOneGRiwrmInputsModel <- function(id, griwrm, ..., Qobs, Qmin) {
griwrm$area[UpstreamNodeRows], griwrm$area[UpstreamNodeRows],
node$area - sum(griwrm$area[UpstreamNodeRows], na.rm = TRUE) node$area - sum(griwrm$area[UpstreamNodeRows], na.rm = TRUE)
) )
if (BasinAreas[length(BasinAreas)] < 0) { if (!is.na(node$area)) {
stop(sprintf( if (BasinAreas[length(BasinAreas)] < 0) {
"Area of the catchment %s must be greater than the sum of the areas of its upstream catchments", stop(sprintf(
id "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) 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