Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop online facility #136

Merged
merged 3 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11
- name: Install Deps
run: pip install -r nereid/requirements.txt -r nereid/requirements_tests.txt
- name: Run Tests
Expand All @@ -33,19 +33,18 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11
- name: Install nereid as library
run: |
pip install .
pip install pytest pytest-xdist
- name: Run Tests
run: pytest nereid/nereid/tests/test_src -xv -n 2
- name: Test Import
run: python -c "import nereid"

python-edge-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11"]
steps:
- run: sudo apt-get install graphviz
- uses: actions/checkout@v3
Expand Down
24 changes: 11 additions & 13 deletions nereid/nereid/api/api_v1/models/treatment_facility_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class DryWeatherTreatmentLowFlowFacility(LowFlowFacility):
_constructor: str = "dry_weather_treatment_low_flow_facility_constructor"


class OnlineFaciltyBase(FacilityBase):
class OnlineFacilityBase(FacilityBase): # pragma: no cover
is_online: bool = True
tributary_area_tc_min: float = Field(5.0, le=60)
offline_diversion_rate_cfs: Optional[float] = None
Expand All @@ -128,33 +128,31 @@ def required_if_offline(cls, v, values):
return v


class RetentionFacility(OnlineFaciltyBase):
class RetentionFacility(FacilityBase):
total_volume_cuft: float
area_sqft: float
inf_rate_inhr: float
_constructor: str = "retention_facility_constructor"


class RetentionFacilityHSG(OnlineFaciltyBase):
class RetentionFacilityHSG(FacilityBase):
total_volume_cuft: float
area_sqft: float
hsg: str
_constructor: str = "retention_facility_constructor"


class DryWellFacility(OnlineFaciltyBase):
class DryWellFacility(FacilityBase):
total_volume_cuft: float
treatment_rate_cfs: float
_constructor: str = "dry_well_facility_constructor"


class DryWellFacilityFlowOrVolume(OnlineFaciltyBase):
total_volume_cuft: float
treatment_rate_cfs: float
class DryWellFacilityFlowOrVolume(FlowFacility, DryWellFacility):
_constructor: str = "dry_well_facility_flow_or_volume_constructor"


class BioInfFacility(OnlineFaciltyBase):
class BioInfFacility(FacilityBase):
total_volume_cuft: float
retention_volume_cuft: float
area_sqft: float
Expand All @@ -163,7 +161,7 @@ class BioInfFacility(OnlineFaciltyBase):
_constructor: str = "bioinfiltration_facility_constructor"


class RetAndTmntFacility(OnlineFaciltyBase):
class RetAndTmntFacility(FacilityBase):
total_volume_cuft: float
retention_volume_cuft: float
area_sqft: float
Expand All @@ -172,7 +170,7 @@ class RetAndTmntFacility(OnlineFaciltyBase):
_constructor: str = "retention_and_treatment_facility_constructor"


class TmntFacility(OnlineFaciltyBase):
class TmntFacility(FacilityBase):
total_volume_cuft: float
area_sqft: float
media_filtration_rate_inhr: float
Expand All @@ -194,22 +192,22 @@ class TmntFacilityWithRetentionOverride(TmntFacility):
)


class FlowAndRetFacility(OnlineFaciltyBase):
class FlowAndRetFacility(FacilityBase):
treatment_rate_cfs: float
area_sqft: float
depth_ft: float
hsg: str
_constructor: str = "flow_and_retention_facility_constructor"


class CisternFacility(OnlineFaciltyBase):
class CisternFacility(FacilityBase):
total_volume_cuft: float
winter_demand_cfs: float = 0.0
summer_demand_cfs: float = 0.0
_constructor: str = "cistern_facility_constructor"


class PermPoolFacility(OnlineFaciltyBase):
class PermPoolFacility(FacilityBase):
pool_volume_cuft: float = 0.0
treatment_volume_cuft: float = 0.0
_constructor: str = "perm_pool_facility_constructor"
Expand Down
2 changes: 1 addition & 1 deletion nereid/nereid/tests/test_api/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
),
(
"validation error",
False,
{
"node_id": "1",
"facility_type": "biofiltration",
Expand Down
1 change: 0 additions & 1 deletion nereid/nereid/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ def generate_random_treatment_facility_request_node(
dct["captured_pct"] = numpy.random.uniform(0.1, 99.0)
del dct["retained_pct"]
dct["design_storm_depth_inches"] = numpy.random.uniform(0.75, 1.5)
dct["is_online"] = True

if "tributary_area_tc_min" in dct:
dct["tributary_area_tc_min"] = int(numpy.random.choice(range(5, 60, 5)))
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ async-app =
dev =
nereid[async-app]
black==22.1.0
codecov
coverage>=6.0.0
isort>=5.0.0
mypy>=0.910
Expand Down