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

Fim new model version field #951

Merged
merged 2 commits into from
Nov 12, 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
Expand Up @@ -111,7 +111,7 @@ def lambda_handler(event, context):
print(f"catchment, hand, or rating curve are missing for huc {huc8} and branch {branch}:\nCatchment exists: {catch_exists} ({catchment_key})\nHand exists: {hand_exists} ({hand_key})\nRating curve exists: {rating_curve_exists} ({rating_curve_key})")

# If not a reference/egis fim run, Upload zero_stage reaches for tracking / FIM cache
if fim_run_type != 'reference':
if fim_run_type != 'reference' and not df_zero_stage_records.empty:
print(f"Adding zero stage data to {db_table}_zero_stage")# Only process inundation configuration if available data
df_zero_stage_records = df_zero_stage_records.reset_index()
df_zero_stage_records.drop(columns=['hydro_id','feature_id'], inplace=True)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
-- This creates the four tables on a RDS db needed for a cached fim pipeline run.
CREATE TABLE IF NOT EXISTS {db_fim_table}_flows
DROP TABLE IF EXISTS {db_fim_table}_flows;

CREATE TABLE {db_fim_table}_flows
(
hand_id integer,
hydro_id integer,
Expand All @@ -12,7 +14,9 @@ CREATE TABLE IF NOT EXISTS {db_fim_table}_flows
prc_status text
);

CREATE TABLE IF NOT EXISTS {db_fim_table}
DROP TABLE IF EXISTS {db_fim_table};

CREATE TABLE {db_fim_table}
(
hand_id integer,
forecast_discharge_cfs double precision,
Expand All @@ -29,20 +33,18 @@ CREATE TABLE IF NOT EXISTS {db_fim_table}
prc_method text
);

CREATE TABLE IF NOT EXISTS {db_fim_table}_geo (
DROP TABLE IF EXISTS {db_fim_table}_geo;

CREATE TABLE {db_fim_table}_geo (
hand_id integer,
rc_stage_ft integer,
geom geometry(geometry, 3857)
);

CREATE TABLE IF NOT EXISTS {db_fim_table}_zero_stage (
DROP TABLE IF EXISTS {db_fim_table}_zero_stage;

CREATE TABLE {db_fim_table}_zero_stage (
hand_id integer,
rc_discharge_cms double precision,
note text
);

-- Truncate the tables so they are ready for the FIM Config run
TRUNCATE {db_fim_table}_flows;
TRUNCATE {db_fim_table};
TRUNCATE {db_fim_table}_geo;
TRUNCATE {db_fim_table}_zero_stage;
);
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
INSERT INTO {db_fim_table} (
hand_id, forecast_discharge_cfs,
rc_discharge_cfs, rc_previous_discharge_cfs, rc_stage_ft, rc_previous_stage_ft,
max_rc_stage_ft, max_rc_discharge_cfs, fim_version, model_version, reference_time, prc_method
max_rc_stage_ft, max_rc_discharge_cfs, model_version, fim_version, reference_time, prc_method
)

SELECT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Query the hand cache.
INSERT INTO {db_fim_table} (
hand_id, forecast_discharge_cfs, rc_discharge_cfs, rc_previous_discharge_cfs, rc_stage_ft, rc_previous_stage_ft,
max_rc_stage_ft, max_rc_discharge_cfs, fim_version, model_version, reference_time, prc_method
max_rc_stage_ft, max_rc_discharge_cfs, model_version, fim_version, reference_time, prc_method
)
SELECT
fs.hand_id,
Expand Down
Loading