From 698330a125c77b27d9a6466560dfceff5f59d00a Mon Sep 17 00:00:00 2001 From: Rob Hanna Date: Tue, 21 Jan 2025 04:25:06 +0000 Subject: [PATCH] Added is_interval column and misc adjustments --- tools/catfim/generate_categorical_fim.py | 10 +++++++--- tools/catfim/generate_categorical_fim_mapping.py | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/catfim/generate_categorical_fim.py b/tools/catfim/generate_categorical_fim.py index c13a9990..eefe31e9 100755 --- a/tools/catfim/generate_categorical_fim.py +++ b/tools/catfim/generate_categorical_fim.py @@ -759,6 +759,9 @@ def iterate_through_huc_stage_based( f"{huc_lid_id}: Lowest stage val > elev and higher than max stage thresh. Subtracted elev from stage vals to fix." ) + # +++++++++++++++++++++++++++++ + # This section is for inundating stages and intervals come later + # At this point we have at least one valid stage/category # cyle through on the stages that are valid # This are not interval values @@ -785,7 +788,6 @@ def iterate_through_huc_stage_based( # These are the up to 5 magnitudes being inundated at their stage value (messages, hand_stage, datum_adj_wse, datum_adj_wse_m) = produce_stage_based_lid_tifs( stage_value, - False, datum_adj_ft, branch_dir, lid_usgs_elev, @@ -845,6 +847,9 @@ def iterate_through_huc_stage_based( # MP_LOG.trace(f"non_rec_stage_values_df is {non_rec_stage_values_df}") + # +++++++++++++++++++++++++++++ + # Creating interval tifs (if applicable) + # We already inundated and created files for the specific stages just not the intervals # Make list of interval recs to be created interval_list = [] # might stay empty @@ -876,7 +881,6 @@ def iterate_through_huc_stage_based( executor.submit( produce_stage_based_lid_tifs, interval_stage_value, - True, datum_adj_ft, branch_dir, lid_usgs_elev, @@ -1153,7 +1157,7 @@ def __calc_stage_intervals(non_rec_stage_values_df, past_major_interval_cap, huc # MP_LOG.trace(f"{huc_lid_id}: Added interval value of {int_val}") stage_values_claimed.append(int_val) - MP_LOG.lprint(f"{huc_lid_id} interval recs are {interval_recs}") + # MP_LOG.lprint(f"{huc_lid_id} interval recs are {interval_recs}") return interval_recs diff --git a/tools/catfim/generate_categorical_fim_mapping.py b/tools/catfim/generate_categorical_fim_mapping.py index f6648f36..cb31a4ec 100755 --- a/tools/catfim/generate_categorical_fim_mapping.py +++ b/tools/catfim/generate_categorical_fim_mapping.py @@ -43,7 +43,6 @@ # we will use an MP object either way def produce_stage_based_lid_tifs( stage_val, - is_interval_stage, datum_adj_ft, branch_dir, lid_usgs_elev, @@ -665,10 +664,12 @@ def post_process_huc( # careful. ft can be part of the site name, so only check part 3 interval_stage = None + is_interval = False if len(file_name_parts) >= 3 and "fti" in file_name_parts[2]: try: stage_val = file_name_parts[2].replace("fti", "") interval_stage = float(stage_val) + is_interval = True except ValueError: interval_stage = None MP_LOG.error( @@ -686,6 +687,7 @@ def post_process_huc( magnitude, nws_lid_attributes_filename, interval_stage, + is_interval, parent_log_output_file, child_log_file_prefix, ) @@ -862,6 +864,7 @@ def reformat_inundation_maps( magnitude, nws_lid_attributes_filename, interval_stage, + is_interval, parent_log_output_file, child_log_file_prefix, ): @@ -914,6 +917,7 @@ def reformat_inundation_maps( extent_poly_diss['version'] = fim_version extent_poly_diss['huc'] = huc extent_poly_diss['interval_stage'] = interval_stage + extent_poly_diss['is_interval'] = is_interval # Project to Web Mercator extent_poly_diss = extent_poly_diss.to_crs(VIZ_PROJECTION)