Skip to content

Reducer repeatedly prints out the same message #112

@jesse-dugan

Description

@jesse-dugan

Preliminary Checks

  • I have searched existing issues for a duplicate issue and I'm sure this is new.
  • I have read and followed the docs and still think this is a bug.
  • I am certain that this is an issue with grid-data-models (not my code or another library such as infrasys)

Description

This is more of an annoyance than a bug. When I call reduce_to_three_phase_system() or reduce_to_prinary_system() on a system, especially one that has open switches or edges that will be pruned during reduction, the terminal fills up with the same message over and over. This makes it hard to interpret the warnings.

This happens because _reduce_system in reducer.py calls get_subsystem for every node. get_subsystem (from distribution_system.py calls directed_graph.py, which logs a message every time it builds a directed graph or prunes an open switch or edge during reduction. This means that the same message is printed once for every node instead of just once.

Sample Code

from gdm.distribution import DistributionSystem
from gdmloader.source import SystemLoader
from gdmloader.constants import GCS_CASE_SOURCE
from gdm.distribution import reduce_to_primary_system
sys_loader = SystemLoader()
sys_loader.add_source(GCS_CASE_SOURCE)
sys = sys_loader.load_dataset(DistributionSystem, GCS_CASE_SOURCE.name, "p1rhs7_1247")
reduced_sys = reduce_to_primary_system(sys, name="p1rhs7_1247", agg_timeseries=False)

Python, GDM

gdm version: 2.1.4
dep_pkgs: infrasys-0.5.0 networkx-3.5
platform: Windows-10-10.0.26100-SP0
commit: unknown
python_version: 3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]
install_path: C:\Users\JDUGAN\Documents\GitHub\cadet-examples\.venv\Lib\site-packages\gdm

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpending

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions