eWaterCycle / ewatercycle

Python package for running hydrological models
https://ewatercycle.readthedocs.io/en/latest/
Apache License 2.0
35 stars 5 forks source link

coords_to_indices requires iterable #280

Open jeromaerts opened 2 years ago

jeromaerts commented 2 years ago

Based on student feedback:

Can we make it possible to pass non-iterables and iterables to the function coords_to_indices?

https://github.com/eWaterCycle/ewatercycle/blob/71bcc306b2ad2dfa224e793a3a9c30595174bbc5/src/ewatercycle/models/wflow.py#L182-L184

BSchilperoort commented 8 months ago

This could be addressed by modifying set_value_at_coords so it can take either a float or Interable[float], and turning the floats into a tuple of floats before passing to _coords_to_indices.

https://github.com/eWaterCycle/ewatercycle/blob/a8fe6e577d6696fbe5f66599de4a26dc3dab637c/src/ewatercycle/base/model.py#L213C9-L213C28