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

2024 04 24 fix swmm views #232

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
2 changes: 0 additions & 2 deletions delta/delta_1.6.0_noop.sql

This file was deleted.

4 changes: 4 additions & 0 deletions delta/delta_1.6.2_adapt_swmm_views.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--------
-- Corrections to swmm views 12_vw_swmm_raingages, 08_vw_swmm_outfalls, 02_vw_swmm_junctions and 23_vw_swmm_xsections
--------
SELECT 1;
24 changes: 12 additions & 12 deletions swmm_views/02_vw_swmm_junctions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ SELECT
wn.obj_id as Name,
coalesce(wn.bottom_level,0) as InvertElev,
(co.level-wn.bottom_level) as MaxDepth,
NULL::float as InitDepth,
NULL::float as SurchargeDepth,
NULL::float as PondedArea,
0.0::float as InitDepth, -- default set to 0 instead of NULL
0.0::float as SurchargeDepth, -- default set to 0 instead of NULL
0.0::float as PondedArea, -- default set to 0 instead of NULL
ws.identifier::text as description,
CONCAT_WS(',', 'manhole', mf.value_en) as tag,
wn.situation_geometry as geom,
Expand Down Expand Up @@ -41,9 +41,9 @@ SELECT
wn.obj_id as Name,
coalesce(wn.bottom_level,0) as InvertElev,
(co.level-wn.bottom_level) as MaxDepth,
NULL::float as InitDepth,
NULL::float as SurchargeDepth,
NULL::float as PondedArea,
0.0::float as InitDepth,
0.0::float as SurchargeDepth,
0.0::float as PondedArea,
ws.identifier::text as description,
CONCAT_WS(',','special_structure', ss_fu.value_en) as tag,
wn.situation_geometry as geom,
Expand Down Expand Up @@ -106,9 +106,9 @@ SELECT
coalesce(from_wn.obj_id, concat('from_node@',re.obj_id)) as Name,
coalesce(from_wn.bottom_level, 0) as InvertElev,
0 as MaxDepth,
NULL::float as InitDepth,
NULL::float as SurchargeDepth,
NULL::float as PondedArea,
0.0::float as InitDepth,
0.0::float as SurchargeDepth,
0.0::float as PondedArea,
coalesce(from_wn.obj_id, concat('from_node@',re.obj_id)) as description,
'junction without structure' as tag,
coalesce(from_wn.situation_geometry, ST_StartPoint(re.progression_geometry)) as geom,
Expand Down Expand Up @@ -142,9 +142,9 @@ SELECT
coalesce(to_wn.obj_id, concat('to_node@',re.obj_id)) as Name,
coalesce(to_wn.bottom_level, 0) as InvertElev,
0 as MaxDepth,
NULL::float as InitDepth,
NULL::float as SurchargeDepth,
NULL::float as PondedArea,
0.0::float as InitDepth,
0.0::float as SurchargeDepth,
0.0::float as PondedArea,
coalesce(to_wn.obj_id, concat('to_node@',re.obj_id)) as description,
'junction without structure' as tag,
coalesce(to_wn.situation_geometry, ST_EndPoint(re.progression_geometry)) as geom,
Expand Down
66 changes: 41 additions & 25 deletions swmm_views/08_vw_swmm_outfalls.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,30 @@ CREATE OR REPLACE VIEW qgep_swmm.vw_outfalls AS
SELECT
wn.obj_id as Name,
coalesce(wn.bottom_level,0) as InvertElev,
'FREE'::varchar as Type,
NULL as StageData,
-- 'FREE'::varchar as Type,
CASE
WHEN waterlevel_hydraulic IS NOT NULL THEN 'FIXED'
ELSE 'FREE'
END as Type, -- Type of outfall boundary condition: FREE: outfall stage determined by minimum of critical flow depth and normal flow depth in the connecting conduit. NORMAL: outfall stage based on normal flow depth in the connecting conduit. FIXED: outfall stage set to a fixed value. TIDAL: outfall stage given by a table of tide elevation versus time of day. TIMESERIES: outfall stage supplied from a time series of elevations
-- 0 as StageData,
CASE
WHEN waterlevel_hydraulic IS NOT NULL THEN waterlevel_hydraulic
ELSE 0
END as StageData,
'NO'::varchar as tide_gate,
NULL::varchar as RouteTo,
'0'::varchar as RouteTo,
ws.identifier as description,
dp.obj_id::varchar as tag,
wn.situation_geometry as geom,
CASE
WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned'
ELSE 'current'
END as state,
CASE
WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary'
ELSE 'secondary'
END as hierarchy,
wn.obj_id as obj_id
CASE
WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned'
ELSE 'current'
END as state,
CASE
WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary'
ELSE 'secondary'
END as hierarchy,
wn.obj_id as obj_id
FROM qgep_od.discharge_point as dp
LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = dp.obj_id::text
LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code
Expand All @@ -36,28 +44,36 @@ UNION
SELECT
wn.obj_id as Name,
coalesce(wn.bottom_level,0) as InvertElev,
'FREE'::varchar as Type,
NULL as StageData,
-- 'FREE'::varchar as Type,
CASE
WHEN waterlevel_hydraulic IS NOT NULL THEN 'FIXED'
sjib marked this conversation as resolved.
Show resolved Hide resolved
ELSE 'FREE'
END as Type, -- Type of outfall boundary condition: FREE: outfall stage determined by minimum of critical flow depth and normal flow depth in the connecting conduit. NORMAL: outfall stage based on normal flow depth in the connecting conduit. FIXED: outfall stage set to a fixed value. TIDAL: outfall stage given by a table of tide elevation versus time of day. TIMESERIES: outfall stage supplied from a time series of elevations
-- 0 as StageData,
CASE
WHEN waterlevel_hydraulic IS NOT NULL THEN waterlevel_hydraulic
ELSE 0
END as StageData,
'NO'::varchar as tide_gate,
NULL::varchar as RouteTo,
'0'::varchar as RouteTo,
ws.identifier as description,
ii.obj_id::varchar as tag,
wn.situation_geometry as geom,
CASE
WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned'
ELSE 'current'
END as state,
CASE
WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary'
ELSE 'secondary'
END as hierarchy,
wn.obj_id as obj_id
CASE
WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned'
ELSE 'current'
END as state,
CASE
WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary'
ELSE 'secondary'
END as hierarchy,
wn.obj_id as obj_id
FROM qgep_od.infiltration_installation as ii
LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = ii.obj_id::text
LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code
LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text
LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = we.obj_id
WHERE wn.obj_id IS NOT NULL
AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959)
AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959)
;
8 changes: 4 additions & 4 deletions swmm_views/12_vw_swmm_raingages.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
CREATE OR REPLACE VIEW qgep_swmm.vw_raingages AS
SELECT
('raingage@' || replace(ca.obj_id, ' ', '_'))::varchar as Name,
'INTENSITY'::varchar as Format,
'0:15'::varchar as Interval,
'1.0'::varchar as SCF,
'TIMESERIES default_qgep_raingage_timeserie'::varchar as Source,
'INTENSITY'::varchar as Format, -- Format in which the rain data are supplied: INTENSITY: each rainfall value is an average rate in inches/hour (or mm/hour) over the recording interval. VOLUME: each rainfall value is the volume of rain that fell in the recording interval (in inches or millimeters). CUMULATIVE: each rainfall value represents the cumulative rainfall that has occurred since the start of the last series of non-zero values (in inches or millimeters).
'0:15'::varchar as Interval, -- Recording time interval between gage readings in decimal hours or hours:minutes format.
'1.0'::varchar as SCF, -- Snow Catch Factor Factor that corrects gage readings for snowfall.
'TIMESERIES default_qgep_raingage_timeserie'::varchar as Source, -- Source of rainfall data; either TIMESERIES for user-defined time series data or FILE for an external data file. see Rain Gage Properties of SWMM Documentation for furhter information.
st_centroid(perimeter_geometry)::geometry(Point, %(SRID)s) as geom,
state,
CASE
Expand Down
4 changes: 2 additions & 2 deletions swmm_views/23_vw_swmm_xsections.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ SELECT DISTINCT
WHEN pp.height_width_ratio IS NULL THEN 0.002 --ROMA: TODO default value for width to be set
ELSE 0.002 --ROMA: TODO default value for width to be set
END
ELSE NULL
ELSE 0 -- default set to 0 instead of NULL
END as Geom2,
--Geom3 = code -> used only for arch profile, but this code value is nowhere to be set in the QGEP model
0 as Geom3,
0 as Geom4,
1 as Barrels,
NULL as Culvert,
0 as Culvert, -- default set to 0 instead of NULL
CASE
WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned'
ELSE 'current'
Expand Down
2 changes: 1 addition & 1 deletion system/CURRENT_VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.1
1.6.2
Loading