Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
385 commits
Select commit Hold shift + click to select a range
9faa3c6
had issue with line 181 from yaml function when running cascade. made…
Jan 13, 2023
add7dc4
line 620: barrier3d does not have PreStor_InteriorDomain so I have cu…
Jan 13, 2023
e92f506
updated time step print statement
Jan 13, 2023
d09793b
outwash edits plus added an input for the outwash_data folder
Jan 13, 2023
f9b0041
new Ki analysis now that outwasher works the way we want
Jan 13, 2023
1172cb9
made variable for saving all velocities and flow rates. compiled func…
Jan 16, 2023
07c0221
back to original with the PreStorm_InteriorDomain
Jan 19, 2023
dc92cb5
back to original after pulling master brie
Jan 19, 2023
643249b
lexi cascade updates
Jan 19, 2023
d5c1261
outwasher jupyter notebooks for testing
Jan 19, 2023
2ce6b95
jupyter notebook for saving cascade b3d domains
Jan 20, 2023
9c47ba6
notebook for running cascade with outwash
Jan 20, 2023
24f1cbc
added the check for outwash at the beginning of this script instead o…
Jan 20, 2023
308fcab
updated to include outwash
Jan 20, 2023
4f32912
updated the outwash variables for interior and dune domain in the upd…
Jan 25, 2023
5ae5973
notebooks for running outwasher with cascade
Jan 25, 2023
808aaa5
new combined outwash storm series. first column is year and second co…
Jan 25, 2023
07e23a9
notebook for saving domains
Jan 25, 2023
2ca36ae
changing substep and print statement
Jan 25, 2023
e7a2bd0
using the full hydrograph from chris. there were no changes to the to…
Jan 25, 2023
d862da5
running more cascade/outwash configurations
Jan 25, 2023
aba3c1f
updated to include percent outwash to shoreface
Jan 27, 2023
085a1bc
renamed files based on katherine's git update
Jan 27, 2023
415a0e1
updated to be the same as barrier3d version_1_local_copy files
Jan 27, 2023
32059bb
deleted
Jan 27, 2023
9c2b227
deleted, old storm configurations for testing
Jan 27, 2023
6cc3125
Merge branch 'main' into avanblunk-cascade
Jan 30, 2023
7640089
had to manually set the bay depth to -0.3 in the check (665) because…
Jan 30, 2023
0c0c992
Merge branch 'main' into avanblunk-cascade
Feb 1, 2023
618c389
edited the outwash inputs
Feb 4, 2023
770fa2f
python files for converting NCB DEM into numpy array
Feb 16, 2023
6fe1e39
edits to try and get a correct domain
Feb 19, 2023
1c599d0
printed some things for thesis
Feb 19, 2023
8aafce3
uploading new data
Feb 21, 2023
1babccb
re-wrote flow routing function
Feb 23, 2023
c78da51
set dune row to 30.0 as default in this file
Feb 28, 2023
b25ffed
updated the flow routing initialization to handle full dune or first …
Mar 3, 2023
d386336
added the outwasher inputs to specify dune dynamics for flow routing
Mar 3, 2023
c8d14df
python file for converting txt file from Chris (m MSL) to outwasher s…
Mar 6, 2023
3e7b320
added inputs for a beach file and to specify the dune dynamics (consi…
Mar 6, 2023
93f091b
changed dune width back to 20.0
Mar 6, 2023
c66d480
added input for outwasher substep
Mar 6, 2023
dd4e7a6
think I updated the flow routing for outwasher to include larger area…
Mar 9, 2023
edcdcad
specifying new domain size
Mar 9, 2023
cdd3a36
added a plot for the 24 hrs we use
Mar 9, 2023
f0dbacd
added DuneParamMultipleRows to outwash yaml
Mar 9, 2023
1b7038c
generated many hydrographs
Mar 9, 2023
aa69f43
modified domain
Mar 9, 2023
eb068be
newest version of outwasher that implements different discharge alloc…
Mar 13, 2023
0d4f7cf
many new functions, 1 for determining if the bay level is higher than…
Mar 16, 2023
bfa5592
edited for new elevations and storms
Mar 16, 2023
e3a9875
added an input for outwasher Ki value
Mar 16, 2023
05066f4
different versions of NCB domain
Mar 16, 2023
155c906
different versions of hydrograph
Mar 16, 2023
c173ac9
added variable to store the bay array
Mar 16, 2023
b743891
re-arranged the order of some steps to increase efficiency
Mar 20, 2023
70edd93
newest FR
Mar 23, 2023
babc2d8
most updated outwasher, Brad and Katherine interpretation of cons. of…
Apr 3, 2023
0fc1951
input domain files in dam and meters
Apr 5, 2023
4ee8d05
input domain files in dam and meters
Apr 5, 2023
22c0773
6 min storm series every 20 years rather than every 10
Apr 5, 2023
a938851
beach file we have been using renamed to defualt beach
Apr 5, 2023
de25805
plots the dunes with the interior elevation from cascade
Apr 7, 2023
d68d97f
outwasher's yaml, set berm elevation, MHW, and beta
Apr 7, 2023
4c15fdc
added outwash volume and outwash flux variables to track per outwash …
Apr 7, 2023
3ba8fd8
changed the outwasher import since I renamed the file
Apr 7, 2023
db7421c
Merge branch 'main' into avanblunk-cascade
Apr 7, 2023
ac05fdd
Merge branch 'main' into avanblunk-cascade
Apr 7, 2023
e159011
stored more parameters in arrays to make into figures
Apr 8, 2023
6173f34
aded more figures to track progress and make sure I was saving everyt…
Apr 8, 2023
4989203
updated for berm elevation
Apr 8, 2023
b6ebc78
changes to plot figures
Apr 8, 2023
822e692
saving more variables
Apr 8, 2023
d5e3d42
updated input files
Apr 10, 2023
534f0e3
updated saved variables
Apr 20, 2023
863c1a6
yaml for outwash runs
Apr 26, 2023
17c457c
changed dmaxel to 6.2 m NAVD88
Apr 27, 2023
05abfe5
updated outwash volume and flux variables
Apr 30, 2023
39da0f4
updated max dun height
May 4, 2023
daf5179
added update to avg interior height
May 15, 2023
f685c03
converting the ADCIRC data from USGS. includes changing the frequency…
Jun 5, 2023
23f9e2e
renamed to indicate it is for configuration 1
Jun 6, 2023
5cf9209
new beach file for configuration 2
Jun 6, 2023
88f7984
new file for adding lateral transport into outwasher
Jun 7, 2023
5eeecf2
updating lateral transport
Jun 12, 2023
c931be5
creating the second beach domain
Jun 12, 2023
318dfaa
added nan to num
Jun 13, 2023
28d68dd
added beta to outwasher inputs
Jun 19, 2023
931fb55
renamed to include configuration # in name
Jun 20, 2023
2cee9af
storm series that include a year 1 outwash storm and occur every 10 a…
Jun 20, 2023
58549f6
editing to load and save configuration 3
Jun 20, 2023
d5c3a14
updated to include lateral transport
Jun 21, 2023
8a1bded
calling outwasher file instead of outwasher_lateral_transport file
Jun 21, 2023
8e067d2
moved to outwash_ms folder
Jun 21, 2023
4829789
outputting more erosion values
Jun 21, 2023
aeae327
reformatting some of the code
Jun 21, 2023
c91ec5f
new notebook for creating synthetic storms for NCB
anardek Jun 22, 2023
203476e
moved flow routing to separate function; added beach width variable f…
anardek Jun 22, 2023
8d77cd0
added the cascade elevation function that has constant frame of refer…
Jun 22, 2023
11dd18c
Merge remote-tracking branch 'origin/avanblunk-cascade' into avanblun…
Jun 22, 2023
75c1294
edited b3d.nn to b3d._nn
Jun 22, 2023
3bf43af
all deleted files
Jun 26, 2023
7e358d0
all deleted files
Jun 26, 2023
b02d77d
new storm files with more descriptive names
Jun 26, 2023
6d1ab35
outwasher notebooks
Jun 26, 2023
5459983
old storm and domain files
Jun 26, 2023
1bbbc5b
updated the code to make the storm series based on a given start year
Jun 26, 2023
c1976ac
moved
Jun 26, 2023
5b361a7
updated beach section at start of update function to include keeping …
Jun 27, 2023
f26f9be
edited to include initial_beach_width and C in outwasher initialization
Jun 27, 2023
3c22510
got rid of SimFrames folder for gif plotter
Jun 28, 2023
fc9267e
changed print statements
Jun 28, 2023
92472b7
new synthetic storms for NCB described in ntbk
anardek Jul 6, 2023
de487dd
new synthetic storms for NCB described in ntbk
anardek Jul 6, 2023
ea5ea7a
Merge remote-tracking branch 'origin/avanblunk-cascade' into avanblun…
anardek Jul 6, 2023
3f836b9
configuration 4 files
Jul 6, 2023
653d412
outwash storm that only occurs at year 1
Jul 6, 2023
c3e5bb2
notebooks for each configuration and dune growth
Jul 6, 2023
eb33bdd
notebooks for loading and plotting results
Jul 6, 2023
a7a4e54
edited when extracting configuration 4
Jul 6, 2023
f2d11ee
updated for mean and std
anardek Jul 7, 2023
b2dc8f4
Merge remote-tracking branch 'origin/avanblunk-cascade' into avanblun…
Jul 7, 2023
8232801
flipped domain left-right in plotter to get correct orientation
Jul 7, 2023
011c42d
committing katherine's edited file to see if it will update locally (…
Jul 7, 2023
eb4be3f
new 100 year storm series for NCB and respective beach elevations
Jul 7, 2023
1633cc3
file for testing new storm series against previous storm series
Jul 7, 2023
b5264bc
file for testing new storm series against previous storm series
Jul 7, 2023
ab745b7
new storm series with the 0.03 and 0.002 slopes including year 100 in…
Jul 10, 2023
bea6ebf
downloaded katherines most recent version of the NCB synthetic storms
Jul 10, 2023
9e74c8d
100 storms for each slope (0.002 and 0.03)
Jul 11, 2023
aa51217
added true/false for outputting plots
Jul 12, 2023
5de22d0
run file for running CASCADE for all 4 outwash events and 100 storm s…
Jul 14, 2023
7214c1a
removed substep as an input since we want it to stay 100 throughout
Jul 14, 2023
2b6b9aa
running config4 with the average values
Jul 17, 2023
c39d5cc
copied into the folder with all my new overwash storms
Jul 17, 2023
a2417b4
plotting various variables
Jul 17, 2023
bf8b79b
updated for printing spacing
Jul 17, 2023
5d716d6
copied over for running with new storms
Jul 17, 2023
2523bd3
moved to old folder for now (will delete that folder eventually)
Jul 17, 2023
f3ee9e1
deleted
Jul 17, 2023
3a6c989
jupyter notebook for running different slope
Jul 17, 2023
abc64b1
moved to this folder
Jul 17, 2023
a3ccb6d
moved to old folder for now (will delete folder later)
Jul 17, 2023
5367c6a
jupyter notebook with yearly_storms function: updated the function to…
Jul 17, 2023
4d3709f
added the storms folder that contains the two sets of 100 storms (NCB…
Jul 17, 2023
097fe30
run files for the overwash only and 100% washout to shroeface scenari…
Jul 17, 2023
f6df5ef
moved datadir specification up in the code and added two save_dir loc…
Jul 17, 2023
39d9ae4
deleted some print statements
Jul 17, 2023
a0fb665
commented out ore removed the "self" from variables that were giant a…
Jul 21, 2023
ad96185
commented out or removed the "self" from variables that were giant ar…
Jul 21, 2023
353dfe3
jupyter notebook for editing saved cascade npz files to change the bi…
Jul 21, 2023
a9da139
file for loading the npz files for each scenario and all storms to ge…
Jul 26, 2023
b492dc2
edited final beach elevation variable
Jul 26, 2023
5b26e04
making the subplots that show pre-storm, post-storm, and elevation ch…
Jul 26, 2023
7cfeaf9
saving the run
Jul 26, 2023
d3d5d0b
updated to save to one place only
Jul 26, 2023
df66fdd
removed substep, Ki, and C from init and input into outwasher
Jul 27, 2023
e3d27d4
cleaning up code: more comments and removing variables that are not a…
Jul 27, 2023
b3a23ae
fully organized and commented outwasher code
Jul 28, 2023
eba1468
updated comments and variable names for readability
Aug 2, 2023
df36af8
added some extra explanation for lateral transport calculations and a…
Aug 2, 2023
fc11d68
pre and post-storm observed configurations
Aug 3, 2023
af99506
updated so that the only purpose of this code is to load the DEM csv …
Aug 3, 2023
fbb01ce
updated save directories
Aug 3, 2023
b51ee8e
moved
Aug 3, 2023
9efb646
individual configuration domains that can be used as CASCADE inputs. …
Aug 3, 2023
74c949b
file that takes the observed prestorm configurations and breaks them …
Aug 3, 2023
3e87068
un-commented some sections of the code
Aug 6, 2023
62beb76
removed variables that are no longer inputs into cascade
Aug 8, 2023
da008f3
updated for r = 0.35
Aug 10, 2023
630d8ab
added KA's local directory for simulations on her machine
anardek Oct 12, 2023
02812f3
updated for r = 0.35, outwash = 50%
Nov 10, 2023
df8eb99
added code for plotting the shoreline position, shoreface slope, aver…
Feb 25, 2024
33fddca
script for plotting the dune crest time series for Outwasher, both du…
Mar 1, 2024
080940d
script for plotting the full 2D elevations before and after each outw…
Mar 1, 2024
e526f3a
updated to create a loop for each dune growth rate to halve the amoun…
Mar 15, 2024
cad4ae2
added min, mean, and max stats for shoreline position and barrier dro…
Mar 19, 2024
49b04d8
editing plot graphics, still not perfect
Mar 22, 2024
ee4ed28
edited the code so that the drown years correlated with the first occ…
Apr 3, 2024
d74125f
added a check for barrier drowning post outwash event
Apr 14, 2024
29e4979
Merge remote-tracking branch 'origin/avanblunk-cascade' into avanblun…
Apr 15, 2024
d4929af
renamed, merged with katherine's changes (but back to r=0.25)
Apr 15, 2024
b2f9f4c
added stacked dune crest figures
Apr 15, 2024
e5b4d53
adjusted figure labels and colors
May 7, 2024
ab0ff01
moved folder
May 7, 2024
5ba5dd9
updated outwash output to gitignore after moving the folder
May 7, 2024
0072e8a
updated datadir locations to rerun folder and the updated location of…
May 13, 2024
53be797
moved to different location
May 14, 2024
b538818
removed OW_TS variable because it was not used
May 14, 2024
43de4e2
updated the default dune and elevation files to configuration 4
May 14, 2024
2ac56ff
added average outwash and overwash calculations
May 20, 2024
10fe88f
edited some variables for runs
May 23, 2024
c09368e
added code for finding the percent barriers drowned by year (total, n…
May 23, 2024
7dd4cae
added the cascade elevation plotter to hold the frame of the domain c…
Mar 17, 2025
f0a566d
added a call to the cascade elevation plotter in outwash_plotters.py
Mar 17, 2025
94117c7
updated outwash and overwash flux stats. starting documenting a littl…
Mar 18, 2025
41d3ef7
added a figure for making the subplot figure of CASCADE elevations. s…
Mar 21, 2025
ae80671
added a call to the new plot_Elev_CASCADE_subplots function in outwas…
Mar 21, 2025
2e0f24d
aded figures 9-10 for single storm events (shoreline position, overwa…
Mar 22, 2025
3672e37
added text to elevation plots to include outwash flux and tested some…
Mar 28, 2025
c897303
minor edits, added the year specification for the overwash and shorel…
Apr 25, 2025
7e122db
updated the dune plot for the terrain colormap. updated the elevation…
May 11, 2025
0770529
this code takes the average of the entire domain for each time step r…
May 16, 2025
9ac9576
changed the dune plot to be normal elevatio rather than height above …
Jun 8, 2025
02f0942
added width calcs and edited the average interior elevation calculati…
Jun 8, 2025
1528241
testing width calcs, just uncommented the rname_array
Jun 8, 2025
957ccc1
calculate the average number/length of dune gaps for each outwash sce…
Jun 14, 2025
01687f8
changed titles from "outwash to shoreface" to "washout to shoreface" …
Jun 14, 2025
3a0bae1
changed titles from "outwash to shoreface" to "washout to shoreface"
Jun 14, 2025
4c4d532
updated folder names for cascade elevation subplots
Jun 14, 2025
06e7847
changed title of shoreline and overwash figures
Jun 27, 2025
9be2994
added a variable to save the post-outwah domain at all outwash model …
Jun 27, 2025
ee8045f
renamed variable
Jun 27, 2025
4251ebd
turning variables on and off
Oct 2, 2025
38a766f
adding comments
Oct 2, 2025
0763205
uncommenting lines for testing
Oct 2, 2025
fa07a6a
changed outwash storm file to "outwash_storms_startyr_1_interval_20yr…
Oct 20, 2025
b1ab2bb
files for outwash storms, beach domain, and dune growth params
Oct 20, 2025
ac15bb7
file for running outwasher, minor changes to naming and washout_array…
Nov 21, 2025
a66e87e
updated to include:
Nov 21, 2025
562a31e
moved all these into a the for_thesis folder
Nov 22, 2025
b4cedf7
file for running CASCADE with outwash. has all three outwash to shore…
Nov 22, 2025
39527f2
file for running CASCADE with NO outwash (module set to false). curre…
Nov 22, 2025
4c634e4
this is a simplified version (less inputs required) of the outwash_pl…
Nov 22, 2025
201da3f
removed variables no longer used, and moved relevant code from here t…
Nov 22, 2025
2cfc533
compiled all analysis for the journal article into this file. all old…
Nov 22, 2025
2257cd1
moved relevant code to journal_results.py so these files are no longe…
Nov 22, 2025
81a9dbd
moved relevant code to journal_results.py and moved this file to OLD
Jan 4, 2026
59c37d9
added dune gap analysis code
Jan 4, 2026
8fef616
moved to OLD folder
Jan 4, 2026
169a3d3
removed code for figures since they were old ones
Jan 4, 2026
b7760d1
added .png file type to plot_Elev_CASCADE_subplots
Jan 4, 2026
b3a2051
added space for the overwash flux and shoreline position files
Jan 4, 2026
eb2246f
moved to OLD
Jan 4, 2026
442cc33
updated to include scripts/outwash_ms/OLD
Jan 4, 2026
010d006
moved to OLD for now
Jan 4, 2026
c425f5e
moved to OLD
Jan 4, 2026
96afa88
edited datadir
Feb 17, 2026
a073624
added lines for the dune_gap limit
Feb 21, 2026
0cf8d48
Merge branch 'main' into avanblunk-cascade
anardek Mar 5, 2026
9ab0b08
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 5, 2026
1e9400a
these two files may help users convert their data into usable domains…
Mar 6, 2026
f0891b4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 6, 2026
e0906e7
changed the name convention for easier interpretation and deleted unn…
Mar 6, 2026
eaa6c02
updated for new datadirs and for easier comprehension
Mar 6, 2026
24a481a
Merge remote-tracking branch 'origin/outwasher_pull_request' into out…
Mar 6, 2026
ffd1b47
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 6, 2026
ac64e3a
deletions
Mar 6, 2026
2847301
Merge remote-tracking branch 'origin/outwasher_pull_request' into out…
Mar 6, 2026
d4f8e74
moved to outwasher data folder which only incldues files that another…
Mar 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,9 @@ brie_venv
Output/
Run_Output/
/brie_venv/
/data/outwash_data/storms/
/data/outwash_data/OLD/
/notebooks/for_thesis
/notebooks/old_outwash_runs
/notebooks/post-thesis
scripts/outwash_ms/OLD
1 change: 0 additions & 1 deletion cascade/beach_dune_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,6 @@ def update(
if self._overwash_removal:
# barrier3d saves the pre-storm interior for each time step
pre_storm_interior = barrier3d.PreStorm_InteriorDomain

pre_storm_interior, post_storm_interior = resize_interior_domain(
pre_storm_interior=pre_storm_interior,
post_storm_interior=barrier3d.DomainTS[self._time_index - 1],
Expand Down
325 changes: 186 additions & 139 deletions cascade/cascade.py

Large diffs are not rendered by default.

1,537 changes: 1,537 additions & 0 deletions cascade/outwasher.py

Large diffs are not rendered by default.

177 changes: 177 additions & 0 deletions cascade/tools/creating_input_domains.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
# Lexi Van Blunk
# last updated 8/3/2023

# this code breaks up the "observed" configurations into interior, dune, and beach domains for input into CASCADE

# NOTE: configurations 1 and 2 vary slightly here because I was still using the domains from the thesis rather than
# the ones from the new larger DEM. In the future, I would suggest using these newer domains since they are consistent
# with configurations 3 and 4

import numpy as np

berm_el = 0.11
save_dir = "C:/Users/Lexi/PycharmProjects/CASCADE/scripts/outwash_ms/configurations/"
save_now = False

# ------------------------------------------------ load data -----------------------------------------------------------

section1 = np.load(
r"C:\Users\Lexi\PycharmProjects\CASCADE\scripts\outwash_ms\configurations\config1\config1_observed_pre.npy"
)
section2 = np.load(
r"C:\Users\Lexi\PycharmProjects\CASCADE\scripts\outwash_ms\configurations\config2\config2_observed_pre.npy"
)
section3 = np.load(
r"C:\Users\Lexi\PycharmProjects\CASCADE\scripts\outwash_ms\configurations\config3\config3_observed_pre.npy"
)
section4 = np.load(
r"C:\Users\Lexi\PycharmProjects\CASCADE\scripts\outwash_ms\configurations\config4\config4_observed_pre.npy"
)


# --------------------------------------------- section 1 --------------------------------------------------------------
section1_int = section1[0:30]
section1_dunes = section1[30:35]
section1_beach = section1[35:]

# take only two rows for the dunes because B3D only allows two dune rows
section1_dunes = section1_dunes[1:3]

full_1 = np.append(section1_int, section1_dunes, 0)
full_1 = np.append(full_1, section1_beach, 0)

if save_now:
# save the domains as needed for B3D
save_dir_1 = save_dir + "config1/"

# flip the interior for correct orientation in B3D
interior_b3d_input_1 = np.flip(section1_int)
np.save(
save_dir_1 + "NCB-default-elevation-config1-damMHW.npy", interior_b3d_input_1
)

# flip the dunes and put them into one long array
dunes_b3d_1 = np.flip(section1_dunes) - berm_el
dunes_input_1 = np.append(dunes_b3d_1[0], dunes_b3d_1[1], 0)
np.save(save_dir_1 + "NCB-default-dunes-config1-dam.npy", dunes_input_1)

# since the beach is not used in B3D, it can be saved normally (outwash orientation)
np.save(save_dir_1 + "NCB-default-beach-config1-damMHW.npy", section1_beach)

# save the full input just because
np.save(save_dir_1 + "NCB-default_full_config1-damMHW.npy", full_1)


# --------------------------------------------- section 2 --------------------------------------------------------------
section2_int = section2[0:27]
section2_dunes = section2[27:31]
section2_beach = section2[31:]

# manipulate the dunes into 2 rows
section2_dunes[0:2, 0:4] += 0.1
section2_dunes[0:2, 0:2] = section2_dunes[3, 0:2]
section2_dunes[0, 2:5] = section2_dunes[2, 2:5]
section2_dunes = section2_dunes[0:2]
section2_dunes[0, 0:20] += 0.05
section2_dunes[1, 0:16] += 0.1

full_2 = np.append(section2_int, section2_dunes, 0)
full_2 = np.append(full_2, section2_beach, 0)

if save_now:
# save the domains as needed for B3D
save_dir_2 = save_dir + "config2/"

# flip the interior for correct orientation in B3D
interior_b3d_input_2 = np.flip(section2_int)
np.save(
save_dir_2 + "NCB-default-elevation-config2-damMHW.npy", interior_b3d_input_2
)

# flip the dunes and put them into one long array
dunes_b3d_2 = np.flip(section2_dunes) - berm_el
dunes_input_2 = np.append(dunes_b3d_2[0], dunes_b3d_2[1], 0)
np.save(save_dir_2 + "NCB-default-dunes-config2-dam.npy", dunes_input_2)

# since the beach is not used in B3D, it can be saved normally (outwash orientation)
np.save(save_dir_2 + "NCB-default-beach-config2-damMHW.npy", section2_beach)

# save the full input just because
np.save(save_dir_2 + "NCB-default_full_config2-damMHW.npy", full_2)

# --------------------------------------------- section 3 --------------------------------------------------------------

section3_int = section3[:23, :]
section3_dunes = section3[23:28, :]
section3_beach = section3[28:, :]

# manipulate the dunes into 2 rows that represent the true dune line
section3_stitched_dunes = np.zeros([2, np.shape(section3_dunes)[1]])
section3_stitched_dunes[:, 0:4] = section3[26:28, 0:4]
section3_stitched_dunes[:, 4:9] = section3[25:27, 4:9]
section3_stitched_dunes[:, 9:22] = section3[24:26, 9:22]
section3_stitched_dunes[:, 22:] = section3[23:25, 22:]

# # filling in the beach under the dunes
extra_beach = np.zeros([3, np.shape(section3_dunes)[1]])
extra_beach[:, 22:] = section3[25:28, 22:]
extra_beach[:, 0:4] = section3[28:31, 0:4]
extra_beach[:, 4:9] = section3[27:30, 4:9]
extra_beach[:, 9:22] = section3[26:29, 9:22]
section3_beach[0:2, 0:9] = section3[30:32, 0:9]
section3_beach = np.append(extra_beach, section3_beach, 0)

full_3 = np.append(section3_int, section3_stitched_dunes, 0)
full_3 = np.append(full_3, section3_beach, 0)

if save_now:
# save the domains as needed for B3D
save_dir_3 = save_dir + "config3/"

# flip the interior for correct orientation in B3D
interior_b3d_input_3 = np.flip(section3_int)
np.save(
save_dir_3 + "NCB-default-elevation-config3-damMHW.npy", interior_b3d_input_3
)

# flip the dunes and put them into one long array
dunes_b3d_3 = np.flip(section3_dunes) - berm_el
dunes_input_3 = np.append(dunes_b3d_3[0], dunes_b3d_3[1], 0)
np.save(save_dir_3 + "NCB-default-dunes-config3-dam.npy", dunes_input_3)

# since the beach is not used in B3D, it can be saved normally (outwash orientation)
np.save(save_dir_3 + "NCB-default-beach-config3-damMHW.npy", section3_beach)

# save the full input just because
np.save(save_dir_3 + "NCB-default_full_config3-damMHW.npy", full_3)

# --------------------------------------------- section 4 --------------------------------------------------------------

section4_int = section4[:26]
section4_dunes = section4[28:30]
section4_beach = section4[31:]
full_4 = np.append(section4_int, section4_dunes, 0)
full_4 = np.append(full_4, section4_beach, 0)

beach4_slope = (np.mean(section4_beach[0, :]) - np.mean(section4_beach[8, :])) / 9

if save_now:
# save the domains as needed for B3D
save_dir_4 = save_dir + "config4/"

# flip the interior for correct orientation in B3D
interior_b3d_input_4 = np.flip(section4_int)
np.save(
save_dir_4 + "NCB-default-elevation-config4-damMHW.npy", interior_b3d_input_4
)

# flip the dunes and put them into one long array
dunes_b3d_4 = np.flip(section4_dunes) - berm_el
dunes_input_4 = np.append(dunes_b3d_4[0], dunes_b3d_4[1], 0)
np.save(save_dir_4 + "NCB-default-dunes-config4-dam.npy", dunes_input_4)

# since the beach is not used in B3D, it can be saved normally (outwash orientation)
np.save(save_dir_4 + "NCB-default-beach-config4-damMHW.npy", section4_beach)

# save the full input just because
np.save(save_dir_4 + "NCB-default_full_config4-damMHW.npy", full_4)
199 changes: 199 additions & 0 deletions cascade/tools/lidar_to_array.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
# Lexi Van Blunk
# last updated 8/3/2023

# this code loads the csv file of elevation points from ArcGIS and organizes them into python arrays
# we also break up the domains into the 4 "observed" configurations and save them to the
# scripts/outwash_ms/configurations folder

# SEE NOTEBOOK: plotting observed configurations, which does the same thing but visualizes each configuration into
# subplots displaying the prestorm, poststorm, and elevation change plots (and shows boxes where we calculate erosion)
# we also calculate erosion in the notebook

import os

import numpy as np
import pandas as pd
from matplotlib import pyplot as plt

plt.rcParams.update({"font.size": 15})


# --------------------------------------- load the data as a dataframe ------------------------------------------------

os.chdir("C:/Users/Lexi/Documents/Research/Outwasher Paper/GIS data/")

# PRESTORM DATA
prestorm_points_df = pd.read_csv("raster_points.csv")

# get the column from the csv that contains the elevations
prestorm_elevations = prestorm_points_df["grid_code"]

alongshore_length_feature_class = (
4000 # in meters, along-shore side of rectangle from GIS (barrier length)
)
num_cols_domain = int(
alongshore_length_feature_class / 10
) # we specified 10x10 m cells
num_rows_domain = int(
len(prestorm_elevations) / num_cols_domain
) # this is the width of the island
MHW = 0.36 # meters NAVD88? (subtract 0.36 m from NAVD88 elevations to get MHW elevations)

prestorm_elevations = prestorm_elevations - MHW # convert elevations from NAVD88 to MHW

# POSTSTORM DATA
post_points_df = pd.read_csv("post_storm_points.csv")
post_elevations = post_points_df["grid_code"]
post_elevations = post_elevations - MHW # convert elevations from NAVD88 to MHW


# ---------------------------- organize the list of elevations into an array--------------------------------------------

elev_array = np.zeros([num_rows_domain, num_cols_domain])
start = 0
end = start + num_cols_domain
for row in range(num_rows_domain):
elev_array[row, :] = prestorm_elevations[start:end]
start += num_cols_domain
end += num_cols_domain

post_elev_array = np.zeros([num_rows_domain, num_cols_domain])
start = 0
end = start + num_cols_domain
for row in range(num_rows_domain):
post_elev_array[row, :] = post_elevations[start:end]
start += num_cols_domain
end += num_cols_domain

# set all values less than 0 to -3 m
for r in range(150):
for c in range(num_cols_domain):
if post_elev_array[r, c] <= -0.5:
post_elev_array[r, c] = -3


# ------------------------------------------ plotting the domains ------------------------------------------------------
xlabel = "alongshore distance (m)"
ylabel = "cross-shore distance (m)"

# PRESTORM
fig1 = plt.figure()
ax1 = fig1.add_subplot(111)
mat = ax1.matshow(
elev_array,
cmap="terrain",
vmin=-3.0,
vmax=6.0,
)
cbar = fig1.colorbar(mat)
cbar.set_label("m MHW", rotation=270, labelpad=10)
ax1.set_title("Pre-Storm Elevation")
ax1.set_ylabel(ylabel)
ax1.set_xlabel(xlabel)
plt.gca().xaxis.tick_bottom()

# add the rectangles around the 4 configurations
# (x,y), length, width (up = neg)
ax1.add_patch(plt.Rectangle((98, 187), 50, -40, lw=2, ec="k", fc="none")) # black
ax1.add_patch(plt.Rectangle((148, 187), 50, -40, lw=2, ec="m", fc="none")) # purple
ax1.add_patch(
plt.Rectangle((198, 187), 50, -40, lw=2, ec="tab:orange", fc="none")
) # blue
ax1.add_patch(
plt.Rectangle((248, 187), 50, -40, lw=2, ec="tab:blue", fc="none")
) # orange

# edit the tick marks to be in meters
xtick_max = np.shape(elev_array)[1] # n_cols = x
x_ticks = np.array(range(0, xtick_max, 50))
x_tick_labels = x_ticks * 10
ytick_max = np.shape(elev_array)[0] # n_rows = y
y_ticks = np.array(range(0, ytick_max, 25))
y_tick_labels = y_ticks * 10
plt.xticks(x_ticks, x_tick_labels)
plt.yticks(y_ticks, y_tick_labels)
plt.tight_layout()

# POSTSTORM
fig2 = plt.figure()
ax2 = fig2.add_subplot(111)
mat = ax2.matshow(
post_elev_array,
cmap="terrain",
vmin=-3.0,
vmax=6.0,
)
cbar = fig2.colorbar(mat)
cbar.set_label("m MHW", rotation=270, labelpad=10)
ax2.set_title("Post-Storm Elevation")
ax2.set_ylabel(ylabel)
ax2.set_xlabel(xlabel)
plt.gca().xaxis.tick_bottom()

# add the rectangles around the 4 configurations
ax2.add_patch(plt.Rectangle((98, 187), 50, -40, lw=2, ec="k", fc="none")) # black
ax2.add_patch(plt.Rectangle((148, 187), 50, -40, lw=2, ec="m", fc="none")) # purple
ax2.add_patch(
plt.Rectangle((198, 187), 50, -40, lw=2, ec="tab:orange", fc="none")
) # blue
ax2.add_patch(
plt.Rectangle((248, 187), 50, -40, lw=2, ec="tab:blue", fc="none")
) # orange

# edit the tick marks to be in meters
xtick_max = np.shape(post_elev_array)[1] # n_cols = x
x_ticks = np.array(range(0, xtick_max, 50))
x_tick_labels = x_ticks * 10
ytick_max = np.shape(post_elev_array)[0] # n_rows = y
y_ticks = np.array(range(0, ytick_max, 25))
y_tick_labels = y_ticks * 10
plt.xticks(x_ticks, x_tick_labels)
plt.yticks(y_ticks, y_tick_labels)
plt.tight_layout()

# --------------------------- convert to dam and make the 4 configurations ---------------------------------------------
elev_array = elev_array / 10
section1_pre = elev_array[147:188, 98:148]
section2_pre = elev_array[147:188, 148:198]
section3_pre = elev_array[147:188, 248:298]
section4_pre = elev_array[147:188, 198:248] # validation configuration

np.save(
r"C:\Users\Lexi\PycharmProjects\CASCADE\scripts\outwash_ms\configurations\config1\config1_observed_pre.npy",
section1_pre,
)
np.save(
r"C:\Users\Lexi\PycharmProjects\CASCADE\scripts\outwash_ms\configurations\config2\config2_observed_pre.npy",
section2_pre,
)
np.save(
r"C:\Users\Lexi\PycharmProjects\CASCADE\scripts\outwash_ms\configurations\config3\config3_observed_pre.npy",
section3_pre,
)
np.save(
r"C:\Users\Lexi\PycharmProjects\CASCADE\scripts\outwash_ms\configurations\config4\config4_observed_pre.npy",
section4_pre,
)

post_elev_array = post_elev_array / 10
section1_post = post_elev_array[147:188, 98:148]
section2_post = post_elev_array[147:188, 148:198]
section3_post = post_elev_array[147:188, 248:298]
section4_post = post_elev_array[147:188, 198:248]

np.save(
r"C:\Users\Lexi\PycharmProjects\CASCADE\scripts\outwash_ms\configurations\config1_observed_post.npy",
section1_post,
)
np.save(
r"C:\Users\Lexi\PycharmProjects\CASCADE\scripts\outwash_ms\configurations\config2_observed_post.npy",
section2_post,
)
np.save(
r"C:\Users\Lexi\PycharmProjects\CASCADE\scripts\outwash_ms\configurations\config3_observed_post.npy",
section3_post,
)
np.save(
r"C:\Users\Lexi\PycharmProjects\CASCADE\scripts\outwash_ms\configurations\config4_observed_post.npy",
section4_post,
)
Loading
Loading