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

New service - Alaska MRF NBM 10-Day High Flow Mag #801

Merged
merged 5 commits into from
Aug 21, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
DROP TABLE IF EXISTS publish.mrf_nbm_10day_max_high_flow_magnitude_ak;
WITH high_flow_mag AS (
SELECT maxflows_10day.feature_id,
maxflows_10day.discharge_cfs AS maxflow_10day_cfs,
maxflows_10day.nwm_vers,
maxflows_10day.reference_time,
CASE
WHEN maxflows_10day.discharge_cfs >= thresholds.rf_50_0_17c THEN '2'::text
WHEN maxflows_10day.discharge_cfs >= thresholds.rf_25_0_17c THEN '4'::text
WHEN maxflows_10day.discharge_cfs >= thresholds.rf_10_0_17c THEN '10'::text
WHEN maxflows_10day.discharge_cfs >= thresholds.rf_5_0_17c THEN '20'::text
WHEN maxflows_10day.discharge_cfs >= thresholds.rf_2_0_17c THEN '50'::text
WHEN maxflows_10day.discharge_cfs >= thresholds.high_water_threshold THEN '>50'::text
ELSE NULL::text
END AS recur_cat_10day,
thresholds.high_water_threshold AS high_water_threshold,
thresholds.rf_2_0_17c AS flow_2yr,
thresholds.rf_5_0_17c AS flow_5yr,
thresholds.rf_10_0_17c AS flow_10yr,
thresholds.rf_25_0_17c AS flow_25yr,
thresholds.rf_50_0_17c AS flow_50yr
FROM cache.max_flows_mrf_nbm_10day_ak AS maxflows_10day
JOIN derived.recurrence_flows_ak thresholds ON maxflows_10day.feature_id = thresholds.feature_id
WHERE (thresholds.high_water_threshold > 0::double precision) AND maxflows_10day.discharge_cfs >= thresholds.high_water_threshold
)

SELECT channels.feature_id,
channels.feature_id::TEXT AS feature_id_str,
channels.strm_order,
channels.name,
channels.huc6,
'AK' as state,
high_flow_mag.nwm_vers,
high_flow_mag.reference_time,
high_flow_mag.maxflow_10day_cfs,
high_flow_mag.recur_cat_10day,
high_flow_mag.high_water_threshold,
high_flow_mag.flow_2yr,
high_flow_mag.flow_5yr,
high_flow_mag.flow_10yr,
high_flow_mag.flow_25yr,
high_flow_mag.flow_50yr,
to_char(now()::timestamp without time zone, 'YYYY-MM-DD HH24:MI:SS UTC') AS update_time,
channels.geom
INTO publish.mrf_nbm_10day_max_high_flow_magnitude_ak
FROM derived.channels_alaska channels
JOIN high_flow_mag ON channels.feature_id = high_flow_mag.feature_id;
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
product: mrf_nbm_10day_max_high_flow_magnitude_ak
configuration: medium_range_blend_alaska
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_blend_alaska/nwm.t{{datetime:%H}}z.medium_range_blend.channel_rt.f{{range:3,243,3,%03d}}.alaska.nc
file_step: None
file_window: None
target_table: ingest.nwm_channel_rt_mrf_nbm_ak
target_keys: (feature_id, streamflow)

db_max_flows:
- name: mrf_nbm_10day_max_flows
target_table: cache.max_flows_mrf_nbm_10day_ak
target_keys: (feature_id, streamflow)
method: database
max_flows_sql_file: mrf_nbm_10day_max_flows_ak

postprocess_sql:
- sql_file: mrf_nbm_10day_max_high_flow_magnitude_ak
target_table: publish.mrf_nbm_10day_max_high_flow_magnitude_ak

services:
- mrf_nbm_10day_max_high_flow_magnitude_ak_noaa
Loading
Loading