|
2 | 2 | # IMPORT dnora
|
3 | 3 | # =============================================================================
|
4 | 4 | from dnora import grd, mdl, wnd, bnd, inp, wlv, ocr, run
|
| 5 | + |
5 | 6 | # =============================================================================
|
6 | 7 | # DEFINE GRID OBJECT
|
7 | 8 | # =============================================================================
|
8 | 9 | # Set grid definitions
|
9 |
| -grid = grd.Grid(lon=(5.35, 5.6), lat=(59.00, 59.17), name='Boknafjorden') |
| 10 | +grid = grd.Grid(lon=(5.35, 5.6), lat=(59.00, 59.17), name="Boknafjorden") |
10 | 11 |
|
11 | 12 | # Set spacing and boundary points
|
12 | 13 | grid.set_spacing(dm=250)
|
13 | 14 |
|
14 | 15 | # Import topography and mesh it down to the grid definitions
|
15 | 16 | # Options for grd.readers: EMODNET2020, KartverketNo50m, GEBCO2021
|
16 |
| -topo_reader = grd.read.EMODNET2020( |
17 |
| - tile='*5', folder='/home/janvb/Documents/bathy/EMODNET2020') |
| 17 | +topo_reader = grd.read.EMODNET2020(tile="*5", folder="/home/konstac/bathy") |
18 | 18 | grid.import_topo(topo_reader=topo_reader)
|
19 | 19 |
|
20 | 20 | # This can be used to get an empty topography for testing
|
21 |
| -#grid.import_topo(topo_reader=grd.read.EmptyTopo(grid=grid)) |
| 21 | +# grid.import_topo(topo_reader=grd.read.EmptyTopo(grid=grid)) |
22 | 22 | #
|
23 | 23 | grid.mesh_grid()
|
24 | 24 | #
|
25 | 25 | # Set the boundaries
|
26 |
| -bnd_set = grd.boundary.EdgesAsBoundary(edges=[ 'W', 'S'], step = 10) |
| 26 | +bnd_set = grd.boundary.EdgesAsBoundary(edges=["W", "S"], step=10) |
27 | 27 | grid.set_boundary(boundary_setter=bnd_set)
|
28 | 28 | #
|
29 | 29 | #
|
30 | 30 | # =============================================================================
|
31 | 31 | # DEFINE MODEL OBJECT (mdl.)
|
32 | 32 | # =============================================================================
|
33 | 33 | # Options for mdl: SWAN_NORA3, SWAN_ERA5, SWAN_WW3_4km, SWAN_WAM4km
|
34 |
| -model = mdl.SWAN_NORA3(grid, start_time='2020-12-17T12:00', |
35 |
| - end_time='2020-12-17T18:00') |
| 34 | +model = mdl.SWAN_NORA3(grid, start_time="2020-12-17T12:00", end_time="2020-12-17T18:00") |
36 | 35 | # =============================================================================
|
37 | 36 | # IMPORT BOUNDARIES AND FORCING
|
38 | 37 | # =============================================================================
|
39 | 38 | # Boundary Spectra
|
40 | 39 | model.import_boundary(write_cache=True, read_cache=False)
|
41 |
| -#model.import_boundary(bnd.read_metno.NORA3(source='lustre'),write_cache=True, read_cache=False) # for internal |
| 40 | +# model.import_boundary(bnd.read_metno.NORA3(source='lustre'),write_cache=True, read_cache=False) # for internal |
42 | 41 |
|
43 | 42 | # Wind Forcing
|
44 | 43 | model.import_forcing(write_cache=True, read_cache=False)
|
45 |
| -#model.import_forcing(wnd.read_metno.NORA3(source='lustre'),write_cache=True, read_cache=False) # for internal |
| 44 | +# model.import_forcing(wnd.read_metno.NORA3(source='lustre'),write_cache=True, read_cache=False) # for internal |
46 | 45 |
|
47 | 46 | # Ocean Current
|
48 |
| -#model.import_oceancurrent(ocr.read_metno.NorKyst800()) |
| 47 | +# model.import_oceancurrent(ocr.read_metno.NorKyst800()) |
49 | 48 |
|
50 | 49 | # Water Level
|
51 |
| -#model.import_waterlevel(wlv.read_ec.GTSM_ERA5()) |
| 50 | +# model.import_waterlevel(wlv.read_ec.GTSM_ERA5()) |
52 | 51 | # =============================================================================
|
53 | 52 | # PLOT GRID, FORCING AND BOUNDARIES
|
54 | 53 | # =============================================================================
|
|
59 | 58 | model.export_grid()
|
60 | 59 | model.export_boundary()
|
61 | 60 | model.export_forcing()
|
62 |
| -#model.export_oceancurrent() |
63 |
| -#model.export_waterlevel() |
64 |
| -model.write_input_file(input_file_writer=inp.SWAN( |
65 |
| - spec_points=[(5.50, 59.16), (5.55, 59.15)])) |
| 61 | +# model.export_oceancurrent() |
| 62 | +# model.export_waterlevel() |
| 63 | +model.write_input_file( |
| 64 | + input_file_writer=inp.SWAN(spec_points=[(5.50, 59.16), (5.55, 59.15)]) |
| 65 | +) |
66 | 66 | # =============================================================================
|
67 | 67 | # SWAN RUN
|
68 | 68 | # =============================================================================
|
69 |
| -model.run_model(model_executer = run.SWAN(nproc=15)) |
| 69 | +model.run_model(model_executer=run.SWAN(nproc=15)) |
0 commit comments