generated from NOAA-OWP/owp-open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Cached FIM - Part 1a - Initial VPP Workflow Implementation #604
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
8c74350
Lambda Shared Funcs - Update to Database class to support Redshift co…
TylerSchrag-NOAA bcae929
Updates to postprocess_sql to support new fim caching queries (still …
TylerSchrag-NOAA 4c8db8b
FIM data prep lambda function - Updates so support caching (still nee…
TylerSchrag-NOAA 74fb4aa
HAND FIM Processsing Lambda - Updates to support new caching schemas.
TylerSchrag-NOAA 039b142
BIG Update - Making columns in max flows tables generic, instead of l…
TylerSchrag-NOAA 65e7d39
Additional Max Flows Changes
TylerSchrag-NOAA 090bf19
Lambda Shared Funcs Layer - Case fix to support Redshift connections
TylerSchrag-NOAA 9a87271
More viz_db_postprocess_sql logic changes / clean up to support step …
TylerSchrag-NOAA 2377211
fim data prep - more tweaks / clean up for cached fim.
TylerSchrag-NOAA 4869d13
Fixes to new generalized max_flows field name.
TylerSchrag-NOAA 29fd4a2
viz initialize pipeline - inundation product configs - new domain flo…
TylerSchrag-NOAA ed91adf
Adding connection.close on db connectios from viz_db_ingest lambda fu…
TylerSchrag-NOAA 2f3d740
viz_postprocess_sql fixes, including moving fim_flows folder from fim…
TylerSchrag-NOAA 8b6cf62
Big refactor of fim_data_prep lambda function, including deletion of …
TylerSchrag-NOAA e8095fd
Big refactor / simplification to fim_data_prep lambda function / remo…
TylerSchrag-NOAA 87f104a
Some tweaks to postprocess_sql lambda function (still needs some work…
TylerSchrag-NOAA 50a412c
Bug/typo fix to the lambda layers output.
TylerSchrag-NOAA c3cfcd1
Postprocess SQL Lambda clean-up and documentation for new FIM workflows
TylerSchrag-NOAA ca3308e
Bug fix: Properly cache reaches that have no valid rating curve step.
TylerSchrag-NOAA 015c2fc
Adding some extra documentation to cached fim template sql files.
TylerSchrag-NOAA 31a6a1c
Viz Pipeline Step Function Logic Update
TylerSchrag-NOAA File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
54 changes: 54 additions & 0 deletions
54
...stprocess_sql/fim_caching_templates/0a_redshift_create_inundation_tables_if_not_exist.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,54 @@ | ||
-- This creates the four tables on a Redshift db needed for a cached fim pipeline run. | ||
-- These four tables exist on both RDS and Redshift, so any changes here will need to be synced with the RDS version as well - 0b_rds_create_inundation_tables_if_not_exist.sql | ||
CREATE TABLE IF NOT EXISTS {rs_fim_table}_flows | ||
( | ||
feature_id integer, | ||
hydro_id integer, | ||
huc8 INTEGER, | ||
branch bigint, | ||
reference_time text, | ||
discharge_cms double precision, | ||
discharge_cfs double precision, | ||
prc_status text, | ||
PRIMARY KEY("hydro_id", "feature_id", "huc8", "branch") | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS {rs_fim_table} ( | ||
hydro_id integer, | ||
feature_id integer, | ||
huc8 integer, | ||
branch bigint, | ||
forecast_discharge_cfs double precision, | ||
forecast_stage_ft double precision, | ||
rc_discharge_cfs double precision, | ||
rc_previous_discharge_cfs double precision, | ||
rc_stage_ft double precision, | ||
rc_previous_stage_ft double precision, | ||
max_rc_discharge_cfs double precision, | ||
max_rc_stage_ft double precision, | ||
fim_version text, | ||
reference_time text, | ||
prc_method text, | ||
PRIMARY KEY("hydro_id", "feature_id", "huc8", "branch") | ||
) DISTSTYLE AUTO; | ||
|
||
CREATE TABLE IF NOT EXISTS {rs_fim_table}_geo ( | ||
hydro_id integer, | ||
feature_id integer, | ||
huc8 INTEGER, | ||
branch bigint, | ||
rc_stage_ft integer, | ||
geom_part integer, | ||
geom geometry | ||
) DISTSTYLE AUTO; | ||
|
||
CREATE TABLE IF NOT EXISTS {rs_fim_table}_zero_stage | ||
( | ||
feature_id integer, | ||
hydro_id integer, | ||
huc8 INTEGER, | ||
branch bigint, | ||
rc_discharge_cms double precision, | ||
note text, | ||
PRIMARY KEY("hydro_id", "feature_id", "huc8", "branch") | ||
); |
70 changes: 70 additions & 0 deletions
70
...db_postprocess_sql/fim_caching_templates/0b_rds_create_inundation_tables_if_not_exist.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,70 @@ | ||
-- This creates the four tables on a RDS db needed for a cached fim pipeline run. | ||
-- These four tables exist on both RDS and Redshift, so any changes here will need to be synced with the Redshift version as well - 0a_redshift_create_inundation_tables_if_not_exist.sql | ||
CREATE TABLE IF NOT EXISTS {db_fim_table}_flows | ||
( | ||
hydro_id integer, | ||
feature_id integer, | ||
huc8 integer, | ||
branch bigint, | ||
reference_time text, | ||
discharge_cms double precision, | ||
discharge_cfs double precision, | ||
prc_status text | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS {db_fim_table} | ||
( | ||
hydro_id integer, | ||
feature_id integer, | ||
huc8 integer, | ||
branch bigint, | ||
forecast_discharge_cfs double precision, | ||
forecast_stage_ft double precision, | ||
rc_discharge_cfs double precision, | ||
rc_previous_discharge_cfs double precision, | ||
rc_stage_ft integer, | ||
rc_previous_stage_ft double precision, | ||
max_rc_stage_ft double precision, | ||
max_rc_discharge_cfs double precision, | ||
fim_version text, | ||
reference_time text, | ||
prc_method text | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS {db_fim_table}_geo ( | ||
hydro_id integer, | ||
feature_id integer, | ||
huc8 integer, | ||
branch bigint, | ||
rc_stage_ft integer, | ||
geom_part integer, | ||
geom geometry(geometry, 3857) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS {db_fim_table}_zero_stage ( | ||
hydro_id integer, | ||
feature_id integer, | ||
huc8 integer, | ||
branch bigint, | ||
rc_discharge_cms double precision, | ||
note text | ||
); | ||
|
||
-- Create a view that contains subdivided polygons in WKT text, for import into Redshift | ||
CREATE OR REPLACE VIEW {db_fim_table}_geo_view AS | ||
SELECT fim_subdivide.hydro_id, | ||
fim_subdivide.feature_id, | ||
fim_subdivide.huc8, | ||
fim_subdivide.branch, | ||
fim_subdivide.rc_stage_ft, | ||
0 AS geom_part, | ||
st_astext(fim_subdivide.geom) AS geom_wkt | ||
FROM ( SELECT fim.hydro_id, | ||
fim.feature_id, | ||
fim.huc8, | ||
fim.branch, | ||
fim.rc_stage_ft, | ||
st_subdivide(fim_geo.geom) AS geom | ||
FROM {db_fim_table} fim | ||
JOIN {db_fim_table}_geo fim_geo ON fim.hydro_id = fim_geo.hydro_id AND fim.feature_id = fim_geo.feature_id AND fim.huc8 = fim_geo.huc8 AND fim.branch = fim_geo.branch AND fim.rc_stage_ft = fim_geo.rc_stage_ft | ||
WHERE fim.prc_method = 'HAND_Processing'::text) fim_subdivide; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong.