|
5 | 5 | % resolution when building a mesh. |
6 | 6 | % Copyright (C) 2018 Keith Roberts & William Pringle |
7 | 7 | % |
8 | | - % The following properties (with default values) are available for input |
9 | | - % to the edgefx method: |
10 | | - % defval = 0; % placeholder value if arg is not passed. |
11 | | - % addOptional(p,'dis',defval); |
12 | | - % addOptional(p,'fs',defval); |
13 | | - % addOptional(p,'wl',defval); |
14 | | - % addOptional(p,'slp',defval); |
15 | | - % addOptional(p,'ch',defval); |
16 | | - % addOptional(p,'min_el_ch',100); |
17 | | - % addOptional(p,'AngOfRe',60); |
18 | | - % addOptional(p,'max_el',inf); |
19 | | - % addOptional(p,'max_el_ns',inf); |
20 | | - % addOptional(p,'g',0.20); |
21 | | - % addOptional(p,'geodata',defval) |
22 | | - % addOptional(p,'lmsl',defval) |
23 | | - % addOptional(p,'dt',-1); |
24 | | - % addOptional(p,'fl',defval); |
25 | | - % addOptional(p,'Channels',defval); |
26 | | - % addOptional(p,'h0',defval); |
| 8 | + % The following properties are available for input to the edgefx method: |
| 9 | + % Keyword Default Val Variable type |
| 10 | + % 'dis' defval; scalar |
| 11 | + % 'fs' defval; scalar |
| 12 | + % 'wl' defval; scalar/array |
| 13 | + % 'slp' defval; scalar/array |
| 14 | + % 'ch' defval; scalar |
| 15 | + % 'min_el_ch' 100; scalar |
| 16 | + % 'AngOfRe' 60; scalar |
| 17 | + % 'max_el' inf; scalar/array |
| 18 | + % 'max_el_ns' inf; scalar |
| 19 | + % 'g' 0.20; scalar/array |
| 20 | + % 'geodata' defval; geodata class |
| 21 | + % 'lmsl' defval; geodata class |
| 22 | + % 'dt' -1; scalar |
| 23 | + % 'fl' defval; scalar |
| 24 | + % 'Channels' defval; cell array |
| 25 | + % 'h0' defval; scalar |
| 26 | + % [defval = 0; % placeholder value if arg is not passed.] |
| 27 | + % |
| 28 | + % The 'wl','slp','max_el','g' options inputs can be scalars to apply |
| 29 | + % the parameter globally or they can be arrays to bound each parameter |
| 30 | + % value within topographic elevation bounds, using the following stucture: |
| 31 | + % [parameter_value1 z_min1 z_max1; |
| 32 | + % parameter_value2 z_min2 z_max2; |
| 33 | + % ... |
| 34 | + % parameter_valuen z_minn z_maxn]; |
| 35 | + % |
| 36 | + % where, z_min is the minimum elevation bound and z_max is the maximum elevation bound. |
| 37 | + % - similar to axis bounds on matlab plots such as caxis, xlim, ylim, ... |
| 38 | + % - z is oriented same as the DEM, i.e., +ve value of z is above datum (overland) |
27 | 39 | % |
28 | 40 | % This program is free software: you can redistribute it and/or modify |
29 | 41 | % it under the terms of the GNU General Public License as published by |
|
393 | 405 | d = reshape(d,obj.nx,[]); |
394 | 406 | end |
395 | 407 |
|
396 | | - %% Wavelength edgefx. |
| 408 | + %% Wavelength edge function. |
397 | 409 | function obj = wlfx(obj,feat) |
398 | 410 |
|
399 | 411 | % interpolate DEM's bathy linearly onto our edgefunction grid. |
|
413 | 425 | if numel(param)==1 |
414 | 426 | % no bounds specified. |
415 | 427 | wlp = param(1); |
416 | | - % set cuttof at 10 m by default |
417 | | - dp1 = -10; |
418 | | - dp2 = -inf; |
| 428 | + z_min = -inf; |
| 429 | + z_max = +inf; |
419 | 430 | else |
420 | 431 | wlp = param(1); |
421 | | - dp1 = param(2); |
422 | | - dp2 = param(3); |
| 432 | + z_min = param(2); |
| 433 | + z_max = param(3); |
423 | 434 | end |
424 | | - % limit to 1 m |
| 435 | + % limit min. depth to 1 m |
425 | 436 | twld = period*sqrt(grav*max(abs(tmpz),1))/wlp; |
426 | | - % Set wld with mask applied |
427 | | - obj.wld(tmpz < dp1 & tmpz > dp2 ) = ... |
428 | | - twld(tmpz < dp1 & tmpz > dp2); |
| 437 | + limidx = (tmpz >= z_min & tmpz < z_max); |
| 438 | + % Set wld with depth mask applied |
| 439 | + obj.wld(limidx) = twld(limidx); |
429 | 440 | clearvars twld |
430 | 441 | end |
431 | 442 | clearvars tmpz xg yg; |
432 | 443 | end |
433 | 444 |
|
434 | | - %% Topographic length scale/slope edge function. |
435 | 445 | %% Topographic length scale/slope edge function. |
436 | 446 | function obj = slpfx(obj,feat) |
437 | 447 |
|
|
444 | 454 | clear tmpz2 |
445 | 455 | end |
446 | 456 | tmpz(tmpz > 50) = 50; % ensure no larger than 50 m above land |
447 | | - % use a harvestine assumption |
| 457 | + % use a Harvestine assumption |
448 | 458 | dx = obj.h0*cosd(min(yg(1,:),85)); % for gradient function |
449 | 459 | dy = obj.h0; % for gradient function |
450 | 460 | % lets filter the bathy to get only relevant features |
|
613 | 623 | if numel(param)==1 |
614 | 624 | % no bounds specified. valid in this range. |
615 | 625 | slpp = param(1); |
616 | | - % default cutoff is 10 m |
617 | | - dp1 = -10; |
618 | | - dp2 = -inf; |
| 626 | + z_min = -inf; |
| 627 | + z_max = +inf; |
619 | 628 | else |
620 | 629 | slpp = param(1); |
621 | | - dp1 = param(2); |
622 | | - dp2 = param(3); |
| 630 | + z_min = param(2); |
| 631 | + z_max = param(3); |
623 | 632 | end |
624 | 633 | % Calculating the slope function |
625 | 634 | dp = max(1,-tmpz); |
626 | 635 | tslpd = (2*pi/slpp)*dp./(bs+eps); |
627 | | - obj.slpd(tmpz < dp1 & tmpz > dp2 ) = ... |
628 | | - tslpd(tmpz < dp1 & tmpz > dp2); |
| 636 | + % apply slope with mask |
| 637 | + limidx = (tmpz >= z_min & tmpz < z_max); |
| 638 | + obj.slpd(limidx) = tslpd(limidx); |
629 | 639 | clearvars tslpd |
630 | 640 | end |
631 | 641 | clearvars tmpz xg yg |
@@ -850,10 +860,10 @@ function plot(obj,type) |
850 | 860 | hh_m( limidx ) = mx; |
851 | 861 | else |
852 | 862 | mx = param(1); |
853 | | - dp1 = param(2); |
854 | | - dp2 = param(3); |
| 863 | + z_min = param(2); |
| 864 | + z_max = param(3); |
855 | 865 |
|
856 | | - limidx = (tmpz < dp1 & tmpz > dp2) & ... |
| 866 | + limidx = (tmpz >= z_min & tmpz < z_max) & ... |
857 | 867 | (hh_m > mx | isnan(hh_m)); |
858 | 868 |
|
859 | 869 | hh_m( limidx ) = mx; |
@@ -893,10 +903,10 @@ function plot(obj,type) |
893 | 903 | dmy = dmy + lim ; |
894 | 904 | else |
895 | 905 | lim = param(1); |
896 | | - dp1 = param(2); |
897 | | - dp2 = param(3); |
| 906 | + z_min = param(2); |
| 907 | + z_max = param(3); |
898 | 908 |
|
899 | | - limidx = (tmpz < dp1 & tmpz > dp2) ; |
| 909 | + limidx = (tmpz >= z_min & tmpz < z_max) ; |
900 | 910 |
|
901 | 911 | dmy( limidx ) = lim; |
902 | 912 | end |
|
0 commit comments