NatLabRockies / NatLabRockies/GridAnalysisToolkit
Constructing any scenario handler with no data source crashes instead of returning a usable empty object
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
PlexosScenario() — zero arguments, no simulation_files — raises AttributeError: 'NoneType' object has no attribute 'get_metadata' instead of succeeding. Confirmed pre-existing on main, unrelated to #22/the tilde-path fix (that fix's new FileNotFoundError correctly does not fire here, since no input was given at all — this is a distinct code path).
Repro
from gat.scenariohandlers import PlexosScenario
PlexosScenario() # AttributeError, not a usable empty scenario
Root cause
BaseScenario.__init__ (src/gat/scenariohandlers/base.py) unconditionally computes:
self._tech_map = self.generator_technology_map
with no guard for 'no parser / no data source was ever provided.' For PlexosScenario, generator_technology_map is a @property that dereferences self.parser.get_metadata(...) — and self.parser is None whenever no solution files were given (a documented, legitimate case per the constructor's simulation_files: Optional[...] signature — e.g. 'construct now, attach data later' workflows).
Scope note
This likely affects every handler (Sienna, ReEDS, EGRET), not just Plexos — each has its own generator_technology_map implementation that may or may not tolerate a missing parser. Fixing it properly means either (a) making each handler's generator_technology_map null-safe (return {} when there's no data), or (b) having BaseScenario.__init__ skip tech-map computation when no data source is present — and auditing each subclass's 'do I have data' signal, since they may differ (self.parser, self._backend, etc.). Left unscoped here deliberately — needs its own investigation across all four handlers rather than a one-line patch.
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 with the zero-argument PlexosScenario() reproduction and read src/gat/scenariohandlers/base.py, especially BaseScenario.init. Then inspect each handler's generator_technology_map and data-source signal for Plexos, Sienna, ReEDS, and EGRET. Done means all handlers can be constructed without input and expose a usable empty scenario without dereferencing a missing parser or backend.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100