Limit read_excel() to existing elements for set 'year' etc.
- Dominant language
- Jupyter Notebook
- Stars
- 150
- Forks
- 178
- Avg merge
- 17h 32m
- Merged PRs (30d)
- 2
Description
`read_excel` allows the upload of data for years not defined in the scenario, this creates issues and therefore either the data-upload should be rejected or a new scenario with additional timesteps using the function `add_year` should be created.
If a scenario has the years defined:
```
scen.set('year').tolist()
# This yields
[1960, 1970, 1980, 1990, 1995, 2000, 2005, 2010, 2015, 2020, 2025, 2030, 2035, 2040, 2045, 2050, 2060, 2070, 2080, 2090, 2100, 2110]
```
And an data is added using the function `read_excel`:
```
scen.read_excel(', add_units=True, init_items=True)
# And then the duration_period parameter is retrieved, the following is the result
year value unit
0 1970 10.0 y
1 1980 10.0 y
2 1990 10.0 y
3 1995 5.0 y
4 2000 5.0 y
5 2005 5.0 y
6 2010 5.0 y
7 2015 5.0 y
8 2020 5.0 y
9 2025 5.0 y
10 2030 5.0 y
11 2035 5.0 y
12 2040 5.0 y
13 2045 5.0 y
14 2050 5.0 y
15 2060 10.0 y
16 2070 10.0 y
17 2080 10.0 y
18 2090 10.0 y
19 2100 10.0 y
20 2110 10.0 y
21 1960 10.0 y
22 1955 5.0 y
23 1965 10.0 y
24 1975 10.0 y
25 1985 10.0 y
26 2055 70.0 y
27 1950 -160.0 y
```
Contributor guide
Research direction
Start at the read_excel() entry point and compare uploaded year elements with scen.set('year'). The issue also references add_year; determine the intended handling for undefined years, then add coverage showing that read_excel rejects or handles those elements consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design, data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100