-
Notifications
You must be signed in to change notification settings - Fork 4
water-elevation-layer #591
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -336,16 +336,60 @@ def test_ogc_water_elevation_wells_computes_elevation_minus_depth_to_water( | |
|
|
||
| row = session.execute( | ||
| text( | ||
| "SELECT elevation, depth_to_water_below_ground_surface, water_elevation " | ||
| "SELECT elevation_m, depth_to_water_below_ground_surface_ft, water_elevation_ft " | ||
| "FROM ogc_water_elevation_wells WHERE id = :thing_id" | ||
| ), | ||
| {"thing_id": water_well_thing.id}, | ||
| ).one() | ||
|
|
||
| assert float(row.depth_to_water_below_ground_surface) == 5.0 | ||
| assert float(row.elevation) == 2464.9 | ||
| assert float(row.depth_to_water_below_ground_surface_ft) == 5.0 | ||
| assert float(row.elevation_m) == 2464.9 | ||
| expected_water_elevation_ft = (2464.9 * 3.28084) - 5.0 | ||
| assert abs(float(row.water_elevation) - expected_water_elevation_ft) < 1e-9 | ||
| assert abs(float(row.water_elevation_ft) - expected_water_elevation_ft) < 1e-9 | ||
|
|
||
|
|
||
| def test_ogc_water_elevation_wells_normalizes_meter_observations_to_feet( | ||
| water_well_thing, groundwater_level_observation | ||
| ): | ||
| with session_ctx() as session: | ||
| meter_observation = groundwater_level_observation.__class__( | ||
| observation_datetime=datetime(2025, 1, 2, 0, 4, 0), | ||
| sample_id=groundwater_level_observation.sample_id, | ||
|
Comment on lines
+355
to
+357
|
||
| sensor_id=groundwater_level_observation.sensor_id, | ||
| parameter_id=groundwater_level_observation.parameter_id, | ||
| release_status="draft", | ||
| value=3.0, | ||
| unit="m", | ||
| measuring_point_height=2.0, | ||
| groundwater_level_reason="Water level not affected", | ||
| ) | ||
| session.add(meter_observation) | ||
| session.commit() | ||
|
|
||
| session.execute(text("REFRESH MATERIALIZED VIEW ogc_water_elevation_wells")) | ||
| session.commit() | ||
|
|
||
| row = session.execute( | ||
| text( | ||
| "SELECT depth_to_water_below_ground_surface_ft, water_elevation_ft " | ||
| "FROM ogc_water_elevation_wells WHERE id = :thing_id" | ||
| ), | ||
| {"thing_id": water_well_thing.id}, | ||
| ).one() | ||
|
|
||
| expected_depth_ft = (3.0 * 3.28084) - 2.0 | ||
| expected_water_elevation_ft = (2464.9 * 3.28084) - expected_depth_ft | ||
|
|
||
| assert ( | ||
| abs(float(row.depth_to_water_below_ground_surface_ft) - expected_depth_ft) | ||
| < 1e-9 | ||
| ) | ||
| assert abs(float(row.water_elevation_ft) - expected_water_elevation_ft) < 1e-9 | ||
|
|
||
| session.delete(meter_observation) | ||
| session.commit() | ||
| session.execute(text("REFRESH MATERIALIZED VIEW ogc_water_elevation_wells")) | ||
| session.commit() | ||
|
|
||
|
|
||
| def test_ogc_collections(): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ftbgsunits when selecting groundwater observationsThe new unit whitelist in
_create_water_elevation_view()excludes observations whose unit isftbgs, even thoughftbgsis a valid lexicon unit (core/lexicon.json, around line 843). For wells whose latest (or only) groundwater-level observation usesftbgs, this CTE now drops the record entirely, soogc_water_elevation_wellscan lose rows after this migration. Please add handling forftbgs(and its depth semantics) instead of filtering it out.Useful? React with 👍 / 👎.