Skip to content

Unit conditions #83

Description

@msirodrigues

Hello Christoph,

Does SWATrunR allow to set conditions based on specific parameters? According to the Get Started page it should, however I'm not able to define specific parameter changes for channels or aquifers using the same syntax as described in the Get Started page. Whenever I try to run run_swatplus the function either returns a map() error in index 58, which holds changes for a .rte parameter:

Error in map():
ℹ In index: 58.
Caused by error in set_names():
! x must be a vector
Run rlang::last_trace() to see where the error occurred.

rlang::last_trace()
<error/purrr_error_indexed>
Error in map():
ℹ In index: 58.
Caused by error in set_names():
! x must be a vector


Backtrace:

  1. ├─SWATrunR::run_swatplus(...)
  2. │ └─SWATrunR:::setup_swatplus(...)
  3. │ └─... %>% bind_rows(.)
  4. ├─dplyr::bind_rows(.)
  5. │ └─rlang::list2(...)
  6. ├─purrr::map(., ~setup_calibration_cal(.x, unit_cons))
  7. │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
  8. │ ├─purrr:::with_indexed_errors(...)
  9. │ │ └─base::withCallingHandlers(...)
  10. │ ├─purrr:::call_with_cleanup(...)
  11. │ └─SWATrunR (local) .f(.x[[i]], ...)
  12. │ └─SWATrunR:::setup_calibration_cal(.x, unit_cons)
  13. │ └─SWATrunR:::add_obj(par_cal, par_def$unit, unit_cons$units[[par_def$file_name]])
  14. │ └─... %>% bind_rows()
  15. ├─dplyr::bind_rows(.)
  16. │ └─rlang::list2(...)
  17. ├─rlang::set_names(., "OBJ" %_% 1:length(.))
  18. └─rlang::abort(message = message)

rlang::last_trace()
<error/purrr_error_indexed>
Error in map():
ℹ In index: 58.
Caused by error in set_names():
! x must be a vector


Backtrace:

  1. ├─SWATrunR::run_swatplus(...)
  2. │ └─SWATrunR:::setup_swatplus(...)
  3. │ └─... %>% bind_rows(.)
  4. ├─dplyr::bind_rows(.)
  5. │ └─rlang::list2(...)
  6. ├─purrr::map(., ~setup_calibration_cal(.x, unit_cons))
  7. │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
  8. │ ├─purrr:::with_indexed_errors(...)
  9. │ │ └─base::withCallingHandlers(...)
  10. │ ├─purrr:::call_with_cleanup(...)
  11. │ └─SWATrunR (local) .f(.x[[i]], ...)
  12. │ └─SWATrunR:::setup_calibration_cal(.x, unit_cons)
  13. │ └─SWATrunR:::add_obj(par_cal, par_def$unit, unit_cons$units[[par_def$file_name]])
  14. │ └─... %>% bind_rows()
  15. ├─dplyr::bind_rows(.)
  16. │ └─rlang::list2(...)
  17. ├─rlang::set_names(., "OBJ" %_% 1:length(.))
  18. └─rlang::abort(message = message)

Or the script runs all the iterations in a blink of an eye.

Performing 1000 simulations on 4 cores:
Completed 1000 simulations in 4M 24S

count(qsim_cal$error_report)

A tibble: 1 × 1

  n
1 1000

Error_report prints the following error:
forrtl: severe (157): Program Exception - access violation <chr [27]>

Can you provide some guidance in this matter?

Thank you for your attention.

Best regards,
Miguel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions