Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Working with GDMLOADER

GDMLOADER is a helper package designed to simplify downloading and loading example distribution system models into your workspace. It provides convenience functions for retrieving prebuilt test cases, allowing you to focus on using the models rather than building them from scratch.

First, we will add sources to SystemLoader and explore the available test cases.

Setting Up Data Source

from gdmloader.constants import GCS_CASE_SOURCE
from gdmloader.source import SystemLoader

gdm_loader = SystemLoader()
gdm_loader.add_source(GCS_CASE_SOURCE)
gdm_loader.show_sources()
Loading...

Viewing Available Models

Sources are designed to support all systems in GDM, including DistributionSystem, CatalogSystem, and StructuralSystem. You can view all available models hosted by the source using the show_dataset_by_source method.

gdm_loader.show_dataset_by_source("gdm_data")

Alternatively, models for a specific system can be viewed using the show_dataset_by_system method.

gdm_loader.show_dataset_by_system("DistributionSystem", "gdm_data")

Downloading case files

Users can download specific models using the load_dataset method.

from gdm.distribution import DistributionSystem
from gdmloader.constants import GCS_CASE_SOURCE
from gdmloader.source import SystemLoader

gdm_loader = SystemLoader()
gdm_loader.add_source(GCS_CASE_SOURCE)

distribution_system: DistributionSystem = gdm_loader.load_dataset(
    system_type=DistributionSystem,
    source_name=GCS_CASE_SOURCE.name,
    dataset_name="p5r",
)

Downloaded models are cached on the local machine for improved performance. Users can view system information using the info method on the system instance.

distribution_system.name = "P5R"
distribution_system.info()
Loading...
Loading...
Loading...