From 1ba5279040f19583af3ad2cf6d63fc0ff5766a61 Mon Sep 17 00:00:00 2001 From: Charles Graham Date: Fri, 7 Feb 2025 16:28:48 -0600 Subject: [PATCH 01/19] Initial turbines GET source --- cwms/__init__.py | 1 + cwms/turbines/turbines.py | 83 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 cwms/turbines/turbines.py diff --git a/cwms/__init__.py b/cwms/__init__.py index 8fc70e22..174e0673 100644 --- a/cwms/__init__.py +++ b/cwms/__init__.py @@ -25,6 +25,7 @@ from cwms.timeseries.timeseries_profile_instance import * from cwms.timeseries.timeseries_profile_parser import * from cwms.timeseries.timeseries_txt import * +from cwms.turbines import * try: __version__ = version("cwms-python") diff --git a/cwms/turbines/turbines.py b/cwms/turbines/turbines.py new file mode 100644 index 00000000..6299e054 --- /dev/null +++ b/cwms/turbines/turbines.py @@ -0,0 +1,83 @@ +from datetime import datetime +from typing import Optional + +import cwms.api as api +from cwms.cwms_types import Data + + +def get_projects_turbines(office: str, projectId: str) -> Data: + '''Returns matching CWMS Turbine Data for a Reservoir Project. Get cwmsData projects turbines. + Args: + office (str): The office associated with the turbine data. + projectId (str): The ID of the project. + Returns: + dict: A dictionary containing the turbine data. + ''' + endpoint = "projects/turbines" + params = { + "office": office, + "projectId": projectId + } + + response = api.get(endpoint=endpoint, params=params) + + return Data(response) + +def get_projects_turbines_with_name(office: str, name: str) -> Data: + '''Returns CWMS Turbine Data Get cwmsData projects turbines with name. + Args: + office (str): The office associated with the turbine data. + name (str): The name of the turbine. + Returns: + dict: A dictionary containing the turbine data. + ''' + endpoint = "projects/turbines" + params = { + "office": office, + "name": name + } + response = api.get(endpoint=endpoint, params=params) + return Data(response) + +def get_projects_turbines_with_office_with_name_turbine_changes( + name: str, + begin: datetime, + end: datetime, + office: str, + page_size: Optional[int], + unit_system: Optional[dict], + start_time_inclusive: Optional[bool], + end_time_inclusive: Optional[bool] +) -> Data: + """ + Returns CWMS Turbine Data for projects with specified office and turbine name changes within a given time range. + Args: + begin (str): The start date and time for the data retrieval in ISO 8601 format. + end (str): The end date and time for the data retrieval in ISO 8601 format. + end_time_inclusive (Optional[bool]): Whether the end time is inclusive. + name (str): The name of the turbine. + office (str): The office associated with the turbine data. + page_size (Optional[int]): The number of records to return per page. + start_time_inclusive (Optional[bool]): Whether the start time is inclusive. + unit_system (Optional[dict]): The unit system to use for the data [SI, EN]. + Returns: + dict: A dictionary containing the turbine data. + """ + if begin and not isinstance(begin, datetime): + raise ValueError("begin needs to be in datetime") + if end and not isinstance(end, datetime): + raise ValueError("end needs to be in datetime") + + endpoint = "projects/turbines" + params = { + "name": name, + "begin": begin.isoformat() if begin else None, + "end": end.isoformat() if end else None, + "office": office, + "page-size": page_size, + "unit-system": unit_system, + "start-time-inclusive": start_time_inclusive, + "end-time-inclusive": end_time_inclusive + } + response = api.get(endpoint=endpoint, params=params) + return Data(response) \ No newline at end of file From 0d3cd7e94ab8d5a697e375c51fc5327aeed62749 Mon Sep 17 00:00:00 2001 From: Charles Graham Date: Fri, 7 Feb 2025 16:28:59 -0600 Subject: [PATCH 02/19] Setup tests for turbines, not tested --- tests/resources/turbines.json | 58 + tests/resources/turbines_name.json | 28 + tests/resources/turbines_office_name.json | 2642 +++++++++++++++++++++ tests/turbines/turbines_test.py | 99 + 4 files changed, 2827 insertions(+) create mode 100644 tests/resources/turbines.json create mode 100644 tests/resources/turbines_name.json create mode 100644 tests/resources/turbines_office_name.json create mode 100644 tests/turbines/turbines_test.py diff --git a/tests/resources/turbines.json b/tests/resources/turbines.json new file mode 100644 index 00000000..588a932e --- /dev/null +++ b/tests/resources/turbines.json @@ -0,0 +1,58 @@ +[ + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "location": { + "office-id": "SWT", + "name": "KEYS-Turbine1", + "latitude": 36.1506371, + "longitude": -96.2525088, + "active": true, + "public-name": "Turbine1", + "long-name": "Turbine1", + "timezone-name": "US/Central", + "location-kind": "TURBINE", + "nation": "US", + "state-initial": "OK", + "county-name": "Tulsa", + "nearest-city": "Sand Springs, OK", + "horizontal-datum": "NAD83", + "published-longitude": 0, + "published-latitude": 0, + "vertical-datum": "NGVD29", + "elevation": 0, + "bounding-office-id": "SWT", + "elevation-units": "m" + } + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "location": { + "office-id": "SWT", + "name": "KEYS-Turbine2", + "latitude": 36.1506371, + "longitude": -96.2525088, + "active": true, + "public-name": "Turbine2", + "long-name": "Turbine2", + "timezone-name": "US/Central", + "location-kind": "TURBINE", + "nation": "US", + "state-initial": "OK", + "county-name": "Tulsa", + "nearest-city": "Sand Springs, OK", + "horizontal-datum": "NAD83", + "published-longitude": 0, + "published-latitude": 0, + "vertical-datum": "NGVD29", + "elevation": 0, + "bounding-office-id": "SWT", + "elevation-units": "m" + } + } + ] \ No newline at end of file diff --git a/tests/resources/turbines_name.json b/tests/resources/turbines_name.json new file mode 100644 index 00000000..9fbae703 --- /dev/null +++ b/tests/resources/turbines_name.json @@ -0,0 +1,28 @@ +{ + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "location": { + "office-id": "SWT", + "name": "KEYS-Turbine1", + "latitude": 36.1506371, + "longitude": -96.2525088, + "active": true, + "public-name": "Turbine1", + "long-name": "Turbine1", + "timezone-name": "US/Central", + "location-kind": "TURBINE", + "nation": "US", + "state-initial": "OK", + "county-name": "Tulsa", + "nearest-city": "Sand Springs, OK", + "horizontal-datum": "NAD83", + "published-longitude": 0, + "published-latitude": 0, + "vertical-datum": "NGVD29", + "elevation": 0, + "bounding-office-id": "SWT", + "elevation-units": "m" + } + } \ No newline at end of file diff --git a/tests/resources/turbines_office_name.json b/tests/resources/turbines_office_name.json new file mode 100644 index 00000000..650651b5 --- /dev/null +++ b/tests/resources/turbines_office_name.json @@ -0,0 +1,2642 @@ +[ + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738713600000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.12 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738717200000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.12 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738720800000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.13 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738724400000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.13 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738728000000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.15 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738731600000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.1399999999999 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738735200000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.15 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738738800000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.15 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738742400000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.18 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738746000000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.1699999999998 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738749600000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.18 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738753200000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.18 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738756800000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.18 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738760400000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.19 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738764000000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.1999999999999 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738767600000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.1999999999999 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738771200000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.76, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.22 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738774800000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.76, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.21 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738778400000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.76, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.2299999999999 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738782000000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.76, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.22 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738785600000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.76, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.2299999999999 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738789200000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.2299999999999 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738792800000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.24 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738796400000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.25 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738800000000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.25 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738803600000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.2599999999999 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738807200000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.27 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738810800000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.27 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738814400000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.27 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738818000000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.27 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738821600000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.28 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738825200000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.28 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738828800000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.2899999999998 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738832400000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.2899999999998 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738836000000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.27 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738839600000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.32 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738843200000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.3299999999999 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738846800000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.34 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738850400000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.34 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738854000000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.35 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738857600000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.74, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.37 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738861200000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.74, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.38 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738864800000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.74, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.3899999999999 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738868400000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.74, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.3899999999999 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738872000000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.74, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.3899999999999 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738875600000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.3899999999999 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738879200000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 + } + ], + "pool-elevation": 723.3899999999999 + }, + { + "project-id": { + "office-id": "SWT", + "name": "KEYS" + }, + "change-date": 1738882800000, + "protected": false, + "discharge-computation-type": { + "office-id": "SWT", + "display-value": "R", + "tooltip": "Reported by powerhouse", + "active": true + }, + "reason-type": { + "office-id": "SWT", + "display-value": "S", + "tooltip": "Scheduled release to meet loads", + "active": true + }, + "notes": "from SCADA", + "new-total-discharge-override": 800, + "old-total-discharge-override": 800, + "discharge-units": "cfs", + "tailwater-elevation": 637.8, + "elevation-units": "ft", + "settings": [ + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 400, + "new-discharge": 400, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 2 + }, + { + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 400, + "new-discharge": 400, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 2 + } + ], + "pool-elevation": 723.37 + } + ] \ No newline at end of file diff --git a/tests/turbines/turbines_test.py b/tests/turbines/turbines_test.py new file mode 100644 index 00000000..b109314d --- /dev/null +++ b/tests/turbines/turbines_test.py @@ -0,0 +1,99 @@ +# Copyright (c) 2024 +# United States Army Corps of Engineers - Hydrologic Engineering Center (USACE/HEC) +# All Rights Reserved. USACE PROPRIETARY/CONFIDENTIAL. +# Source may not be released without written approval from HEC + +import pandas as pd +import pytest + +import cwms.api +from cwms import turbines +from tests._test_utils import read_resource_file + +_MOCK_ROOT = "https://mockwebserver.cwms.gov" +_TURBINES = read_resource_file("turbines.json") +_TURBINES_NAME = read_resource_file("turbines_name.json") +_TURBINES_OFFICE_NAME = read_resource_file("turbines_office_name.json") + + +@pytest.fixture(autouse=True) +def init_session(): + cwms.api.init_session(api_root=_MOCK_ROOT) + +def test_get_projects_turbines(requests_mock): + requests_mock.get( + f"{_MOCK_ROOT}/projects/turbines?project-id=KEYS&office=SWT", + json=_TURBINES, + ) + + office_id = "SWT" + name = "Test.Turbine" + + data = turbines.get_projects_turbines(name=name, office_id=office_id) + + assert data.json == _TURBINES + assert type(data.df) is pd.DataFrame + assert "turbine-id" in data.df.columns + assert data.df.shape == (1, 7) + values = data.df.to_numpy().tolist() + assert values[0] == [ + "SWT", + "Test.Turbine", + "Test Turbine", + "Test Turbine Description", + 0.0, + 0.0, + 0.0, + ] + +def test_get_projects_turbines_by_name(requests_mock): + requests_mock.get( + f"{_MOCK_ROOT}/projects/turbines/KEYS-Turbine1&office=SWT", + json=_TURBINES_NAME, + ) + + office_id = "SWT" + name = "Test.Turbine" + + data = turbines.get_projects_turbines_with_name(name=name, office_id=office_id) + + assert data.json == _TURBINES + assert type(data.df) is pd.DataFrame + assert "turbine-id" in data.df.columns + assert data.df.shape == (1, 7) + values = data.df.to_numpy().tolist() + assert values[0] == [ + "SWT", + "Test.Turbine", + "Test Turbine", + "Test Turbine Description", + 0.0, + 0.0, + 0.0, + ] + +def test_get_projects_turbines_by_office_name(requests_mock): + requests_mock.get( + f"{_MOCK_ROOT}/projects/SWT/KEYS/turbines-changes", + json=_TURBINES_OFFICE_NAME, + ) + + office_id = "SWT" + name = "Test.Turbine" + + data = turbines.get_projects_turbines_with_office_with_name_turbine_changes(name=name, office_id=office_id) + + assert data.json == _TURBINES + assert type(data.df) is pd.DataFrame + assert "turbine-id" in data.df.columns + assert data.df.shape == (1, 7) + values = data.df.to_numpy().tolist() + assert values[0] == [ + "SWT", + "Test.Turbine", + "Test Turbine", + "Test Turbine Description", + 0.0, + 0.0, + 0.0, + ] From db307cbb71d0ff53b3980ffe61e84106056d8700 Mon Sep 17 00:00:00 2001 From: "Charles Graham, SWT" Date: Sun, 9 Feb 2025 23:26:33 -0600 Subject: [PATCH 03/19] Alter turbine test for expected payload --- tests/turbines/turbines_test.py | 97 +++++++++------------------------ 1 file changed, 25 insertions(+), 72 deletions(-) diff --git a/tests/turbines/turbines_test.py b/tests/turbines/turbines_test.py index b109314d..d981b254 100644 --- a/tests/turbines/turbines_test.py +++ b/tests/turbines/turbines_test.py @@ -1,99 +1,52 @@ -# Copyright (c) 2024 -# United States Army Corps of Engineers - Hydrologic Engineering Center (USACE/HEC) -# All Rights Reserved. USACE PROPRIETARY/CONFIDENTIAL. -# Source may not be released without written approval from HEC - import pandas as pd import pytest import cwms.api -from cwms import turbines +import cwms.turbines.turbines as turbines from tests._test_utils import read_resource_file _MOCK_ROOT = "https://mockwebserver.cwms.gov" _TURBINES = read_resource_file("turbines.json") -_TURBINES_NAME = read_resource_file("turbines_name.json") -_TURBINES_OFFICE_NAME = read_resource_file("turbines_office_name.json") @pytest.fixture(autouse=True) def init_session(): cwms.api.init_session(api_root=_MOCK_ROOT) + def test_get_projects_turbines(requests_mock): requests_mock.get( f"{_MOCK_ROOT}/projects/turbines?project-id=KEYS&office=SWT", json=_TURBINES, ) - office_id = "SWT" - name = "Test.Turbine" + office = "SWT" + project_id = "KEYS" - data = turbines.get_projects_turbines(name=name, office_id=office_id) + data = turbines.get_projects_turbines(projectId=project_id, office=office) assert data.json == _TURBINES - assert type(data.df) is pd.DataFrame - assert "turbine-id" in data.df.columns - assert data.df.shape == (1, 7) - values = data.df.to_numpy().tolist() - assert values[0] == [ - "SWT", - "Test.Turbine", - "Test Turbine", - "Test Turbine Description", - 0.0, - 0.0, - 0.0, + assert isinstance(data.df, pd.DataFrame) + + # Validate columns + expected_columns = [ + "office-id", + "project-name", + "turbine-name", + "latitude", + "longitude", + "active", + "elevation", ] + assert list(data.df.columns) == expected_columns -def test_get_projects_turbines_by_name(requests_mock): - requests_mock.get( - f"{_MOCK_ROOT}/projects/turbines/KEYS-Turbine1&office=SWT", - json=_TURBINES_NAME, - ) - - office_id = "SWT" - name = "Test.Turbine" - - data = turbines.get_projects_turbines_with_name(name=name, office_id=office_id) + # Validate DataFrame shape (2 rows, 7 columns) + assert data.df.shape == (2, 7) - assert data.json == _TURBINES - assert type(data.df) is pd.DataFrame - assert "turbine-id" in data.df.columns - assert data.df.shape == (1, 7) - values = data.df.to_numpy().tolist() - assert values[0] == [ - "SWT", - "Test.Turbine", - "Test Turbine", - "Test Turbine Description", - 0.0, - 0.0, - 0.0, - ] - -def test_get_projects_turbines_by_office_name(requests_mock): - requests_mock.get( - f"{_MOCK_ROOT}/projects/SWT/KEYS/turbines-changes", - json=_TURBINES_OFFICE_NAME, - ) - - office_id = "SWT" - name = "Test.Turbine" - - data = turbines.get_projects_turbines_with_office_with_name_turbine_changes(name=name, office_id=office_id) - - assert data.json == _TURBINES - assert type(data.df) is pd.DataFrame - assert "turbine-id" in data.df.columns - assert data.df.shape == (1, 7) - values = data.df.to_numpy().tolist() - assert values[0] == [ - "SWT", - "Test.Turbine", - "Test Turbine", - "Test Turbine Description", - 0.0, - 0.0, - 0.0, + # Validate the first row of data + expected_values = [ + ["SWT", "KEYS", "KEYS-Turbine1", 36.1506371, -96.2525088, True, 0], + ["SWT", "KEYS", "KEYS-Turbine2", 36.1506371, -96.2525088, True, 0], ] + actual_values = data.df.to_numpy().tolist() + assert actual_values == expected_values From 8966c5070b1903260e0ffc25316874f65bf6039a Mon Sep 17 00:00:00 2001 From: "Charles Graham, SWT" Date: Sun, 9 Feb 2025 23:26:45 -0600 Subject: [PATCH 04/19] Fix incorrect import --- cwms/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cwms/__init__.py b/cwms/__init__.py index 174e0673..cd20e2d9 100644 --- a/cwms/__init__.py +++ b/cwms/__init__.py @@ -25,7 +25,7 @@ from cwms.timeseries.timeseries_profile_instance import * from cwms.timeseries.timeseries_profile_parser import * from cwms.timeseries.timeseries_txt import * -from cwms.turbines import * +from cwms.turbines.turbines import * try: __version__ = version("cwms-python") From 0cef8f28ba81bf10554035849994bbb0a1e11026 Mon Sep 17 00:00:00 2001 From: "Charles Graham, SWT" Date: Sun, 9 Feb 2025 23:27:10 -0600 Subject: [PATCH 05/19] Pydoc formatting, correct project turbine param --- cwms/turbines/turbines.py | 62 ++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/cwms/turbines/turbines.py b/cwms/turbines/turbines.py index 6299e054..443feb76 100644 --- a/cwms/turbines/turbines.py +++ b/cwms/turbines/turbines.py @@ -6,39 +6,35 @@ def get_projects_turbines(office: str, projectId: str) -> Data: - '''Returns matching CWMS Turbine Data for a Reservoir Project. Get cwmsData projects turbines. + """Returns matching CWMS Turbine Data for a Reservoir Project. Get cwmsData projects turbines. Args: office (str): The office associated with the turbine data. projectId (str): The ID of the project. Returns: dict: A dictionary containing the turbine data. - ''' + """ endpoint = "projects/turbines" - params = { - "office": office, - "projectId": projectId - } + params = {"office": office, "project-id": projectId} response = api.get(endpoint=endpoint, params=params) return Data(response) + def get_projects_turbines_with_name(office: str, name: str) -> Data: - '''Returns CWMS Turbine Data Get cwmsData projects turbines with name. - Args: - office (str): The office associated with the turbine data. - name (str): The name of the turbine. - Returns: - dict: A dictionary containing the turbine data. - ''' + """Returns CWMS Turbine Data Get cwmsData projects turbines with name. + Args: + office (str): The office associated with the turbine data. + name (str): The name of the turbine. + Returns: + dict: A dictionary containing the turbine data. + """ endpoint = "projects/turbines" - params = { - "office": office, - "name": name - } + params = {"office": office, "name": name} response = api.get(endpoint=endpoint, params=params) return Data(response) + def get_projects_turbines_with_office_with_name_turbine_changes( name: str, begin: datetime, @@ -47,27 +43,27 @@ def get_projects_turbines_with_office_with_name_turbine_changes( page_size: Optional[int], unit_system: Optional[dict], start_time_inclusive: Optional[bool], - end_time_inclusive: Optional[bool] + end_time_inclusive: Optional[bool], ) -> Data: """ - Returns CWMS Turbine Data for projects with specified office and turbine name changes within a given time range. - Args: - begin (str): The start date and time for the data retrieval in ISO 8601 format. - end (str): The end date and time for the data retrieval in ISO 8601 format. - end_time_inclusive (Optional[bool]): Whether the end time is inclusive. - name (str): The name of the turbine. - office (str): The office associated with the turbine data. - page_size (Optional[int]): The number of records to return per page. - start_time_inclusive (Optional[bool]): Whether the start time is inclusive. - unit_system (Optional[dict]): The unit system to use for the data [SI, EN]. - Returns: - dict: A dictionary containing the turbine data. + Returns CWMS Turbine Data for projects with specified office and turbine name changes within a given time range. + Args: + begin (str): The start date and time for the data retrieval in ISO 8601 format. + end (str): The end date and time for the data retrieval in ISO 8601 format. + end_time_inclusive (Optional[bool]): Whether the end time is inclusive. + name (str): The name of the turbine. + office (str): The office associated with the turbine data. + page_size (Optional[int]): The number of records to return per page. + start_time_inclusive (Optional[bool]): Whether the start time is inclusive. + unit_system (Optional[dict]): The unit system to use for the data [SI, EN]. + Returns: + dict: A dictionary containing the turbine data. """ if begin and not isinstance(begin, datetime): raise ValueError("begin needs to be in datetime") if end and not isinstance(end, datetime): raise ValueError("end needs to be in datetime") - + endpoint = "projects/turbines" params = { "name": name, @@ -77,7 +73,7 @@ def get_projects_turbines_with_office_with_name_turbine_changes( "page-size": page_size, "unit-system": unit_system, "start-time-inclusive": start_time_inclusive, - "end-time-inclusive": end_time_inclusive + "end-time-inclusive": end_time_inclusive, } response = api.get(endpoint=endpoint, params=params) - return Data(response) \ No newline at end of file + return Data(response) From 425a254b78fe95fca649a75ee20ab80bb0cb6549 Mon Sep 17 00:00:00 2001 From: Charles Graham SWT Date: Mon, 10 Feb 2025 14:37:18 -0600 Subject: [PATCH 06/19] Complete turbines GET test --- tests/turbines/turbines_test.py | 38 +++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/tests/turbines/turbines_test.py b/tests/turbines/turbines_test.py index d981b254..81a2eef3 100644 --- a/tests/turbines/turbines_test.py +++ b/tests/turbines/turbines_test.py @@ -30,23 +30,39 @@ def test_get_projects_turbines(requests_mock): # Validate columns expected_columns = [ - "office-id", - "project-name", - "turbine-name", - "latitude", - "longitude", - "active", - "elevation", + "project-id.office-id", + "project-id.name", + "location.office-id", + "location.name", + "location.latitude", + "location.longitude", + "location.active", + "location.public-name", + "location.long-name", + "location.timezone-name", + "location.location-kind", + "location.nation", + "location.state-initial", + "location.county-name", + "location.nearest-city", + "location.horizontal-datum", + "location.published-longitude", + "location.published-latitude", + "location.vertical-datum", + "location.elevation", + "location.bounding-office-id", + "location.elevation-units" ] assert list(data.df.columns) == expected_columns - # Validate DataFrame shape (2 rows, 7 columns) - assert data.df.shape == (2, 7) + # Validate DataFrame shape (2 rows, 22 columns) + assert data.df.shape == (2, 22) # Validate the first row of data expected_values = [ - ["SWT", "KEYS", "KEYS-Turbine1", 36.1506371, -96.2525088, True, 0], - ["SWT", "KEYS", "KEYS-Turbine2", 36.1506371, -96.2525088, True, 0], + ["SWT", "KEYS", "SWT", "KEYS-Turbine1", 36.1506371, -96.2525088, True, "Turbine1","Turbine1", "US/Central", "TURBINE", "US", "OK", "Tulsa", "Sand Springs, OK", "NAD83", 0, 0, "NGVD29", 0, "SWT", "m"], + ["SWT", "KEYS", "SWT", "KEYS-Turbine2", 36.1506371, -96.2525088, True, "Turbine2","Turbine2", "US/Central", "TURBINE", "US", "OK", "Tulsa", "Sand Springs, OK", "NAD83", 0, 0, "NGVD29", 0, "SWT", "m"] ] actual_values = data.df.to_numpy().tolist() + assert actual_values == expected_values From e00067fecb6a644ddc5f6aa58b2cbd330b6453a1 Mon Sep 17 00:00:00 2001 From: Charles Graham SWT Date: Mon, 10 Feb 2025 14:54:01 -0600 Subject: [PATCH 07/19] Add turbines POST request and test --- cwms/turbines/turbines.py | 47 ++++++++++++++++++++++++++++++++- tests/turbines/turbines_test.py | 10 +++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/cwms/turbines/turbines.py b/cwms/turbines/turbines.py index 443feb76..559def34 100644 --- a/cwms/turbines/turbines.py +++ b/cwms/turbines/turbines.py @@ -2,8 +2,11 @@ from typing import Optional import cwms.api as api -from cwms.cwms_types import Data +from cwms.cwms_types import Data, JSON +#========================================================================== +# GET CWMS TURBINES +#========================================================================== def get_projects_turbines(office: str, projectId: str) -> Data: """Returns matching CWMS Turbine Data for a Reservoir Project. Get cwmsData projects turbines. @@ -77,3 +80,45 @@ def get_projects_turbines_with_office_with_name_turbine_changes( } response = api.get(endpoint=endpoint, params=params) return Data(response) + +#========================================================================== +# POST CWMS TURBINES +#========================================================================== + +def post_projects_turbines( + data: JSON, + fail_if_exists: Optional[bool] +) -> None: + """ + Create a new turbine in CWMS. + Parameters + ---------- + fail_if_exists (bool): If True, the request will fail if the turbine already exists. + + Returns + ------- + None + + + Raises + ------ + ValueError + If provided data is None + Unauthorized + 401 - Indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource. + Forbidden + 403 - Indicates that the server understands the request but refuses to authorize it. + Not Found + 404 - Indicates that the server cannot find the requested resource. + Server Error + 500 - Indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. + """ + if data is None: + raise ValueError( + "Cannot store a text time series without a JSON data dictionary" + ) + endpoint = "projects/turbines" + params = { + "fail-if-exists": fail_if_exists, + } + return api.post(endpoint=endpoint, data=data, params=params) \ No newline at end of file diff --git a/tests/turbines/turbines_test.py b/tests/turbines/turbines_test.py index 81a2eef3..db8b5c80 100644 --- a/tests/turbines/turbines_test.py +++ b/tests/turbines/turbines_test.py @@ -66,3 +66,13 @@ def test_get_projects_turbines(requests_mock): actual_values = data.df.to_numpy().tolist() assert actual_values == expected_values + +def test_post_projects_turbines(requests_mock): + requests_mock.post( + f"{_MOCK_ROOT}/projects/turbines?fail-if-exists=false" + ) + + turbines.post_projects_turbines(data=_TURBINES, fail_if_exists=False) + assert requests_mock.called + assert requests_mock.call_count == 1 + From 7e87a51cd3608505b11665047babd3da675b8c93 Mon Sep 17 00:00:00 2001 From: Charles Graham SWT Date: Mon, 10 Feb 2025 16:07:13 -0600 Subject: [PATCH 08/19] Add store project turbine with office/name Create test --- cwms/turbines/turbines.py | 43 +++++++++++++++++++++++++++++++-- tests/turbines/turbines_test.py | 19 +++++++++++++-- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/cwms/turbines/turbines.py b/cwms/turbines/turbines.py index 559def34..ac349029 100644 --- a/cwms/turbines/turbines.py +++ b/cwms/turbines/turbines.py @@ -85,7 +85,7 @@ def get_projects_turbines_with_office_with_name_turbine_changes( # POST CWMS TURBINES #========================================================================== -def post_projects_turbines( +def store_projects_turbines( data: JSON, fail_if_exists: Optional[bool] ) -> None: @@ -115,10 +115,49 @@ def post_projects_turbines( """ if data is None: raise ValueError( - "Cannot store a text time series without a JSON data dictionary" + "Cannot store project turbine changes without a JSON data dictionary" ) endpoint = "projects/turbines" params = { "fail-if-exists": fail_if_exists, } + return api.post(endpoint=endpoint, data=data, params=params) + +def store_projects_turbines_with_office_with_name( + data: JSON, office: str, name: str, override_protection: Optional[bool] +) -> None: + """ + Create CWMS Turbine Changes + Parameters + ---------- + office (str): Office id for the reservoir project location associated with the turbine changes. + name (str): Specifies the name of project of the Turbine changes whose data is to stored. + override_protection (bool): A flag ('True'/'False') specifying whether to delete protected data. Default is False + + Returns + ------- + None - Turbine successfully stored to CWMS. + + + Raises + ------ + ValueError + If provided data is None + Unauthorized + 401 - Indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource. + Forbidden + 403 - Indicates that the server understands the request but refuses to authorize it. + Not Found + 404 - Indicates that the server cannot find the requested resource. + Server Error + 500 - Indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. + """ + if data is None: + raise ValueError( + "Cannot store project turbine changes without a JSON data dictionary" + ) + endpoint = f"projects/{office}/{name}/turbines" + params = { + "override-protection": override_protection + } return api.post(endpoint=endpoint, data=data, params=params) \ No newline at end of file diff --git a/tests/turbines/turbines_test.py b/tests/turbines/turbines_test.py index db8b5c80..691ba2a6 100644 --- a/tests/turbines/turbines_test.py +++ b/tests/turbines/turbines_test.py @@ -7,6 +7,7 @@ _MOCK_ROOT = "https://mockwebserver.cwms.gov" _TURBINES = read_resource_file("turbines.json") +_TURBINES_OFFICE_NAME = read_resource_file("turbines_office_name.json") @pytest.fixture(autouse=True) @@ -67,12 +68,26 @@ def test_get_projects_turbines(requests_mock): assert actual_values == expected_values -def test_post_projects_turbines(requests_mock): +def test_store_projects_turbines(requests_mock): requests_mock.post( f"{_MOCK_ROOT}/projects/turbines?fail-if-exists=false" ) - turbines.post_projects_turbines(data=_TURBINES, fail_if_exists=False) + turbines.store_projects_turbines(data=_TURBINES, fail_if_exists=False) assert requests_mock.called assert requests_mock.call_count == 1 + +def test_store_projects_turbines_with_office_with_name(requests_mock): + requests_mock.post( + f"{_MOCK_ROOT}/projects/SWT/KEYS/turbines?override-protection=False" + ) + + turbines.store_projects_turbines_with_office_with_name( + data=_TURBINES_OFFICE_NAME, + office="SWT", + name="KEYS", + override_protection=False + ) + assert requests_mock.called + assert requests_mock.call_count == 1 \ No newline at end of file From 9800c55e4d56f0edfe8a58e838824d31d640c323 Mon Sep 17 00:00:00 2001 From: Charles Graham SWT Date: Tue, 11 Feb 2025 08:54:06 -0600 Subject: [PATCH 09/19] Add delete methods for turbines --- cwms/turbines/turbines.py | 79 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/cwms/turbines/turbines.py b/cwms/turbines/turbines.py index ac349029..9fd7b952 100644 --- a/cwms/turbines/turbines.py +++ b/cwms/turbines/turbines.py @@ -160,4 +160,81 @@ def store_projects_turbines_with_office_with_name( params = { "override-protection": override_protection } - return api.post(endpoint=endpoint, data=data, params=params) \ No newline at end of file + return api.post(endpoint=endpoint, data=data, params=params) + + +#========================================================================== +# DELETE CWMS TURBINES +#========================================================================== + +def delete_projects_turbines_with_name(name: str, office: str, method: Optional[str]) -> None: + """ + Delete CWMS Turbine + Parameters + ---------- + name (str): Specifies the name of the turbine to be deleted. + office (str): Specifies the owning office of the turbine to be deleted. + method (str): Specifies the delete method used. Defaults to "DELETE_KEY". Options are: DELETE_KEY, DELETE_DATA, DELETE_ALL + Returns + ------- + None - Turbine successfully deleted from CWMS. + + + Raises + ------ + ValueError + If provided data is None + Unauthorized + 401 - Indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource. + Forbidden + 403 - Indicates that the server understands the request but refuses to authorize it. + Not Found + 404 - Indicates that the server cannot find the requested resource. + Server Error + 500 - Indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. + """ + endpoint = f"projects/turbines/{name}" + params = { + "office": office, + "method": method + } + return api.delete(endpoint=endpoint, params=params, api_version=1) + +def delete_projects_turbines_with_office_with_name( + office: str, name: str, begin: datetime, end: datetime, override_protection: Optional[bool] +) -> None: + """ + Delete CWMS Turbine Changes + Parameters + ---------- + name (str): Specifies the name of project for the turbine changes to be deleted. + office (str): Specifies the owning office of the turbine to be deleted. + begin (datetime): The start of the time window + end (datetime): The end of the time window + override_protection (bool): A flag ('True'/'False') specifying whether to delete protected data. Default is False + + Returns + ------- + None - Turbine successfully deleted from CWMS. + + + Raises + ------ + ValueError + If provided data is None + Unauthorized + 401 - Indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource. + Forbidden + 403 - Indicates that the server understands the request but refuses to authorize it. + Not Found + 404 - Indicates that the server cannot find the requested resource. + Server Error + 500 - Indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. + """ + endpoint = f"projects/{office}/{name}/turbines" + params = { + "begin": begin.isoformat() if begin else None, + "end": end.isoformat() if end else None, + "override-protection": override_protection + } + return api.delete(endpoint=endpoint, params=params, api_version=1) \ No newline at end of file From ed6462e2f542ff8d2b9229106b0a218d5eb8e245 Mon Sep 17 00:00:00 2001 From: Charles Graham SWT Date: Tue, 11 Feb 2025 08:54:19 -0600 Subject: [PATCH 10/19] Fix turbines payload with office/name for tests --- tests/resources/turbines_office_name.json | 2663 +-------------------- 1 file changed, 38 insertions(+), 2625 deletions(-) diff --git a/tests/resources/turbines_office_name.json b/tests/resources/turbines_office_name.json index 650651b5..f589792e 100644 --- a/tests/resources/turbines_office_name.json +++ b/tests/resources/turbines_office_name.json @@ -1,2642 +1,55 @@ -[ - { - "project-id": { +{ + "project-id": { "office-id": "SWT", "name": "KEYS" - }, - "change-date": 1738713600000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.12 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738717200000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.12 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738720800000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.13 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738724400000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.13 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738728000000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.15 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738731600000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.1399999999999 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738735200000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.15 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738738800000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.15 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738742400000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.18 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738746000000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.1699999999998 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738749600000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.18 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738753200000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.18 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738756800000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.18 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738760400000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.19 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738764000000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.1999999999999 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738767600000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.1999999999999 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738771200000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.76, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.22 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738774800000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.76, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.21 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738778400000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.76, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.2299999999999 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738782000000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.76, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.22 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738785600000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.76, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.2299999999999 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738789200000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.2299999999999 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738792800000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.24 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738796400000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.25 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738800000000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.25 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738803600000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.2599999999999 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738807200000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.27 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738810800000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.27 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738814400000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.27 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738818000000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.27 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738821600000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.28 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738825200000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.28 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738828800000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.2899999999998 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738832400000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.2899999999998 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738836000000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.27 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738839600000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.32 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738843200000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.3299999999999 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738846800000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.34 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738850400000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.34 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738854000000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.35 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738857600000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.74, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.37 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738861200000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.74, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.38 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738864800000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.74, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.3899999999999 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738868400000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.74, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.3899999999999 - }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738872000000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.74, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.3899999999999 }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738875600000, - "protected": false, - "discharge-computation-type": { + "change-date": 1738713600000, + "protected": false, + "discharge-computation-type": { "office-id": "SWT", "display-value": "R", "tooltip": "Reported by powerhouse", "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.3899999999999 }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738879200000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { + "reason-type": { "office-id": "SWT", "display-value": "S", "tooltip": "Scheduled release to meet loads", "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 0, - "old-total-discharge-override": 0, - "discharge-units": "cfs", - "tailwater-elevation": 637.7499999999999, - "elevation-units": "ft", - "settings": [ - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - }, - { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 0, - "new-discharge": 0, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 0 - } - ], - "pool-elevation": 723.3899999999999 }, - { - "project-id": { - "office-id": "SWT", - "name": "KEYS" - }, - "change-date": 1738882800000, - "protected": false, - "discharge-computation-type": { - "office-id": "SWT", - "display-value": "R", - "tooltip": "Reported by powerhouse", - "active": true - }, - "reason-type": { - "office-id": "SWT", - "display-value": "S", - "tooltip": "Scheduled release to meet loads", - "active": true - }, - "notes": "from SCADA", - "new-total-discharge-override": 800, - "old-total-discharge-override": 800, - "discharge-units": "cfs", - "tailwater-elevation": 637.8, - "elevation-units": "ft", - "settings": [ + "notes": "from SCADA", + "new-total-discharge-override": 0, + "old-total-discharge-override": 0, + "discharge-units": "cfs", + "tailwater-elevation": 637.7499999999999, + "elevation-units": "ft", + "settings": [ { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine1" - }, - "discharge-units": "cfs", - "old-discharge": 400, - "new-discharge": 400, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 2 + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine1" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 }, { - "type": "turbine-setting", - "location-id": { - "office-id": "SWT", - "name": "KEYS-Turbine2" - }, - "discharge-units": "cfs", - "old-discharge": 400, - "new-discharge": 400, - "generation-units": "MW", - "scheduled-load": 0, - "real-power": 2 + "type": "turbine-setting", + "location-id": { + "office-id": "SWT", + "name": "KEYS-Turbine2" + }, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0 } - ], - "pool-elevation": 723.37 - } - ] \ No newline at end of file + ], + "pool-elevation": 723.12 +} \ No newline at end of file From c4b4f12f0e1791da563e289a6c7e52d04dd8d730 Mon Sep 17 00:00:00 2001 From: Charles Graham SWT Date: Tue, 11 Feb 2025 13:34:24 -0600 Subject: [PATCH 11/19] Add get office/name test --- cwms/turbines/turbines.py | 64 +++++++------ tests/turbines/turbines_test.py | 160 +++++++++++++++++++++++++++++--- 2 files changed, 182 insertions(+), 42 deletions(-) diff --git a/cwms/turbines/turbines.py b/cwms/turbines/turbines.py index 9fd7b952..ec7c0c59 100644 --- a/cwms/turbines/turbines.py +++ b/cwms/turbines/turbines.py @@ -2,11 +2,12 @@ from typing import Optional import cwms.api as api -from cwms.cwms_types import Data, JSON +from cwms.cwms_types import JSON, Data -#========================================================================== +# ========================================================================== # GET CWMS TURBINES -#========================================================================== +# ========================================================================== + def get_projects_turbines(office: str, projectId: str) -> Data: """Returns matching CWMS Turbine Data for a Reservoir Project. Get cwmsData projects turbines. @@ -67,7 +68,7 @@ def get_projects_turbines_with_office_with_name_turbine_changes( if end and not isinstance(end, datetime): raise ValueError("end needs to be in datetime") - endpoint = "projects/turbines" + endpoint = f"projects/{office}/{name}/turbines" params = { "name": name, "begin": begin.isoformat() if begin else None, @@ -81,24 +82,23 @@ def get_projects_turbines_with_office_with_name_turbine_changes( response = api.get(endpoint=endpoint, params=params) return Data(response) -#========================================================================== + +# ========================================================================== # POST CWMS TURBINES -#========================================================================== +# ========================================================================== -def store_projects_turbines( - data: JSON, - fail_if_exists: Optional[bool] -) -> None: + +def store_projects_turbines(data: JSON, fail_if_exists: Optional[bool]) -> None: """ Create a new turbine in CWMS. Parameters ---------- fail_if_exists (bool): If True, the request will fail if the turbine already exists. - + Returns ------- - None - + None + Raises ------ @@ -123,6 +123,7 @@ def store_projects_turbines( } return api.post(endpoint=endpoint, data=data, params=params) + def store_projects_turbines_with_office_with_name( data: JSON, office: str, name: str, override_protection: Optional[bool] ) -> None: @@ -133,11 +134,11 @@ def store_projects_turbines_with_office_with_name( office (str): Office id for the reservoir project location associated with the turbine changes. name (str): Specifies the name of project of the Turbine changes whose data is to stored. override_protection (bool): A flag ('True'/'False') specifying whether to delete protected data. Default is False - + Returns ------- None - Turbine successfully stored to CWMS. - + Raises ------ @@ -157,17 +158,18 @@ def store_projects_turbines_with_office_with_name( "Cannot store project turbine changes without a JSON data dictionary" ) endpoint = f"projects/{office}/{name}/turbines" - params = { - "override-protection": override_protection - } + params = {"override-protection": override_protection} return api.post(endpoint=endpoint, data=data, params=params) -#========================================================================== +# ========================================================================== # DELETE CWMS TURBINES -#========================================================================== +# ========================================================================== -def delete_projects_turbines_with_name(name: str, office: str, method: Optional[str]) -> None: + +def delete_projects_turbines_with_name( + name: str, office: str, method: Optional[str] +) -> None: """ Delete CWMS Turbine Parameters @@ -178,7 +180,7 @@ def delete_projects_turbines_with_name(name: str, office: str, method: Optional[ Returns ------- None - Turbine successfully deleted from CWMS. - + Raises ------ @@ -194,14 +196,16 @@ def delete_projects_turbines_with_name(name: str, office: str, method: Optional[ 500 - Indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. """ endpoint = f"projects/turbines/{name}" - params = { - "office": office, - "method": method - } + params = {"office": office, "method": method} return api.delete(endpoint=endpoint, params=params, api_version=1) + def delete_projects_turbines_with_office_with_name( - office: str, name: str, begin: datetime, end: datetime, override_protection: Optional[bool] + office: str, + name: str, + begin: datetime, + end: datetime, + override_protection: Optional[bool], ) -> None: """ Delete CWMS Turbine Changes @@ -216,7 +220,7 @@ def delete_projects_turbines_with_office_with_name( Returns ------- None - Turbine successfully deleted from CWMS. - + Raises ------ @@ -235,6 +239,6 @@ def delete_projects_turbines_with_office_with_name( params = { "begin": begin.isoformat() if begin else None, "end": end.isoformat() if end else None, - "override-protection": override_protection + "override-protection": override_protection, } - return api.delete(endpoint=endpoint, params=params, api_version=1) \ No newline at end of file + return api.delete(endpoint=endpoint, params=params, api_version=1) diff --git a/tests/turbines/turbines_test.py b/tests/turbines/turbines_test.py index 691ba2a6..2e7ab3ff 100644 --- a/tests/turbines/turbines_test.py +++ b/tests/turbines/turbines_test.py @@ -1,3 +1,5 @@ +from datetime import datetime + import pandas as pd import pytest @@ -52,7 +54,7 @@ def test_get_projects_turbines(requests_mock): "location.vertical-datum", "location.elevation", "location.bounding-office-id", - "location.elevation-units" + "location.elevation-units", ] assert list(data.df.columns) == expected_columns @@ -61,18 +63,155 @@ def test_get_projects_turbines(requests_mock): # Validate the first row of data expected_values = [ - ["SWT", "KEYS", "SWT", "KEYS-Turbine1", 36.1506371, -96.2525088, True, "Turbine1","Turbine1", "US/Central", "TURBINE", "US", "OK", "Tulsa", "Sand Springs, OK", "NAD83", 0, 0, "NGVD29", 0, "SWT", "m"], - ["SWT", "KEYS", "SWT", "KEYS-Turbine2", 36.1506371, -96.2525088, True, "Turbine2","Turbine2", "US/Central", "TURBINE", "US", "OK", "Tulsa", "Sand Springs, OK", "NAD83", 0, 0, "NGVD29", 0, "SWT", "m"] + [ + "SWT", + "KEYS", + "SWT", + "KEYS-Turbine1", + 36.1506371, + -96.2525088, + True, + "Turbine1", + "Turbine1", + "US/Central", + "TURBINE", + "US", + "OK", + "Tulsa", + "Sand Springs, OK", + "NAD83", + 0, + 0, + "NGVD29", + 0, + "SWT", + "m", + ], + [ + "SWT", + "KEYS", + "SWT", + "KEYS-Turbine2", + 36.1506371, + -96.2525088, + True, + "Turbine2", + "Turbine2", + "US/Central", + "TURBINE", + "US", + "OK", + "Tulsa", + "Sand Springs, OK", + "NAD83", + 0, + 0, + "NGVD29", + 0, + "SWT", + "m", + ], ] actual_values = data.df.to_numpy().tolist() assert actual_values == expected_values -def test_store_projects_turbines(requests_mock): - requests_mock.post( - f"{_MOCK_ROOT}/projects/turbines?fail-if-exists=false" + +def test_get_projects_turbines_with_office_with_name(requests_mock): + requests_mock.get( + f"{_MOCK_ROOT}/projects/SWT/KEYS/turbines", json=_TURBINES_OFFICE_NAME ) + office = "SWT" + name = "KEYS" + + data = turbines.get_projects_turbines_with_office_with_name_turbine_changes( + name=name, + begin=datetime(2024, 1, 1), + end=datetime(2024, 12, 31), + office=office, + page_size=100, + unit_system=None, + start_time_inclusive=True, + end_time_inclusive=True, + ) + expected_columns = [ + "change-date", + "protected", + "notes", + "new-total-discharge-override", + "old-total-discharge-override", + "discharge-units", + "tailwater-elevation", + "elevation-units", + "settings", + "pool-elevation", + "project-id.office-id", + "project-id.name", + "discharge-computation-type.office-id", + "discharge-computation-type.display-value", + "discharge-computation-type.tooltip", + "discharge-computation-type.active", + "reason-type.office-id", + "reason-type.display-value", + "reason-type.tooltip", + "reason-type.active", + ] + + expected_values = [ + [ + 1738713600000, + False, + "from SCADA", + 0, + 0, + "cfs", + 637.7499999999999, + "ft", + [ + { + "type": "turbine-setting", + "location-id": {"office-id": "SWT", "name": "KEYS-Turbine1"}, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0, + }, + { + "type": "turbine-setting", + "location-id": {"office-id": "SWT", "name": "KEYS-Turbine2"}, + "discharge-units": "cfs", + "old-discharge": 0, + "new-discharge": 0, + "generation-units": "MW", + "scheduled-load": 0, + "real-power": 0, + }, + ], + 723.12, + "SWT", + "KEYS", + "SWT", + "R", + "Reported by powerhouse", + True, + "SWT", + "S", + "Scheduled release to meet loads", + True, + ] + ] + + assert list(data.df.columns) == expected_columns + assert data.df.shape == (1, len(expected_columns)) + assert data.df.to_numpy().tolist() == expected_values + + +def test_store_projects_turbines(requests_mock): + requests_mock.post(f"{_MOCK_ROOT}/projects/turbines?fail-if-exists=false") + turbines.store_projects_turbines(data=_TURBINES, fail_if_exists=False) assert requests_mock.called assert requests_mock.call_count == 1 @@ -82,12 +221,9 @@ def test_store_projects_turbines_with_office_with_name(requests_mock): requests_mock.post( f"{_MOCK_ROOT}/projects/SWT/KEYS/turbines?override-protection=False" ) - + turbines.store_projects_turbines_with_office_with_name( - data=_TURBINES_OFFICE_NAME, - office="SWT", - name="KEYS", - override_protection=False + data=_TURBINES_OFFICE_NAME, office="SWT", name="KEYS", override_protection=False ) assert requests_mock.called - assert requests_mock.call_count == 1 \ No newline at end of file + assert requests_mock.call_count == 1 From 7b29147a34b92f9b0c0e3e704a250ee1512e4818 Mon Sep 17 00:00:00 2001 From: Charles Graham SWT Date: Tue, 11 Feb 2025 13:42:23 -0600 Subject: [PATCH 12/19] Change projectId to project_id to match standard --- cwms/turbines/turbines.py | 6 +++--- tests/turbines/turbines_test.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cwms/turbines/turbines.py b/cwms/turbines/turbines.py index ec7c0c59..d0458af6 100644 --- a/cwms/turbines/turbines.py +++ b/cwms/turbines/turbines.py @@ -9,16 +9,16 @@ # ========================================================================== -def get_projects_turbines(office: str, projectId: str) -> Data: +def get_projects_turbines(office: str, project_id: str) -> Data: """Returns matching CWMS Turbine Data for a Reservoir Project. Get cwmsData projects turbines. Args: office (str): The office associated with the turbine data. - projectId (str): The ID of the project. + project_id (str): The ID of the project. Returns: dict: A dictionary containing the turbine data. """ endpoint = "projects/turbines" - params = {"office": office, "project-id": projectId} + params = {"office": office, "project-id": project_id} response = api.get(endpoint=endpoint, params=params) diff --git a/tests/turbines/turbines_test.py b/tests/turbines/turbines_test.py index 2e7ab3ff..5e50c738 100644 --- a/tests/turbines/turbines_test.py +++ b/tests/turbines/turbines_test.py @@ -26,7 +26,7 @@ def test_get_projects_turbines(requests_mock): office = "SWT" project_id = "KEYS" - data = turbines.get_projects_turbines(projectId=project_id, office=office) + data = turbines.get_projects_turbines(project_id=project_id, office=office) assert data.json == _TURBINES assert isinstance(data.df, pd.DataFrame) From 42a72b54e7abd2d4f2b9dcbeba4a720e93015f98 Mon Sep 17 00:00:00 2001 From: Charles Graham SWT Date: Tue, 11 Feb 2025 13:50:20 -0600 Subject: [PATCH 13/19] Add turbines_with_name test, Add delete turbines with name --- tests/turbines/turbines_test.py | 90 +++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/tests/turbines/turbines_test.py b/tests/turbines/turbines_test.py index 5e50c738..55e1a1f1 100644 --- a/tests/turbines/turbines_test.py +++ b/tests/turbines/turbines_test.py @@ -9,6 +9,7 @@ _MOCK_ROOT = "https://mockwebserver.cwms.gov" _TURBINES = read_resource_file("turbines.json") +_TURBINES_NAME = read_resource_file("turbines_name.json") _TURBINES_OFFICE_NAME = read_resource_file("turbines_office_name.json") @@ -17,6 +18,11 @@ def init_session(): cwms.api.init_session(api_root=_MOCK_ROOT) +# ========================================================================== +# GET CWMS TURBINES +# ========================================================================== + + def test_get_projects_turbines(requests_mock): requests_mock.get( f"{_MOCK_ROOT}/projects/turbines?project-id=KEYS&office=SWT", @@ -117,6 +123,47 @@ def test_get_projects_turbines(requests_mock): assert actual_values == expected_values +def get_projects_turbines_with_name(requests_mock): + requests_mock.get( + f"{_MOCK_ROOT}/projects/turbines?name=KEYS&office=SWT", + json=_TURBINES_NAME, + ) + + project_id = "KEYS" + office = "SWT" + + data = turbines.get_projects_turbines(office=office, project_id=project_id) + expected_columns = [ + "project-id.office-id", + "project-id.name", + "location.office-id", + "location.name", + "location.latitude", + "location.longitude", + "location.active", + "location.public-name", + "location.long-name", + "location.timezone-name", + "location.location-kind", + "location.nation", + "location.state-initial", + "location.county-name", + "location.nearest-city", + "location.horizontal-datum", + "location.published-longitude", + "location.published-latitude", + "location.vertical-datum", + "location.elevation", + "location.bounding-office-id", + "location.elevation-units", + ] + + expected_values = [["SWT", "KEYS", "SWT"]] + assert list(data.df.columns) == expected_columns + assert data.df.shape == (1, len(expected_columns)) + assert data.df.to_numpy().tolist() == expected_values + + def test_get_projects_turbines_with_office_with_name(requests_mock): requests_mock.get( f"{_MOCK_ROOT}/projects/SWT/KEYS/turbines", json=_TURBINES_OFFICE_NAME @@ -209,6 +256,11 @@ def test_get_projects_turbines_with_office_with_name(requests_mock): assert data.df.to_numpy().tolist() == expected_values +# ========================================================================== +# POST CWMS TURBINES +# ========================================================================== + + def test_store_projects_turbines(requests_mock): requests_mock.post(f"{_MOCK_ROOT}/projects/turbines?fail-if-exists=false") @@ -227,3 +279,41 @@ def test_store_projects_turbines_with_office_with_name(requests_mock): ) assert requests_mock.called assert requests_mock.call_count == 1 + + +# ========================================================================== +# DELETE CWMS TURBINES +# ========================================================================== + + +def test_delete_projects_turbines_with_name(requests_mock): + requests_mock.delete( + f"{_MOCK_ROOT}/projects/turbines/KEYS-Turbine1?office=SWT&method=DELETE_ALL" + ) + + name = "KEYS-Turbine1" + office = "SWT" + method = "DELETE_ALL" + + turbines.delete_projects_turbines_with_name(name=name, office=office, method=method) + + assert requests_mock.called + assert requests_mock.call_count == 1 + + +def test_delete_projects_turbines_with_office_with_name(requests_mock): + requests_mock.delete(f"{_MOCK_ROOT}/projects/SWT/KEYS/turbines") + + office = "SWT" + name = "KEYS" + + turbines.delete_projects_turbines_with_office_with_name( + office=office, + name=name, + override_protection=False, + begin=datetime(2024, 1, 1), + end=datetime(2024, 12, 31), + ) + + assert requests_mock.called + assert requests_mock.call_count == 1 From 0e6b1ea5728717de3fd3fe8ffe703ee8d995be10 Mon Sep 17 00:00:00 2001 From: Charles Graham SWT Date: Tue, 11 Feb 2025 14:04:30 -0600 Subject: [PATCH 14/19] Include various URI params to the mock tests --- tests/turbines/turbines_test.py | 43 ++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/tests/turbines/turbines_test.py b/tests/turbines/turbines_test.py index 55e1a1f1..8b193068 100644 --- a/tests/turbines/turbines_test.py +++ b/tests/turbines/turbines_test.py @@ -24,14 +24,14 @@ def init_session(): def test_get_projects_turbines(requests_mock): + office = "SWT" + project_id = "KEYS" + requests_mock.get( - f"{_MOCK_ROOT}/projects/turbines?project-id=KEYS&office=SWT", + f"{_MOCK_ROOT}/projects/turbines?project-id={project_id}&office={office}", json=_TURBINES, ) - office = "SWT" - project_id = "KEYS" - data = turbines.get_projects_turbines(project_id=project_id, office=office) assert data.json == _TURBINES @@ -124,14 +124,14 @@ def test_get_projects_turbines(requests_mock): def get_projects_turbines_with_name(requests_mock): + project_id = "KEYS" + office = "SWT" + requests_mock.get( - f"{_MOCK_ROOT}/projects/turbines?name=KEYS&office=SWT", + f"{_MOCK_ROOT}/projects/turbines?project_id={project_id}&office={office}", json=_TURBINES_NAME, ) - project_id = "KEYS" - office = "SWT" - data = turbines.get_projects_turbines(office=office, project_id=project_id) expected_columns = [ "project-id.office-id", @@ -165,13 +165,13 @@ def get_projects_turbines_with_name(requests_mock): def test_get_projects_turbines_with_office_with_name(requests_mock): - requests_mock.get( - f"{_MOCK_ROOT}/projects/SWT/KEYS/turbines", json=_TURBINES_OFFICE_NAME - ) - office = "SWT" name = "KEYS" + requests_mock.get( + f"{_MOCK_ROOT}/projects/{office}/{name}/turbines", json=_TURBINES_OFFICE_NAME + ) + data = turbines.get_projects_turbines_with_office_with_name_turbine_changes( name=name, begin=datetime(2024, 1, 1), @@ -270,8 +270,11 @@ def test_store_projects_turbines(requests_mock): def test_store_projects_turbines_with_office_with_name(requests_mock): + office = "SWT" + name = "KEYS" + requests_mock.post( - f"{_MOCK_ROOT}/projects/SWT/KEYS/turbines?override-protection=False" + f"{_MOCK_ROOT}/projects/{office}/{name}/turbines?override-protection=False" ) turbines.store_projects_turbines_with_office_with_name( @@ -287,14 +290,14 @@ def test_store_projects_turbines_with_office_with_name(requests_mock): def test_delete_projects_turbines_with_name(requests_mock): - requests_mock.delete( - f"{_MOCK_ROOT}/projects/turbines/KEYS-Turbine1?office=SWT&method=DELETE_ALL" - ) - name = "KEYS-Turbine1" office = "SWT" method = "DELETE_ALL" + requests_mock.delete( + f"{_MOCK_ROOT}/projects/turbines/{name}?office={office}&method={method}" + ) + turbines.delete_projects_turbines_with_name(name=name, office=office, method=method) assert requests_mock.called @@ -302,11 +305,13 @@ def test_delete_projects_turbines_with_name(requests_mock): def test_delete_projects_turbines_with_office_with_name(requests_mock): - requests_mock.delete(f"{_MOCK_ROOT}/projects/SWT/KEYS/turbines") - office = "SWT" name = "KEYS" + requests_mock.delete( + f"{_MOCK_ROOT}/projects/{office}/{name}/turbines?override-protection=False" + ) + turbines.delete_projects_turbines_with_office_with_name( office=office, name=name, From 485260c3a5230d2dbd0f424056f246289015b30c Mon Sep 17 00:00:00 2001 From: Charles Graham SWT Date: Thu, 13 Feb 2025 08:25:08 -0600 Subject: [PATCH 15/19] Rename from cwmsjs to cwms-python preferred method name standard Fix path vs param issues on endpoints --- cwms/turbines/turbines.py | 26 ++++++++++++-------------- tests/turbines/turbines_test.py | 31 ++++++++++++++++--------------- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/cwms/turbines/turbines.py b/cwms/turbines/turbines.py index d0458af6..9b2fb004 100644 --- a/cwms/turbines/turbines.py +++ b/cwms/turbines/turbines.py @@ -9,7 +9,7 @@ # ========================================================================== -def get_projects_turbines(office: str, project_id: str) -> Data: +def get_project_turbines(office: str, project_id: str) -> Data: """Returns matching CWMS Turbine Data for a Reservoir Project. Get cwmsData projects turbines. Args: office (str): The office associated with the turbine data. @@ -25,7 +25,7 @@ def get_projects_turbines(office: str, project_id: str) -> Data: return Data(response) -def get_projects_turbines_with_name(office: str, name: str) -> Data: +def get_project_turbine(office: str, name: str) -> Data: """Returns CWMS Turbine Data Get cwmsData projects turbines with name. Args: office (str): The office associated with the turbine data. @@ -33,13 +33,13 @@ def get_projects_turbines_with_name(office: str, name: str) -> Data: Returns: dict: A dictionary containing the turbine data. """ - endpoint = "projects/turbines" - params = {"office": office, "name": name} + endpoint = f"projects/turbines/{name}" + params = {"office": office} response = api.get(endpoint=endpoint, params=params) return Data(response) -def get_projects_turbines_with_office_with_name_turbine_changes( +def get_project_turbine_changes( name: str, begin: datetime, end: datetime, @@ -68,7 +68,7 @@ def get_projects_turbines_with_office_with_name_turbine_changes( if end and not isinstance(end, datetime): raise ValueError("end needs to be in datetime") - endpoint = f"projects/{office}/{name}/turbines" + endpoint = f"projects/{office}/{name}/turbine-changes" params = { "name": name, "begin": begin.isoformat() if begin else None, @@ -88,7 +88,7 @@ def get_projects_turbines_with_office_with_name_turbine_changes( # ========================================================================== -def store_projects_turbines(data: JSON, fail_if_exists: Optional[bool]) -> None: +def store_project_turbine(data: JSON, fail_if_exists: Optional[bool]) -> None: """ Create a new turbine in CWMS. Parameters @@ -124,7 +124,7 @@ def store_projects_turbines(data: JSON, fail_if_exists: Optional[bool]) -> None: return api.post(endpoint=endpoint, data=data, params=params) -def store_projects_turbines_with_office_with_name( +def store_project_turbine_changes( data: JSON, office: str, name: str, override_protection: Optional[bool] ) -> None: """ @@ -157,7 +157,7 @@ def store_projects_turbines_with_office_with_name( raise ValueError( "Cannot store project turbine changes without a JSON data dictionary" ) - endpoint = f"projects/{office}/{name}/turbines" + endpoint = f"projects/{office}/{name}/turbine-changes" params = {"override-protection": override_protection} return api.post(endpoint=endpoint, data=data, params=params) @@ -167,9 +167,7 @@ def store_projects_turbines_with_office_with_name( # ========================================================================== -def delete_projects_turbines_with_name( - name: str, office: str, method: Optional[str] -) -> None: +def delete_project_turbine(name: str, office: str, method: Optional[str]) -> None: """ Delete CWMS Turbine Parameters @@ -200,7 +198,7 @@ def delete_projects_turbines_with_name( return api.delete(endpoint=endpoint, params=params, api_version=1) -def delete_projects_turbines_with_office_with_name( +def delete_project_turbine_changes( office: str, name: str, begin: datetime, @@ -235,7 +233,7 @@ def delete_projects_turbines_with_office_with_name( Server Error 500 - Indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. """ - endpoint = f"projects/{office}/{name}/turbines" + endpoint = f"projects/{office}/{name}/turbine-changes" params = { "begin": begin.isoformat() if begin else None, "end": end.isoformat() if end else None, diff --git a/tests/turbines/turbines_test.py b/tests/turbines/turbines_test.py index 8b193068..b4bdf3e0 100644 --- a/tests/turbines/turbines_test.py +++ b/tests/turbines/turbines_test.py @@ -23,7 +23,7 @@ def init_session(): # ========================================================================== -def test_get_projects_turbines(requests_mock): +def test_get_project_turbines(requests_mock): office = "SWT" project_id = "KEYS" @@ -32,7 +32,7 @@ def test_get_projects_turbines(requests_mock): json=_TURBINES, ) - data = turbines.get_projects_turbines(project_id=project_id, office=office) + data = turbines.get_project_turbines(project_id=project_id, office=office) assert data.json == _TURBINES assert isinstance(data.df, pd.DataFrame) @@ -123,7 +123,7 @@ def test_get_projects_turbines(requests_mock): assert actual_values == expected_values -def get_projects_turbines_with_name(requests_mock): +def get_project_turbine(requests_mock): project_id = "KEYS" office = "SWT" @@ -132,7 +132,7 @@ def get_projects_turbines_with_name(requests_mock): json=_TURBINES_NAME, ) - data = turbines.get_projects_turbines(office=office, project_id=project_id) + data = turbines.get_project_turbine(office=office, project_id=project_id) expected_columns = [ "project-id.office-id", "project-id.name", @@ -164,15 +164,16 @@ def get_projects_turbines_with_name(requests_mock): assert data.df.to_numpy().tolist() == expected_values -def test_get_projects_turbines_with_office_with_name(requests_mock): +def test_get_project_turbine_changes(requests_mock): office = "SWT" name = "KEYS" requests_mock.get( - f"{_MOCK_ROOT}/projects/{office}/{name}/turbines", json=_TURBINES_OFFICE_NAME + f"{_MOCK_ROOT}/projects/{office}/{name}/turbine-changes", + json=_TURBINES_OFFICE_NAME, ) - data = turbines.get_projects_turbines_with_office_with_name_turbine_changes( + data = turbines.get_project_turbine_changes( name=name, begin=datetime(2024, 1, 1), end=datetime(2024, 12, 31), @@ -261,15 +262,15 @@ def test_get_projects_turbines_with_office_with_name(requests_mock): # ========================================================================== -def test_store_projects_turbines(requests_mock): +def test_store_project_turbine(requests_mock): requests_mock.post(f"{_MOCK_ROOT}/projects/turbines?fail-if-exists=false") - turbines.store_projects_turbines(data=_TURBINES, fail_if_exists=False) + turbines.store_project_turbine(data=_TURBINES, fail_if_exists=False) assert requests_mock.called assert requests_mock.call_count == 1 -def test_store_projects_turbines_with_office_with_name(requests_mock): +def test_store_project_turbine_changes(requests_mock): office = "SWT" name = "KEYS" @@ -277,7 +278,7 @@ def test_store_projects_turbines_with_office_with_name(requests_mock): f"{_MOCK_ROOT}/projects/{office}/{name}/turbines?override-protection=False" ) - turbines.store_projects_turbines_with_office_with_name( + turbines.store_project_turbine_changes( data=_TURBINES_OFFICE_NAME, office="SWT", name="KEYS", override_protection=False ) assert requests_mock.called @@ -289,7 +290,7 @@ def test_store_projects_turbines_with_office_with_name(requests_mock): # ========================================================================== -def test_delete_projects_turbines_with_name(requests_mock): +def test_delete_project_turbine(requests_mock): name = "KEYS-Turbine1" office = "SWT" method = "DELETE_ALL" @@ -298,13 +299,13 @@ def test_delete_projects_turbines_with_name(requests_mock): f"{_MOCK_ROOT}/projects/turbines/{name}?office={office}&method={method}" ) - turbines.delete_projects_turbines_with_name(name=name, office=office, method=method) + turbines.delete_project_turbine(name=name, office=office, method=method) assert requests_mock.called assert requests_mock.call_count == 1 -def test_delete_projects_turbines_with_office_with_name(requests_mock): +def test_delete_project_turbine_changes(requests_mock): office = "SWT" name = "KEYS" @@ -312,7 +313,7 @@ def test_delete_projects_turbines_with_office_with_name(requests_mock): f"{_MOCK_ROOT}/projects/{office}/{name}/turbines?override-protection=False" ) - turbines.delete_projects_turbines_with_office_with_name( + turbines.delete_project_turbine_changes( office=office, name=name, override_protection=False, From ecf9a3e8769040d12272d62e8f2811b5d03012d2 Mon Sep 17 00:00:00 2001 From: Charles Graham Date: Thu, 20 Feb 2025 16:25:44 -0600 Subject: [PATCH 16/19] bump pyproject version to 0.5.3 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 45e508a7..19dffd47 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cwms-python" -version = "0.5.2" +version = "0.5.3" packages = [ { include = "cwms" }, ] From 237d35ce45b9e70b667ff390eb3ba0fa77b2c279 Mon Sep 17 00:00:00 2001 From: Charles Graham Date: Thu, 20 Feb 2025 21:49:00 -0600 Subject: [PATCH 17/19] Fix typo in contributing for turbines_test.py run single file --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1863635c..c4e6da6e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,7 +44,7 @@ Run poetry against a single file with: *\*From the root of the project\** ```sh -poetry run pytest tests/turbines/turbines_test.py` +poetry run pytest tests/turbines/turbines_test.py ``` ### Code Style From 7206b3e03c8559d17ad43bdb0a2daf639117616e Mon Sep 17 00:00:00 2001 From: Charles Graham Date: Thu, 20 Feb 2025 21:51:58 -0600 Subject: [PATCH 18/19] Fixed missed correction for delete and post methods of turbine-changes --- tests/turbines/turbines_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/turbines/turbines_test.py b/tests/turbines/turbines_test.py index b4bdf3e0..8a4b2204 100644 --- a/tests/turbines/turbines_test.py +++ b/tests/turbines/turbines_test.py @@ -275,7 +275,7 @@ def test_store_project_turbine_changes(requests_mock): name = "KEYS" requests_mock.post( - f"{_MOCK_ROOT}/projects/{office}/{name}/turbines?override-protection=False" + f"{_MOCK_ROOT}/projects/{office}/{name}/turbine-changes?override-protection=False" ) turbines.store_project_turbine_changes( @@ -310,7 +310,7 @@ def test_delete_project_turbine_changes(requests_mock): name = "KEYS" requests_mock.delete( - f"{_MOCK_ROOT}/projects/{office}/{name}/turbines?override-protection=False" + f"{_MOCK_ROOT}/projects/{office}/{name}/turbine-changes?override-protection=False" ) turbines.delete_project_turbine_changes( From 3d7db9270bfe5ae6432681f04794a2fc2b71b533 Mon Sep 17 00:00:00 2001 From: Charles Graham Date: Thu, 20 Feb 2025 21:55:14 -0600 Subject: [PATCH 19/19] Fix incorrect optional type for unit_system --- cwms/turbines/turbines.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cwms/turbines/turbines.py b/cwms/turbines/turbines.py index 9b2fb004..e6fafdb7 100644 --- a/cwms/turbines/turbines.py +++ b/cwms/turbines/turbines.py @@ -45,7 +45,7 @@ def get_project_turbine_changes( end: datetime, office: str, page_size: Optional[int], - unit_system: Optional[dict], + unit_system: Optional[str], start_time_inclusive: Optional[bool], end_time_inclusive: Optional[bool], ) -> Data: @@ -59,7 +59,7 @@ def get_project_turbine_changes( office (str): The office associated with the turbine data. page_size (Optional[int]): The number of records to return per page. start_time_inclusive (Optional[bool]): Whether the start time is inclusive. - unit_system (Optional[dict]): The unit system to use for the data [SI, EN]. + unit_system (Optional[str]): The unit system to use for the data [SI, EN]. Returns: dict: A dictionary containing the turbine data. """