Skip to content

Commit

Permalink
Update rfc_max_forecast.yml (#625)
Browse files Browse the repository at this point in the history
This change had been left out of my #621 PR on accident. This has
already been hard-coded directly on TI to confirm it corrects my issue
(so no need for an immediate redeploy). Everything is now working as
expected.
  • Loading branch information
shawncrawley authored Feb 16, 2024
1 parent e145e16 commit 2abed0e
Show file tree
Hide file tree
Showing 3 changed files with 197 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,36 @@ flood_forecasts AS (
AND flood.product_time = relevant_forecasts.product_time
),

forecast_initial_flood_point AS (
SELECT DISTINCT ON (lid)
ff.lid,
ff.pe,
ff.product_time,
ff.value,
CASE
WHEN cat.major IS NOT NULL AND ff.value >= cat.major
THEN 'major'
WHEN cat.moderate IS NOT NULL AND ff.value >= cat.moderate
THEN 'moderate'
WHEN cat.minor IS NOT NULL AND ff.value >= cat.minor
THEN 'minor'
WHEN cat.action IS NOT NULL AND ff.value >= cat.action
THEN 'action'
ELSE 'no_flooding'
END as status,
ff.units,
ff.valid_time as timestep
FROM flood_forecasts ff
LEFT JOIN relevant_thresholds cat
ON cat.lid = ff.lid
WHERE value >= COALESCE(cat.action, cat.minor, cat.moderate, cat.major)
ORDER BY
lid,
pe,
product_time,
valid_time
),

forecast_initial_values AS (
SELECT DISTINCT ON (lid, pe, product_time)
lid,
Expand Down Expand Up @@ -324,6 +354,9 @@ service_data AS (
to_char(initial.timestep, 'YYYY-MM-DD HH24:MI:SS UTC') AS initial_value_timestep,
initial.value as initial_value,
initial.status as initial_status,
to_char(flood.timestep, 'YYYY-MM-DD HH24:MI:SS UTC') AS initial_flood_value_timestep,
flood.value as initial_flood_value,
flood.status as initial_flood_status,
to_char(min.timestep, 'YYYY-MM-DD HH24:MI:SS UTC') as min_value_timestep,
min.value as min_value,
min.status as min_status,
Expand Down Expand Up @@ -355,6 +388,8 @@ service_data AS (
ON xwalk.nws_station_id = base.lid
LEFT JOIN relevant_thresholds cats
ON cats.lid = base.lid AND cats.units = base.units
LEFT JOIN forecast_initial_flood_point flood
ON flood.lid = base.lid and flood.pe = base.pe
ORDER BY nws_lid
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,9 @@ configuration: rfc
product_type: "vector"
run: true

ingest_files:
- file_format: max_stage/ahps/{{datetime:%Y%m%d}}/{{datetime:%H_%M}}_ahps_forecasts.csv
file_step: None
file_window: None
target_table: ingest.ahps_forecasts
target_keys: (nws_lid)
- file_format: max_stage/ahps/{{datetime:%Y%m%d}}/{{datetime:%H_%M}}_ahps_metadata.csv
file_step: None
file_window: None
target_table: ingest.ahps_metadata
target_keys: (nws_lid)

postprocess_sql:
- sql_file: rfc_max_forecast
target_table: publish.rfc_max_forecast

services:
- rfc_max_forecast
- rfc_max_forecast
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,34 @@
"visible" : true,
"searchMode" : "Exact"
},
{
"type" : "CIMFieldDescription",
"alias" : "Forecast Initial Flood Value",
"fieldName" : "initial_flood_value",
"numberFormat" : {
"type" : "CIMNumericFormat",
"alignmentOption" : "esriAlignRight",
"alignmentWidth" : 0,
"roundingOption" : "esriRoundNumberOfDecimals",
"roundingValue" : 6
},
"visible" : true,
"searchMode" : "Exact"
},
{
"type" : "CIMFieldDescription",
"alias" : "Forecast Initial Flood Status",
"fieldName" : "initial_flood_status",
"visible" : true,
"searchMode" : "Exact"
},
{
"type" : "CIMFieldDescription",
"alias" : "Forecast Initial Flood Value Timestep",
"fieldName" : "initial_flood_value_timestep",
"visible" : true,
"searchMode" : "Exact"
},
{
"type" : "CIMFieldDescription",
"alias" : "Forecast Max Value",
Expand Down Expand Up @@ -445,7 +473,7 @@
"workspaceFactory" : "SDE",
"dataset" : "hydrovis.services.%Maximum Status - Forecast Trend_1_1_1_1_1",
"datasetType" : "esriDTFeatureClass",
"sqlQuery" : "select nws_lid,initial_value,initial_status,initial_value_timestep,min_value,min_status,min_value_timestep,max_value,max_status,max_value_timestep,forecast_trend,producer,issuer,issued_time,generation_time,usgs_site_code,feature_id::text,nws_name,usgs_name,geom,action_threshold,minor_threshold,moderate_threshold,major_threshold,CASE WHEN is_record_forecast IS true THEN 'true'::TEXT ELSE 'false'::TEXT END AS is_record_forecast,record_threshold,units,hydrograph_link,hefs_link,update_time,oid from hydrovis.services.rfc_max_forecast",
"sqlQuery" : "select nws_lid,initial_value,initial_status,initial_value_timestep,min_value,min_status,min_value_timestep,initial_flood_value,initial_flood_status,initial_flood_value_timestep,max_value,max_status,max_value_timestep,forecast_trend,producer,issuer,issued_time,generation_time,usgs_site_code,feature_id::text,nws_name,usgs_name,geom,action_threshold,minor_threshold,moderate_threshold,major_threshold,CASE WHEN is_record_forecast IS true THEN 'true'::TEXT ELSE 'false'::TEXT END AS is_record_forecast,record_threshold,units,hydrograph_link,hefs_link,update_time,oid from hydrovis.services.rfc_max_forecast",
"srid" : "3857",
"spatialReference" : {
"wkid" : 102100,
Expand Down Expand Up @@ -494,6 +522,23 @@
"alias" : "min_value_timestep",
"length" : 25
},
{
"name" : "initial_flood_value",
"type" : "esriFieldTypeDouble",
"alias" : "initial_flood_value"
},
{
"name" : "initial_flood_status",
"type" : "esriFieldTypeString",
"alias" : "initial_flood_status",
"length" : 15
},
{
"name" : "initial_flood_value_timestep",
"type" : "esriFieldTypeString",
"alias" : "initial_flood_value_timestep",
"length" : 25
},
{
"name" : "max_value",
"type" : "esriFieldTypeDouble",
Expand Down Expand Up @@ -889,6 +934,7 @@
{
"type" : "CIMVectorMarker",
"enable" : true,
"name" : "Group 13",
"anchorPointUnits" : "Relative",
"dominantSizeAxis3D" : "Z",
"size" : 4,
Expand Down Expand Up @@ -994,6 +1040,7 @@
{
"type" : "CIMVectorMarker",
"enable" : true,
"name" : "Group 1",
"anchorPointUnits" : "Relative",
"dominantSizeAxis3D" : "Z",
"size" : 9,
Expand Down Expand Up @@ -1098,6 +1145,7 @@
{
"type" : "CIMVectorMarker",
"enable" : true,
"name" : "Group 2",
"anchorPointUnits" : "Relative",
"dominantSizeAxis3D" : "Z",
"size" : 9,
Expand Down Expand Up @@ -1205,6 +1253,7 @@
{
"type" : "CIMVectorMarker",
"enable" : true,
"name" : "Group 3",
"anchorPointUnits" : "Relative",
"dominantSizeAxis3D" : "Z",
"rotation" : 180,
Expand Down Expand Up @@ -1311,6 +1360,7 @@
{
"type" : "CIMVectorMarker",
"enable" : true,
"name" : "Group 4",
"anchorPointUnits" : "Relative",
"dominantSizeAxis3D" : "Z",
"size" : 9,
Expand Down Expand Up @@ -1416,6 +1466,7 @@
{
"type" : "CIMVectorMarker",
"enable" : true,
"name" : "Group 5",
"anchorPointUnits" : "Relative",
"dominantSizeAxis3D" : "Z",
"size" : 9,
Expand Down Expand Up @@ -1523,6 +1574,7 @@
{
"type" : "CIMVectorMarker",
"enable" : true,
"name" : "Group 6",
"anchorPointUnits" : "Relative",
"dominantSizeAxis3D" : "Z",
"rotation" : 180,
Expand Down Expand Up @@ -1628,6 +1680,7 @@
{
"type" : "CIMVectorMarker",
"enable" : true,
"name" : "Group 7",
"anchorPointUnits" : "Relative",
"dominantSizeAxis3D" : "Z",
"size" : 9,
Expand Down Expand Up @@ -1732,6 +1785,7 @@
{
"type" : "CIMVectorMarker",
"enable" : true,
"name" : "Group 8",
"anchorPointUnits" : "Relative",
"dominantSizeAxis3D" : "Z",
"size" : 9,
Expand Down Expand Up @@ -1838,6 +1892,7 @@
{
"type" : "CIMVectorMarker",
"enable" : true,
"name" : "Group 9",
"anchorPointUnits" : "Relative",
"dominantSizeAxis3D" : "Z",
"rotation" : 180,
Expand Down Expand Up @@ -1943,6 +1998,7 @@
{
"type" : "CIMVectorMarker",
"enable" : true,
"name" : "Group 10",
"anchorPointUnits" : "Relative",
"dominantSizeAxis3D" : "Z",
"size" : 8,
Expand Down Expand Up @@ -2047,6 +2103,7 @@
{
"type" : "CIMVectorMarker",
"enable" : true,
"name" : "Group 11",
"anchorPointUnits" : "Relative",
"dominantSizeAxis3D" : "Z",
"size" : 8,
Expand Down Expand Up @@ -2153,6 +2210,7 @@
{
"type" : "CIMVectorMarker",
"enable" : true,
"name" : "Group 12",
"anchorPointUnits" : "Relative",
"dominantSizeAxis3D" : "Z",
"rotation" : 180,
Expand Down Expand Up @@ -2253,7 +2311,61 @@
"polygonSymbolColorTarget" : "Fill"
},
"scaleSymbols" : true,
"snappable" : true
"snappable" : true,
"symbolLayerDrawing" : {
"type" : "CIMSymbolLayerDrawing",
"symbolLayers" : [
{
"type" : "CIMSymbolLayerIdentifier",
"symbolLayerName" : "Group 1"
},
{
"type" : "CIMSymbolLayerIdentifier",
"symbolLayerName" : "Group 2"
},
{
"type" : "CIMSymbolLayerIdentifier",
"symbolLayerName" : "Group 3"
},
{
"type" : "CIMSymbolLayerIdentifier",
"symbolLayerName" : "Group 4"
},
{
"type" : "CIMSymbolLayerIdentifier",
"symbolLayerName" : "Group 5"
},
{
"type" : "CIMSymbolLayerIdentifier",
"symbolLayerName" : "Group 6"
},
{
"type" : "CIMSymbolLayerIdentifier",
"symbolLayerName" : "Group 7"
},
{
"type" : "CIMSymbolLayerIdentifier",
"symbolLayerName" : "Group 8"
},
{
"type" : "CIMSymbolLayerIdentifier",
"symbolLayerName" : "Group 9"
},
{
"type" : "CIMSymbolLayerIdentifier",
"symbolLayerName" : "Group 10"
},
{
"type" : "CIMSymbolLayerIdentifier",
"symbolLayerName" : "Group 11"
},
{
"type" : "CIMSymbolLayerIdentifier",
"symbolLayerName" : "Group 12"
}
],
"useSymbolLayerDrawing" : true
}
},
{
"type" : "CIMFeatureLayer",
Expand Down Expand Up @@ -2499,6 +2611,34 @@
"visible" : true,
"searchMode" : "Exact"
},
{
"type" : "CIMFieldDescription",
"alias" : "Forecast Initial Flood Value",
"fieldName" : "initial_flood_value",
"numberFormat" : {
"type" : "CIMNumericFormat",
"alignmentOption" : "esriAlignRight",
"alignmentWidth" : 0,
"roundingOption" : "esriRoundNumberOfDecimals",
"roundingValue" : 6
},
"visible" : true,
"searchMode" : "Exact"
},
{
"type" : "CIMFieldDescription",
"alias" : "Forecast Initial Flood Status",
"fieldName" : "initial_flood_status",
"visible" : true,
"searchMode" : "Exact"
},
{
"type" : "CIMFieldDescription",
"alias" : "Forecast Initial Flood Value Timestep",
"fieldName" : "initial_flood_value_timestep",
"visible" : true,
"searchMode" : "Exact"
},
{
"type" : "CIMFieldDescription",
"alias" : "Forecast Max Value",
Expand Down Expand Up @@ -2591,7 +2731,7 @@
"workspaceFactory" : "SDE",
"dataset" : "hydrovis.services.%Maximum Status - Forecast Trend_1_1_1_1_1",
"datasetType" : "esriDTFeatureClass",
"sqlQuery" : "select nws_lid,initial_value,initial_status,initial_value_timestep,min_value,min_status,min_value_timestep,max_value,max_status,max_value_timestep,forecast_trend,producer,issuer,issued_time,generation_time,usgs_site_code,feature_id::text,nws_name,usgs_name,geom,action_threshold,minor_threshold,moderate_threshold,major_threshold,CASE WHEN is_record_forecast IS true THEN 'true'::TEXT ELSE 'false'::TEXT END AS is_record_forecast,record_threshold,units,hydrograph_link,hefs_link,update_time,oid from hydrovis.services.rfc_max_forecast",
"sqlQuery" : "select nws_lid,initial_value,initial_status,initial_value_timestep,min_value,min_status,min_value_timestep,initial_flood_value,initial_flood_status,initial_flood_value_timestep,max_value,max_status,max_value_timestep,forecast_trend,producer,issuer,issued_time,generation_time,usgs_site_code,feature_id::text,nws_name,usgs_name,geom,action_threshold,minor_threshold,moderate_threshold,major_threshold,CASE WHEN is_record_forecast IS true THEN 'true'::TEXT ELSE 'false'::TEXT END AS is_record_forecast,record_threshold,units,hydrograph_link,hefs_link,update_time,oid from hydrovis.services.rfc_max_forecast",
"srid" : "3857",
"spatialReference" : {
"wkid" : 102100,
Expand Down Expand Up @@ -2640,6 +2780,23 @@
"alias" : "min_value_timestep",
"length" : 25
},
{
"name" : "initial_flood_value",
"type" : "esriFieldTypeDouble",
"alias" : "initial_flood_value"
},
{
"name" : "initial_flood_status",
"type" : "esriFieldTypeString",
"alias" : "initial_flood_status",
"length" : 15
},
{
"name" : "initial_flood_value_timestep",
"type" : "esriFieldTypeString",
"alias" : "initial_flood_value_timestep",
"length" : 25
},
{
"name" : "max_value",
"type" : "esriFieldTypeDouble",
Expand Down Expand Up @@ -3461,4 +3618,4 @@
"data" : "<?xml version=\"1.0\"?>\r\n<metadata xml:lang=\"en\"><Esri><CreaDate>20220302</CreaDate><CreaTime>04592900</CreaTime><ArcGISFormat>1.0</ArcGISFormat><SyncOnce>TRUE</SyncOnce></Esri></metadata>\r\n"
}
]
}
}

0 comments on commit 2abed0e

Please sign in to comment.