generated from NOAA-OWP/owp-open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #764 from NOAA-OWP/gfs_hfm_alaska
Added sql, mapx, and yml files to generate the new Alaska GFS 10-Day High Flow Mag service - issue #734 .
- Loading branch information
Showing
4 changed files
with
3,043 additions
and
0 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
...ss_sql/products/medium_range_alaska_mem1/mrf_gfs_10day_max_high_flow_magnitude_alaska.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
DROP TABLE IF EXISTS publish.mrf_gfs_10day_max_high_flow_magnitude_ak; | ||
WITH high_flow_mag AS ( | ||
SELECT maxflows_10day.feature_id, | ||
maxflows_3day.discharge_cfs AS maxflow_3day_cfs, | ||
maxflows_5day.discharge_cfs AS maxflow_5day_cfs, | ||
maxflows_10day.discharge_cfs AS maxflow_10day_cfs, | ||
maxflows_10day.nwm_vers, | ||
maxflows_10day.reference_time, | ||
CASE | ||
WHEN maxflows_3day.discharge_cfs >= thresholds.rf_50_0_17c THEN '2'::text | ||
WHEN maxflows_3day.discharge_cfs >= thresholds.rf_25_0_17c THEN '4'::text | ||
WHEN maxflows_3day.discharge_cfs >= thresholds.rf_10_0_17c THEN '10'::text | ||
WHEN maxflows_3day.discharge_cfs >= thresholds.rf_5_0_17c THEN '20'::text | ||
WHEN maxflows_3day.discharge_cfs >= thresholds.rf_2_0_17c THEN '50'::text | ||
WHEN maxflows_3day.discharge_cfs >= thresholds.high_water_threshold THEN '>50'::text | ||
ELSE NULL::text | ||
END AS recur_cat_3day, | ||
CASE | ||
WHEN maxflows_5day.discharge_cfs >= thresholds.rf_50_0_17c THEN '2'::text | ||
WHEN maxflows_5day.discharge_cfs >= thresholds.rf_25_0_17c THEN '4'::text | ||
WHEN maxflows_5day.discharge_cfs >= thresholds.rf_10_0_17c THEN '10'::text | ||
WHEN maxflows_5day.discharge_cfs >= thresholds.rf_5_0_17c THEN '20'::text | ||
WHEN maxflows_5day.discharge_cfs >= thresholds.rf_2_0_17c THEN '50'::text | ||
WHEN maxflows_5day.discharge_cfs >= thresholds.high_water_threshold THEN '>50'::text | ||
ELSE NULL::text | ||
END AS recur_cat_5day, | ||
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_gfs_10day_ak AS maxflows_10day | ||
JOIN cache.max_flows_mrf_gfs_5day_ak AS maxflows_5day ON maxflows_10day.feature_id = maxflows_5day.feature_id | ||
JOIN cache.max_flows_mrf_gfs_3day_ak AS maxflows_3day ON maxflows_10day.feature_id = maxflows_3day.feature_id | ||
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_3day_cfs, | ||
high_flow_mag.maxflow_5day_cfs, | ||
high_flow_mag.maxflow_10day_cfs, | ||
high_flow_mag.recur_cat_3day, | ||
high_flow_mag.recur_cat_5day, | ||
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_gfs_10day_max_high_flow_magnitude_ak | ||
FROM derived.channels_alaska channels | ||
JOIN high_flow_mag ON channels.feature_id = high_flow_mag.feature_id; |
35 changes: 35 additions & 0 deletions
35
...ine/product_configs/medium_range_alaska_mem1/mrf_gfs_10day_max_high_flow_magnitude_ak.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
product: mrf_gfs_10day_max_high_flow_magnitude_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_mem1 | ||
target_keys: (feature_id, streamflow) | ||
|
||
db_max_flows: | ||
- name: mrf_gfs_3day_max_flows_ak | ||
target_table: cache.max_flows_mrf_gfs_3day_ak | ||
target_keys: (feature_id, streamflow) | ||
method: database | ||
max_flows_sql_file: mrf_gfs_3day_max_flows_ak | ||
- name: mrf_gfs_5day_max_flows_ak | ||
target_table: cache.max_flows_mrf_gfs_5day_ak | ||
target_keys: (feature_id, streamflow) | ||
method: database | ||
max_flows_sql_file: mrf_gfs_5day_max_flows_ak | ||
- name: mrf_gfs_10day_max_flows_ak | ||
target_table: cache.max_flows_mrf_gfs_10day_ak | ||
target_keys: (feature_id, streamflow) | ||
method: database | ||
max_flows_sql_file: mrf_gfs_10day_max_flows_ak | ||
|
||
postprocess_sql: | ||
- sql_file: mrf_gfs_10day_max_high_flow_magnitude_ak | ||
target_table: publish.mrf_gfs_10day_max_high_flow_magnitude_ak | ||
|
||
services: | ||
- mrf_gfs_10day_max_high_flow_magnitude_alaska_noaa |
Oops, something went wrong.