From b0417018410a6a2a94eacbf6c4def54c4b083209 Mon Sep 17 00:00:00 2001 From: dguittet Date: Thu, 12 Jan 2023 11:49:12 -0700 Subject: [PATCH] del --- dispatches/tests/__init__.py | 0 dispatches/tests/data/__init__.py | 0 .../data/prescient_5bus/DAY_AHEAD_load.csv | 3 - .../prescient_5bus/DAY_AHEAD_renewables.csv | 3 - .../tests/data/prescient_5bus/README.md | 18 ---- .../data/prescient_5bus/REAL_TIME_load.csv | 3 - .../prescient_5bus/REAL_TIME_renewables.csv | 3 - .../tests/data/prescient_5bus/__init__.py | 0 .../tests/data/prescient_5bus/branch.csv | 3 - dispatches/tests/data/prescient_5bus/bus.csv | 3 - dispatches/tests/data/prescient_5bus/gen.csv | 3 - .../data/prescient_5bus/initial_status.csv | 3 - .../tests/data/prescient_5bus/reserves.csv | 3 - .../prescient_5bus/simulation_objects.csv | 3 - .../prescient_5bus/timeseries_pointers.csv | 3 - dispatches/tests/test_headers.py | 70 ------------ dispatches/tests/test_prescient.py | 102 ------------------ 17 files changed, 223 deletions(-) delete mode 100644 dispatches/tests/__init__.py delete mode 100644 dispatches/tests/data/__init__.py delete mode 100644 dispatches/tests/data/prescient_5bus/DAY_AHEAD_load.csv delete mode 100644 dispatches/tests/data/prescient_5bus/DAY_AHEAD_renewables.csv delete mode 100644 dispatches/tests/data/prescient_5bus/README.md delete mode 100644 dispatches/tests/data/prescient_5bus/REAL_TIME_load.csv delete mode 100644 dispatches/tests/data/prescient_5bus/REAL_TIME_renewables.csv delete mode 100644 dispatches/tests/data/prescient_5bus/__init__.py delete mode 100644 dispatches/tests/data/prescient_5bus/branch.csv delete mode 100644 dispatches/tests/data/prescient_5bus/bus.csv delete mode 100644 dispatches/tests/data/prescient_5bus/gen.csv delete mode 100644 dispatches/tests/data/prescient_5bus/initial_status.csv delete mode 100644 dispatches/tests/data/prescient_5bus/reserves.csv delete mode 100644 dispatches/tests/data/prescient_5bus/simulation_objects.csv delete mode 100644 dispatches/tests/data/prescient_5bus/timeseries_pointers.csv delete mode 100644 dispatches/tests/test_headers.py delete mode 100644 dispatches/tests/test_prescient.py diff --git a/dispatches/tests/__init__.py b/dispatches/tests/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/dispatches/tests/data/__init__.py b/dispatches/tests/data/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/dispatches/tests/data/prescient_5bus/DAY_AHEAD_load.csv b/dispatches/tests/data/prescient_5bus/DAY_AHEAD_load.csv deleted file mode 100644 index bf6f00282..000000000 --- a/dispatches/tests/data/prescient_5bus/DAY_AHEAD_load.csv +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:eddced4b395c27526995f3733dbb4ffc5f5f60ec61f1eb7ed24f749912e948ea -size 231999 diff --git a/dispatches/tests/data/prescient_5bus/DAY_AHEAD_renewables.csv b/dispatches/tests/data/prescient_5bus/DAY_AHEAD_renewables.csv deleted file mode 100644 index 4a18c3346..000000000 --- a/dispatches/tests/data/prescient_5bus/DAY_AHEAD_renewables.csv +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8fdad25003c952cc62ed0277b9d98a704215342c21c4b9fe5860e24450ff79f7 -size 269139 diff --git a/dispatches/tests/data/prescient_5bus/README.md b/dispatches/tests/data/prescient_5bus/README.md deleted file mode 100644 index 15a885052..000000000 --- a/dispatches/tests/data/prescient_5bus/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Notice about these data files - -The data files in this directory were originally developed as part of the -Prescient production cost modeling platform's -[5-bus test case](https://github.com/grid-parity-exchange/Prescient/tree/2.1/examples/5bus), -and is subject to Prescient's -[license and copyright](https://github.com/grid-parity-exchange/Prescient/tree/2.1/LICENSE.txt): - -> ================= -> Prescient -> Copyright 2020 National Technology & Engineering Solutions of Sandia, LLC -> (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. -> Government retains certain rights in this software. -> -> This software is distributed under the Revised BSD License (see below). -> Prescient also leverages a variety of third-party software packages, which -> have separate licensing policies. -> ================= \ No newline at end of file diff --git a/dispatches/tests/data/prescient_5bus/REAL_TIME_load.csv b/dispatches/tests/data/prescient_5bus/REAL_TIME_load.csv deleted file mode 100644 index 24068ab48..000000000 --- a/dispatches/tests/data/prescient_5bus/REAL_TIME_load.csv +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9d389487c11fb0e0371685f3f9353c83a51d66dbf6953990e43cad70edafc6fd -size 2888100 diff --git a/dispatches/tests/data/prescient_5bus/REAL_TIME_renewables.csv b/dispatches/tests/data/prescient_5bus/REAL_TIME_renewables.csv deleted file mode 100644 index 73489b838..000000000 --- a/dispatches/tests/data/prescient_5bus/REAL_TIME_renewables.csv +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7132b027438d1a9ae2adcc8f9e656d9cfcbd0fdf24603b342433792bc80a5791 -size 3641364 diff --git a/dispatches/tests/data/prescient_5bus/__init__.py b/dispatches/tests/data/prescient_5bus/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/dispatches/tests/data/prescient_5bus/branch.csv b/dispatches/tests/data/prescient_5bus/branch.csv deleted file mode 100644 index ef5c80546..000000000 --- a/dispatches/tests/data/prescient_5bus/branch.csv +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d75d2f71cc44bdd4fdb4f53f0fd42be96b0d1a3d1fc95331ea55905bd860662d -size 502 diff --git a/dispatches/tests/data/prescient_5bus/bus.csv b/dispatches/tests/data/prescient_5bus/bus.csv deleted file mode 100644 index a443ccf2b..000000000 --- a/dispatches/tests/data/prescient_5bus/bus.csv +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c0041edfa0590da0922ac29b8f3982eb166c1c1a643c80f9a72f0d2de4a8e621 -size 304 diff --git a/dispatches/tests/data/prescient_5bus/gen.csv b/dispatches/tests/data/prescient_5bus/gen.csv deleted file mode 100644 index bb884199b..000000000 --- a/dispatches/tests/data/prescient_5bus/gen.csv +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2b07523181d6cb8b4bc320ecbde4dc0331208b92219a83abda49cf6ab2d52159 -size 1202 diff --git a/dispatches/tests/data/prescient_5bus/initial_status.csv b/dispatches/tests/data/prescient_5bus/initial_status.csv deleted file mode 100644 index 1a25214ab..000000000 --- a/dispatches/tests/data/prescient_5bus/initial_status.csv +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:57de26be02a056367fad4a0c1da6d89b39404494aa407ef5864e28caf0dbd40a -size 52 diff --git a/dispatches/tests/data/prescient_5bus/reserves.csv b/dispatches/tests/data/prescient_5bus/reserves.csv deleted file mode 100644 index 0fcd999b7..000000000 --- a/dispatches/tests/data/prescient_5bus/reserves.csv +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4b97b720e09e6a664b34f9303d775b438bf22775f5b402cb0bc54786a29c05e2 -size 34 diff --git a/dispatches/tests/data/prescient_5bus/simulation_objects.csv b/dispatches/tests/data/prescient_5bus/simulation_objects.csv deleted file mode 100644 index 043aa6e2e..000000000 --- a/dispatches/tests/data/prescient_5bus/simulation_objects.csv +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0f96087816e89cb0014dd464d10cf6ad6832e915157a61d50122927845f7b766 -size 538 diff --git a/dispatches/tests/data/prescient_5bus/timeseries_pointers.csv b/dispatches/tests/data/prescient_5bus/timeseries_pointers.csv deleted file mode 100644 index 98e20f7f6..000000000 --- a/dispatches/tests/data/prescient_5bus/timeseries_pointers.csv +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bdee2aaa763cdc04b1f7cf19524995d7d24fde0512b3335dffcb5b7a01b64f99 -size 962 diff --git a/dispatches/tests/test_headers.py b/dispatches/tests/test_headers.py deleted file mode 100644 index 98ac12179..000000000 --- a/dispatches/tests/test_headers.py +++ /dev/null @@ -1,70 +0,0 @@ -################################################################################# -# DISPATCHES was produced under the DOE Design Integration and Synthesis -# Platform to Advance Tightly Coupled Hybrid Energy Systems program (DISPATCHES), -# and is copyright (c) 2022 by the software owners: The Regents of the University -# of California, through Lawrence Berkeley National Laboratory, National -# Technology & Engineering Solutions of Sandia, LLC, Alliance for Sustainable -# Energy, LLC, Battelle Energy Alliance, LLC, University of Notre Dame du Lac, et -# al. All rights reserved. -# -# Please see the files COPYRIGHT.md and LICENSE.md for full copyright and license -# information, respectively. Both files are also available online at the URL: -# "https://github.com/gmlc-dispatches/dispatches". -# -################################################################################# -""" -Test that headers are on all files -""" -# stdlib -from pathlib import Path -import os - -import pytest - -pytest.importorskip("addheader", reason="addheader (optional dev. dependency) not available") - -# third-party -from addheader.add import FileFinder, detect_files -import yaml - - -@pytest.fixture -def package_root(): - """Determine package root. - """ - import dispatches - return Path(dispatches.__file__).parent - - -@pytest.fixture -def patterns(package_root): - """Grab glob patterns from config file. - """ - conf_file = package_root.parent / ".addheader.yml" - if not conf_file.exists(): - print(f"Cannot load configuration file from '{conf_file}'. Perhaps this is not development mode?") - return None - with open(conf_file) as f: - conf_data = yaml.safe_load(f) - print(f"Patterns for finding files with headers: {conf_data['patterns']}") - return conf_data["patterns"] - - -@pytest.mark.unit -def test_headers(package_root, patterns): - if patterns is None: - print(f"ERROR: Did not get glob patterns: skipping test") - else: - # modify patterns to match the files that should have headers - ff = FileFinder(package_root, glob_patterns=patterns) - has_header, missing_header = detect_files(ff) - # ignore empty files (probably should add option in 'detect_files' for this) - nonempty_missing_header = list(filter(lambda p: p.stat().st_size > 0, missing_header)) - # - if len(nonempty_missing_header) > 0: - pfx = str(package_root.resolve()) - pfx_len = len(pfx) - file_list = ", ".join([str(p)[pfx_len + 1:] for p in nonempty_missing_header]) - print(f"Missing headers from files under '{pfx}{os.path.sep}': {file_list}") - # uncomment to require all files to have headers - assert len(nonempty_missing_header) == 0 diff --git a/dispatches/tests/test_prescient.py b/dispatches/tests/test_prescient.py deleted file mode 100644 index dc6544513..000000000 --- a/dispatches/tests/test_prescient.py +++ /dev/null @@ -1,102 +0,0 @@ -################################################################################# -# DISPATCHES was produced under the DOE Design Integration and Synthesis -# Platform to Advance Tightly Coupled Hybrid Energy Systems program (DISPATCHES), -# and is copyright (c) 2022 by the software owners: The Regents of the University -# of California, through Lawrence Berkeley National Laboratory, National -# Technology & Engineering Solutions of Sandia, LLC, Alliance for Sustainable -# Energy, LLC, Battelle Energy Alliance, LLC, University of Notre Dame du Lac, et -# al. All rights reserved. -# -# Please see the files COPYRIGHT.md and LICENSE.md for full copyright and license -# information, respectively. Both files are also available online at the URL: -# "https://github.com/gmlc-dispatches/dispatches". -# -################################################################################# - -import importlib -from numbers import Number -from pathlib import Path -from typing import Dict, Union, List - -import pytest -import pandas as pd - - -prescient_simulator = pytest.importorskip("prescient.simulator", reason="Prescient (gridx-prescient) not available") - - -@pytest.fixture(scope="module") -def base_dir() -> Path: - pkg_init_path = Path(importlib.util.find_spec("dispatches.tests.data").origin) - return pkg_init_path.parent - - -# define custom type for type hinting -PrescientOptions = Dict[str, Union[str, bool, Number, dict]] - - -class Test5Bus: - "Simple test using 5bus use case" - - @pytest.fixture - def data_path(self, base_dir: Path) -> Path: - return base_dir / "prescient_5bus" - - @pytest.mark.unit - def test_data_path_available(self, data_path: Path): - assert data_path.is_dir() - - @pytest.fixture - def output_dir(self, tmp_path: Path) -> Path: - path = tmp_path / "5bus_output" - path.mkdir() - return path - - @pytest.fixture - def prescient_options(self, data_path: Path, output_dir: Path) -> PrescientOptions: - return { - "data_path": str(data_path), - "input_format":"rts-gmlc", - "simulate_out_of_sample":True, - "run_sced_with_persistent_forecast_errors":True, - "output_directory": str(output_dir), - "start_date":"07-10-2020", - "num_days":2, - "sced_horizon":1, - "ruc_mipgap":0.01, - "reserve_factor":0.1, - "deterministic_ruc_solver":"cbc", - "deterministic_ruc_solver_options":{"feas":"off", "DivingF":"on",}, - "sced_solver":"cbc", - "sced_frequency_minutes":60, - "ruc_horizon":36, - "compute_market_settlements":True, - "monitor_all_contingencies":False, - "output_solver_logs":False, - "price_threshold":1000, - "contingency_price_threshold":100, - "reserve_price_threshold":5, - } - - @pytest.fixture - def run_simulator(self, prescient_options: PrescientOptions) -> None: - from prescient.simulator import Prescient - - sim = Prescient() - sim.simulate(**prescient_options) - - @pytest.fixture - def simulation_results_table( - self, - run_simulator, - output_dir: Path, - name: str = "overall_simulation_output.csv" - ) -> pd.DataFrame: - - path = output_dir / name - return pd.read_csv(path) - - @pytest.mark.component - # TODO use a more specific test to validate simulation output - def test_simulation_results(self, simulation_results_table: pd.DataFrame): - assert not simulation_results_table.empty