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

[18p] REM w/ Ripple #1419

Open
hhs732 opened this issue Feb 3, 2025 · 4 comments
Open

[18p] REM w/ Ripple #1419

hhs732 opened this issue Feb 3, 2025 · 4 comments
Assignees
Labels
enhancement New feature or request NGWPC Tasks on NGWPC Contracts

Comments

@hhs732
Copy link
Contributor

hhs732 commented Feb 3, 2025

We are trying to apply the REM idea in Ripple output, then we can use the REM and rating curves idea in HydroVIS, instead of dealing with multiple depth layers.

@hhs732 hhs732 self-assigned this Feb 3, 2025
@hhs732 hhs732 added enhancement New feature or request NGWPC Tasks on NGWPC Contracts labels Feb 3, 2025
@hhs732 hhs732 changed the title Ripple&flows2fim analysis Ripple & flows2fim analysis Feb 3, 2025
@hhs732 hhs732 changed the title Ripple & flows2fim analysis REM w/ Ripple Feb 3, 2025
@hhs732
Copy link
Contributor Author

hhs732 commented Feb 3, 2025

The idea of just using the max flow depth layer will not work, because the location of max depth pixel is changing across a reach.

Max depth pixel for flows 275 to 4034 cfs:

Image

Max depth pixel for flows higher than 4655 cfs:

Image

@hhs732 hhs732 changed the title REM w/ Ripple [18p] REM w/ Ripple Feb 4, 2025
@hhs732
Copy link
Contributor Author

hhs732 commented Feb 4, 2025

Algorithem for 2 tiff files of A1 and A2:

Step1: In A1, find the max value (stage) and update A1 cells by subtracting the max from all values above zero (== A1_rem)

Step2: In A2, find the max of A2 and update A2 cells by subtracting all cells above zero from the A2 max, but only do it in cells of A2 that has not been updated in A1. In this step A1 cells updated in step1 will be masked out (== A2_rem).

Step3: in A2, replace the value of rest of A2 cells (not updated in step 2) with A1 cells values. So, only A2 cells that has not be updated in step2 will be replaced (== final_rem).

Step4: Replace zero (0) values in final_rem with the A2 max value (A2 stage) with masking A1_rem

@hhs732
Copy link
Contributor Author

hhs732 commented Feb 4, 2025

A1 = np.array([[0,1,0,0,0,0],
               [0,1,2,1,0,1],
               [3,4,6,2,0,2],
               [4,5,8,3,1,3],
               [3,4,6,1,0,1],
               [0,0,0,0,0,0]])

A2 = np.array([[0,2,1,0,0,0],
               [0,2,2,1,1,1],
               [3,4,6,2,2,2],
               [4,6,8,4,3,3],
               [3,5,9,2,0,2],
               [0,0,1,0,0,0]])

# Step 1: Update A1
stage_A1 = np.nanmax(A1)  # Find max value in A1, ignoring NaN
A1_rem = np.where(A1 > 0, stage_A1 - A1, A1)
print(A1_rem)

# Step 2: Update A2
stage_A2 = np.nanmax(A2)  # Find max value in A2, ignoring NaN
mask_A1_rem = (A1_rem != A1)  # Mask of cells updated in A1
print(mask_A1_rem)
A2_rem = np.where((A2 > 0) & ~ mask_A1_rem, stage_A2- A2, A2)
print(A2_rem)

# Step 3: Replace remaining A2 cells with A1 values
mask_A2_rem = (A2_rem != A2)  # Mask of cells updated in A2 during step 2
print(mask_A2_rem)
rem_final = np.where(~mask_A2_rem, A1_rem, A2_rem)
print(rem_final)

# Step 4: Replace remaining o values of A2 cells with stage_A2
ripple_rem = np.where((rem_final == 0) & ~ mask_A1_rem, stage_A2, rem_final)
print(ripple_rem)

rem = [[9 7 8 9 9 9]
[9 7 6 7 8 7]
[5 5 2 6 7 6]
[5 3 0 5 7 5]
[5 4 2 7 9 7]
[9 9 8 9 9 9]]

@hhs732
Copy link
Contributor Author

hhs732 commented Feb 7, 2025

Here is a map showing REM for different downstream BC for reach 1291086, HUC8 12030106:

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request NGWPC Tasks on NGWPC Contracts
Projects
None yet
Development

No branches or pull requests

2 participants