MeteoGridCopy dump fails when initialized with pathlib.Path
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
Start with MeteoGridCopy initialization through MetaSwapModel.from_file(), then follow dump() to the dataset.to_netcdf() call. Reproduce the failure with a pathlib.Path and verify that dumping succeeds with the path serialized as a string.
Written by the indexing model from the issue text.
Description
MeteoGridCopy is initialsed with pathlib.Path object when using MetaSwapModel.from_file(). During dump(), the package is serialized using dataset.to_netcdf(). Xarray cannot serialize pathlib.Path objects and raises the exception 'ValueError: unable to infer dtype on variable 'path'; xarray cannot serialize arbitrary Python objects'.
Proposed fix:
force to string via self.dataset["path"] = str(path)
This worked for me
- Dominant language
- Python
- Stars
- 41
- Forks
- 11
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
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.
More from Deltares/imod-python
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Deltares/imod-python#1843 ·
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 68/100
Deltares/imod-python#1684 ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Deltares/imod-python#1923 ·
-
refactor
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Deltares/imod-python#1921 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Deltares/imod-python#1911 ·
All issues in Deltares/imod-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
PedestrianDynamics/pyFDS-Evac#343 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
theskumar/python-dotenv#708 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 2 days
-
Docs Timedelta
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
pandas-dev/pandas#69919 ·
Maintainers usually reply within 1 day
-
API documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
zephyrproject-rtos/west#1009 · 2 comments ·
Maintainers usually reply within 3 days