Deltares / Deltares/imod-python
points_set_values does not work for a datetime coordinate
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 41
- Forks
- 12
- Avg merge
- 21h 8m
- Merged PRs (30d)
- 1
Description
In GitLab by @jdelsman on Aug 31, 2020, 17:03
Trying to set point_values in a (time,layer,y,x) dataarray, I get the following error:
Traceback (most recent call last):
File "", line 7, in
File "c:\Users\delsman\Documents\imod-python\imod\select\points.py", line 241, in points_set_values
inside = points_in_bounds(da, **points)
File "c:\Users\delsman\Documents\imod-python\imod\select\points.py", line 62, in points_in_bounds
_, xmin, xmax = imod.util.coord_reference(da_x)
File "c:\Users\delsman\Documents\imod-python\imod\util.py", line 341, in coord_reference
dxs = np.diff(x.astype(np.float64))
ValueError: could not convert string to float: '2051-10-01 00:00:00'
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in imod/select/points.py at points_set_values and points_in_bounds, then inspect imod/util.py at coord_reference, where the traceback shows datetime values are converted to float. Reproduce the failure with a (time,layer,y,x) dataarray and confirm that setting point values with a datetime coordinate completes without the conversion error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100