-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrt_run.py
More file actions
68 lines (54 loc) · 2.64 KB
/
drt_run.py
File metadata and controls
68 lines (54 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 24 13:11:47 2025
@author: sdevo
"""
# import required functions and packages
import drt_env
import drt_grid
import drt_erosion
import drt_accretion
import drt_plotting
import pandas as pd
import datetime
from zoneinfo import ZoneInfo
import pickle
# Main Run Segment
# # # PREALLOCATE # # #
scenario = {}
scenario['location'] = {}
scenario['timing'] = {}
scenario['models'] = {}
scenario['env'] = {}
# # # USER INPUTS: # # #
scenario['code_direc'] = 'F:\PyPath\duneResponseTool' # python directory for DRT functions and dependables
scenario['location']['lat'] = 38.29#36.19 # this is FRF duneLidar loc. #39.44 # this is DRT example in NJ # scenario latitude (deg. N)
scenario['location']['lon'] = -75.11#-75.75 # this is FRF duneLidar loc. #-74.35 # this is DRT example in NJ # scenario longitude (deg. E.. note, negative = W)
scenario['type'] = 'hindcast' # 'forecast' or 'hindcast'?
scenario['timing']['start_date'] = datetime.datetime(1998,1,15)#datetime.datetime(2015,9,20)#,tzinfo=ZoneInfo('US/Eastern')) # enter start date
Durationdays = 30 # how many days do you want the simulation to run?
scenario['timing']['dt'] = 1 # model dt (hours)
scenario['models']['d50'] = 0.30#0.35 # median grain size diameter (mm)
# # # Model Coefficients (can be changed but these are defaults) # # #
scenario['models']['WaveRunupFactor'] = 1.26
scenario['models']['DuneSlopeTrajectory'] = 0.54
scenario['models']['DuneErodibility'] = 0.0025
scenario['models']['AeolianTransportCoefficient'] = 2.78
# # # End Date (Automatically Calculated) # # #
scenario['timing']['end_date'] = scenario['timing']['start_date'] + datetime.timedelta(days=Durationdays)
# # # Set up grids based on dune and beach morphology conditions: # # #
# look for dune morpho from USGS data based on closest lat/lon:
scenario = drt_env.drt_search_morphology(scenario, morph_file=f"{scenario['code_direc']}\dependencies\drt_morphology.xlsx")
# make model x and z grids:
scenario = drt_grid.drt_grid(scenario)
# # # Pull Environmental Variables (Wind, Waves, Tides) # # #
scenario = drt_env.drt_env(scenario)
# # # Run Erosion Module # # #
scenario = drt_erosion.drt_erosion(scenario)
# # # Run Accretion Module # # #
scenario = drt_accretion.drt_accretion(scenario)
# # # Plot the Outputs # # #
drt_plotting.drt_plotting(scenario)
# # # Save an Output File # # #
with open(f"DRT_{scenario['timing']['start_date'].strftime('%Y%m%d')}-{scenario['timing']['end_date'].strftime('%Y%m%d')}_{scenario['location']['lat']}_{scenario['location']['lon']}.pkl",'wb') as fileout:
pickle.dump(scenario,fileout)