Skip to content

Commit

Permalink
Merge pull request #832 from NOAA-OWP/gfs_10day_hw_arrival_alaska
Browse files Browse the repository at this point in the history
New service - Alaska MRF GFS 10-day High Water Arrival Time

Added SQL, YML, and MAPX files to create the Alaska MRF GFS 10-day High Water Arrival time service.

Post-process SQL:
Core/LAMBDA/viz_functions/viz_db_postprocess_sql/products/medium_range_alaska_mem1/mrf_gfs_10day_high_water_arrival_time_ak.sql

Product Config YML:
Core/LAMBDA/viz_functions/viz_initialize_pipeline/product_configs/medium_range_alaska_mem1/mrf_gfs_10day_high_water_arrival_time_ak.yml

Publish MAPX and YML:
Core/LAMBDA/viz_functions/viz_publish_service/services/medium_range_alaska_mem1/mrf_gfs_10day_high_water_arrival_time_ak_noaa.mapx
Core/LAMBDA/viz_functions/viz_publish_service/services/medium_range_alaska_mem1/mrf_gfs_10day_high_water_arrival_time_ak_noaa.yml


![image](https://github.com/user-attachments/assets/6cdeb697-766a-4e61-9519-b8570c64cb52)
  • Loading branch information
nickchadwick-noaa authored Aug 21, 2024
2 parents 72607cd + e60b4b8 commit 0aed3e4
Show file tree
Hide file tree
Showing 4 changed files with 20,925 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
DROP TABLE IF EXISTS publish.mrf_gfs_10day_high_water_arrival_time_ak;
WITH arrival_time AS (
SELECT forecasts.feature_id,
min(forecasts.forecast_hour) AS high_water_arrival_hour,
to_char(forecasts.reference_time::timestamp without time zone + INTERVAL '1 hour' * min(forecasts.forecast_hour), 'YYYY-MM-DD HH24:MI:SS UTC') AS high_water_arrival_time,
forecasts.nwm_vers,
forecasts.reference_time,
CASE
WHEN max(forecasts.forecast_hour) >= 240 THEN '> 10 days'::text
ELSE (max(forecasts.forecast_hour)+3)::text
END AS below_bank_return_hour,
to_char(forecasts.reference_time::timestamp without time zone + INTERVAL '1 hour' * (max(forecasts.forecast_hour)+3), 'YYYY-MM-DD HH24:MI:SS UTC') AS below_bank_return_time,
CASE
WHEN max(forecasts.forecast_hour) >= 240 THEN 'Outside MRF Forecast Window'::text
ELSE ((max(forecasts.forecast_hour)+3) - min(forecasts.forecast_hour))::text
END AS duration,
thresholds.high_water_threshold AS high_water_threshold,
round((max(forecasts.streamflow) * 35.315::double precision)::numeric, 2) AS max_flow,
to_char(now()::timestamp without time zone, 'YYYY-MM-DD HH24:MI:SS UTC') AS update_time
FROM ingest.nwm_channel_rt_mrf_gfs_ak_mem1 AS forecasts
JOIN derived.recurrence_flows_ak thresholds ON forecasts.feature_id = thresholds.feature_id
WHERE thresholds.high_water_threshold > 0::double precision AND (forecasts.streamflow * 35.315::double precision) >= thresholds.high_water_threshold
GROUP BY forecasts.feature_id, forecasts.reference_time, forecasts.nwm_vers, thresholds.high_water_threshold
)

SELECT channels.feature_id,
channels.feature_id::TEXT AS feature_id_str,
channels.name,
channels.strm_order,
channels.huc6,
'AK' as state,
arrival_time.nwm_vers,
arrival_time.reference_time,
arrival_time.high_water_arrival_hour,
arrival_time.high_water_arrival_time,
arrival_time.below_bank_return_hour,
arrival_time.below_bank_return_time,
arrival_time.duration,
arrival_time.high_water_threshold,
arrival_time.max_flow,
arrival_time.update_time,
channels.geom
INTO publish.mrf_gfs_10day_high_water_arrival_time_ak
FROM derived.channels_alaska channels
JOIN arrival_time ON channels.feature_id = arrival_time.feature_id;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
product: mrf_gfs_10day_high_water_arrival_time_ak
configuration: medium_range_alaska_mem1
product_type: "vector"
run: true

ingest_files:
- file_format: common/data/model/com/nwm/{{variable:NWM_DATAFLOW_VERSION}}/nwm.{{datetime:%Y%m%d}}/medium_range_alaska_mem1/nwm.t{{datetime:%H}}z.medium_range.channel_rt_1.f{{range:3,243,3,%03d}}.alaska.nc
file_step: None
file_window: None
target_table: ingest.nwm_channel_rt_mrf_gfs_ak_mem1
target_keys: (feature_id, streamflow)

postprocess_sql:
- sql_file: mrf_gfs_10day_high_water_arrival_time_ak
target_table: publish.mrf_gfs_10day_high_water_arrival_time_ak

services:
- mrf_gfs_10day_high_water_arrival_time_ak_noaa
Loading

0 comments on commit 0aed3e4

Please sign in to comment.