Skip to content

Commit

Permalink
Added is_interval column and misc adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
RobHanna-NOAA committed Jan 21, 2025
1 parent 64e6189 commit 698330a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 7 additions & 3 deletions tools/catfim/generate_categorical_fim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion tools/catfim/generate_categorical_fim_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand All @@ -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,
)
Expand Down Expand Up @@ -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,
):
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 698330a

Please sign in to comment.