Skip to content

Commit a438b34

Browse files
authored
Merge pull request #247 from CHLNDDEV/release_version
*Prepare for new version
2 parents f6bc0cc + c503b9e commit a438b34

File tree

2 files changed

+32
-10
lines changed

2 files changed

+32
-10
lines changed

@msh/msh.m

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ function write(obj,fname,type)
335335
proj = 1;
336336
axis_limits = []; % use mesh extents to determine plot extents
337337
cmap = 1; % default value is specified in plot method
338+
leg_ind = [];
338339

339340
projtype = [];
340341
type = 'tri';
@@ -375,7 +376,7 @@ function write(obj,fname,type)
375376
projtype = MAP_PROJECTION.name;
376377
else
377378
error(['no native projection in msh class, please specify the plotting projection: ' ...
378-
'plot(m,''proj'',''lamb''), or no projection: plot(m,''proj'',''none'')'])
379+
'plot(m,''type'',''tri'',''proj'',''lamb''), or no projection: plot(m,''type'',''tri'',''proj'',''none'')'])
379380
end
380381
end
381382

@@ -445,6 +446,8 @@ function write(obj,fname,type)
445446
simpplot(obj.p,obj.t);
446447
end
447448
case('bd')
449+
legend_names = {'open ocean boundary','outer no-flux boundary',...
450+
'inner no-flux boundary','subgrid scale barriers'};
448451
if tri
449452
if proj
450453
m_triplot(obj.p(:,1),obj.p(:,2),obj.t);
@@ -455,47 +458,59 @@ function write(obj,fname,type)
455458
if ~isempty(obj.bd)
456459
for nb = 1 : obj.bd.nbou
457460
if obj.bd.ibtype(nb) == 24 || obj.bd.ibtype(nb) == 94
461+
if sum(leg_ind == 4) == 0
462+
leg_ind(end+1) = 4;
463+
end
458464
if proj
459465
% plot front facing
460466
m_plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),...
461467
obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),2),'g-','linewi',1.2);
462468
% plot back facing
463-
m_plot(obj.p(obj.bd.ibconn(1:obj.bd.nvell(nb),nb),1),...
469+
h(4) = m_plot(obj.p(obj.bd.ibconn(1:obj.bd.nvell(nb),nb),1),...
464470
obj.p(obj.bd.ibconn(1:obj.bd.nvell(nb),nb),2),'y-','linewi',1.2);
465471
else
466472
% plot front facing
467473
plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),...
468474
obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),2),'g-','linewi',1.2);
469475
% plot back facing
470-
plot(obj.p(obj.bd.ibconn(1:obj.bd.nvell(nb),nb),1),...
476+
h(4) = plot(obj.p(obj.bd.ibconn(1:obj.bd.nvell(nb),nb),1),...
471477
obj.p(obj.bd.ibconn(1:obj.bd.nvell(nb),nb),2),'y-','linewi',1.2);
472478
end
473479
elseif obj.bd.ibtype(nb) == 20
480+
if sum(leg_ind == 2) == 0
481+
leg_ind(end+1) = 2;
482+
end
474483
if proj
475-
m_plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),...
484+
h(2) = m_plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),...
476485
obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),2),'r-','linewi',1.2);
477486
else
478-
plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),...
487+
h(2) = plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),...
479488
obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),2),'r-','linewi',1.2);
480489
end
481490
else
491+
if sum(leg_ind == 3) == 0
492+
leg_ind(end+1) = 3;
493+
end
482494
if proj
483-
m_plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),...
495+
h(3) = m_plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),...
484496
obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),2),'g-','linewi',1.2);
485497
else
486-
plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),...
498+
h(3) = plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),...
487499
obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),2),'g-','linewi',1.2);
488500
end
489501
end
490502
end
491503
end
492504
if ~isempty(obj.op)
493505
for nb = 1 : obj.op.nope
506+
if sum(leg_ind == 1) == 0
507+
leg_ind(end+1) = 1;
508+
end
494509
if proj
495-
m_plot(obj.p(obj.op.nbdv(1:obj.op.nvdll(nb),nb),1),...
510+
h(1) = m_plot(obj.p(obj.op.nbdv(1:obj.op.nvdll(nb),nb),1),...
496511
obj.p(obj.op.nbdv(1:obj.op.nvdll(nb),nb),2),'b-','linewi',3.2);
497512
else
498-
plot(obj.p(obj.op.nbdv(1:obj.op.nvdll(nb),nb),1),...
513+
h(1) = plot(obj.p(obj.op.nbdv(1:obj.op.nvdll(nb),nb),1),...
499514
obj.p(obj.op.nbdv(1:obj.op.nvdll(nb),nb),2),'b-','linewi',1.2);
500515
end
501516
end
@@ -713,6 +728,9 @@ function write(obj,fname,type)
713728
% now add the box
714729
m_grid('FontSize',fsz,'bac',bgc);
715730
end
731+
if ~isempty(leg_ind)
732+
legend(h(leg_ind),legend_names(leg_ind),'location','best')
733+
end
716734

717735
function plotter(cmap,round_dec,yylabel,apply_pivot)
718736
% applies the plot for the quantiy 'q' and specific

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Besides posting [issues](https://github.com/CHLNDDEV/OceanMesh2D/issues) with th
3131

3232
Note: If the slack link invite isn't working, please send either one of us and an email and we'll fix it. By default, the invite link expires every 30 days.
3333

34-
Otherwise please reach out to either Dr. William Pringle (wpringle@anl.gov) or Dr. Keith Roberts (krober@usp.br) with questions or concerns or feel free to start an Issue in the issues tab above.
34+
Otherwise please reach out to either Dr. William Pringle (wpringle@anl.gov) or Dr. Keith Roberts (keithrbt0@gmail.com) with questions or concerns or feel free to start an Issue in the issues tab above.
3535

3636

3737
Contributing
@@ -148,6 +148,9 @@ Changelog
148148
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
149149

150150
### Unreleased (on current HEAD of the Projection branch)
151+
- None
152+
153+
### [5.0.0] - 2021-07-29
151154
## Added
152155
- `meshgen.build()` now will rewind the iteration set in the case mesh improvement cannot improve the qualities. https://github.com/CHLNDDEV/OceanMesh2D/pull/234
153156
- `msh.plot()` now has a `cmap` in which the user can specify their any `cmocean` colormap
@@ -163,6 +166,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
163166
- tidal constituents for `Make_f15` can now contain "major8" in addition to other constituents in the string/cell array https://github.com/CHLNDDEV/OceanMesh2D/pull/221
164167
- Correctly collect NDBC and NOS stations in mesh when creating `fort15` file using `Make_f15` for meteorological, velocity and elevation records https://github.com/CHLNDDEV/OceanMesh2D/pull/242
165168
## Changed
169+
- `msh.plot()` using type `bd` option now creates a legend for the different boundary condition types. https://github.com/CHLNDDEV/OceanMesh2D/pull/247
166170
- forcing facecolor to white in `m_trimesh` so that it does not intefere with background color option. https://github.com/CHLNDDEV/OceanMesh2D/pull/245
167171
- made topographic elevation bound option for max_ele, wl, slp, and g `edgefx` kwargs consistent and added explanation of this option is included in `edgefx` help. https://github.com/CHLNDDEV/OceanMesh2D/pull/230
168172
- `m_plot()` function calls `m_grid()` with background color input kwarg (if `backcolor` option used) instead of manual application. https://github.com/CHLNDDEV/OceanMesh2D/pull/225

0 commit comments

Comments
 (0)