eWaterCycle / eWaterCycle/ewatercycle-hype

Confusing parameter set path configuration in the `model.ipynb`

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

The following path configuration is quite misleading. The code seems to ask user to give the correct path to unzipped `demo` folder and then everything would work.

https://github.com/eWaterCycle/ewatercycle-hype/blob/1f7599e82591ffe2552bb3af1f0172405caa75c4/docs/model.ipynb#L57-L62

But this will end up with an error in the next cell:

```py
model = ewatercycle.models.Hype(version="feb2021", parameter_set=parameter_set)

---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Cell In[4], line 1
----> 1 model = ewatercycle.models.Hype(version="feb2021", parameter_set=parameter_set)

[... skipping hidden 1 frame]

File /opt/conda/envs/ewatercycle/lib/python3.10/site-packages/ewatercycle_hype/model.py:45, in Hype._initialize_config(self)
42 @model_validator(mode="after")
43 def _initialize_config(self: "Hype") -> "Hype":
44 """Load config from parameter set and update with forcing info."""
---> 45 self._config = self.parameter_set.config.read_text(encoding="cp437")
47 start = _get_hype_time(_get_code_in_cfg(self._config, "bdate"))
48 end = _get_hype_time(_get_code_in_cfg(self._config, "edate"))

File /opt/conda/envs/ewatercycle/lib/python3.10/pathlib.py:1132, in Path.read_text(self, encoding, errors)
1128 """
1129 Open the file in text mode, read it, and close the file.
1130 """
1131 encoding = io.text_encoding(encoding)
-> 1132 with self.open(mode='r', encoding=encoding, errors=errors) as f:
1133 return f.read()

File /opt/conda/envs/ewatercycle/lib/python3.10/pathlib.py:1117, in Path.open(self, mode, buffering, encoding, errors, newline)
1115 if "b" not in mode:
1116 encoding = io.text_encoding(encoding)
-> 1117 return self._accessor.open(self, mode, buffering, encoding, errors,
1118 newline)

FileNotFoundError: [Errno 2] No such file or directory: 'info.txt'
```

Actually, user also needs to change `config="info.txt"` to `config=parameter_set_dir + "info.txt"`. It is necessary to make it clear.

Contributor guide

No contributing guide indexed for this repository

Research direction

Open docs/model.ipynb around lines 57-62 and inspect how the parameter-set path and config value are presented. Rerun the following model-initialization cell with an unzipped demo folder; done means the notebook instructions lead to a successful initialization without the info.txt FileNotFoundError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.