Skip to content

Commit 57e45c5

Browse files
authored
Merge pull request #323 from donnaaboise/updates_donna
Updates to Matlab plotting routines
2 parents fffa176 + 36efc46 commit 57e45c5

13 files changed

Lines changed: 171 additions & 37 deletions

src/matlab/README.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
********************************************************************
2+
As of June 2026, clawgraphics will be maintained at a new repository
3+
4+
http://www.github.com/ForestClaw/ClawGraphics
5+
6+
Clone this repository and update your MATLABPATH to stay up-to-date with
7+
latest clawgraphics plotting routines.
8+
********************************************************************
9+
10+
This is a repository of Matlab routines, developed over the years, that support
11+
visualization of Clawpack, AMRClaw and ForestClaw output. Output is
12+
designed specifically to support ASCII output from these packages.
13+
14+
Some features of these routines include
15+
16+
* Support for adaptive mesh output from AMRClaw, GeoClaw and ForestClaw.
17+
* Plot gauges and general transsects.
18+
* Easily inspect patch data for debugging purposes.
19+
20+
Type
21+
22+
>> help clawgraphics
23+
24+
at the Matlab prompt for more help on available routines.
25+
26+
Use `pathtool` to update your MATLABPATH to the location of these routines.
27+

src/matlab/add_gauges.m

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
% See also add_regions, plot_gauges.
1616

1717

18-
if (nargin < 1)
18+
if nargin < 1
1919
format = 'ForestClaw';
2020
end
2121

@@ -48,15 +48,16 @@
4848
for n = 1:num_gauges
4949
g = gauges(n);
5050
zp = zmax;
51-
hg = plot3(g.longitude,g.latitude,zp,'m.','linewidth',3,'markersize',95);
51+
hg = plot3(g.x,g.y,zp,'m.','linewidth',3,'markersize',75);
5252
set(gca,'zlim',zl);
5353
view(2);
5454
% set(gca,'zlimmode','auto');
5555
set(hg,'Tag','gauge');
5656
set(hg,'userdata',g);
57-
h = text(g.longitude,g.latitude,zp,sprintf('%d',g.id),'fontsize',11,'color','k');
57+
h = text(g.x,g.y,zp,sprintf('%d',g.id),'fontsize',11,'color','k','fontweight','bold');
5858
set(h,'HorizontalAlignment','center');
5959
% set(h,'backgroundcolor','none');
60+
set(hg,'userdata',h);
6061
gauge_handles(n) = hg;
6162
end
6263

@@ -92,9 +93,11 @@
9293
fgetl(fid);
9394
end
9495

95-
gtype = struct('id',[],'longitude',[],'latitude',[],'t0',[],'t1',[]);
96+
gtype = struct('id',[],'x',[],'y',[],'t0',[],'t1',[]);
9697

9798
fgetl(fid); % blank line
99+
l = fgetl(fid); % Dimension
100+
dim = sscanf(l,'%d',1);
98101
l = fgetl(fid); % Get number of gauges
99102
num_gauges = sscanf(l,'%d',1);
100103
gauges(1:num_gauges) = gtype;
@@ -103,10 +106,17 @@
103106
data = sscanf(l,'%d %e %e %e %d',Inf);
104107
g = gtype;
105108
g.id = data(1);
106-
g.longitude = data(2);
107-
g.latitude = data(3);
108-
g.t0 = data(4);
109-
g.t1 = data(5);
109+
g.x = data(2);
110+
g.y = data(3);
111+
if dim == 2
112+
g.t0 = data(4);
113+
g.t1 = data(5);
114+
else
115+
g.z = data(4);
116+
g.t0 = data(5);
117+
g.t1 = data(6);
118+
end
119+
110120
gauges(n) = g;
111121
end
112122

src/matlab/add_regions.m

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function rhout = add_regions(t,format)
1+
function rhout = add_regions(t,read_dim,format)
22
%
33
% add_regions plots regions from file 'regions.data'
44
%
@@ -15,8 +15,11 @@
1515
% See also add_gauges, plot_gauges.
1616

1717

18-
if (nargin < 2)
18+
if (nargin < 3)
1919
format = 'ForestClaw';
20+
if (nargin < 2)
21+
read_dim = true;
22+
end
2023
end
2124

2225
use_forestclaw = strcmpi(format,'forestclaw');
@@ -40,7 +43,15 @@
4043
fgetl(fid);
4144
end
4245
fgetl(fid); % blank line
43-
l = fgetl(fid); % Get number of gauges
46+
if read_dim
47+
l = fgetl(fid); % Get dimension of region
48+
dim = sscanf(l,'%d',1);
49+
if (dim ~= 2)
50+
error('afterframe : Region file must be a 2d file')
51+
end
52+
end
53+
54+
l = fgetl(fid); % Get number of regions
4455
num_regions = sscanf(l,'%d',1);
4556

4657
c = {'w','w','w','w','w','w','w'}; % Colors for each region
@@ -58,8 +69,8 @@
5869
for n = 1:num_regions
5970
l = fgetl(fid);
6071
data = sscanf(l,'%d %d %e %e %e %e %e %e',Inf);
61-
minlevel = data(1);
62-
maxlevel = data(2);
72+
% minlevel = data(1);
73+
% maxlevel = data(2);
6374
t0 = data(3);
6475
t1 = data(4);
6576
x0 = data(5);
@@ -79,6 +90,7 @@
7990
else
8091
set(gca,'zlim',[0,max(zl)]);
8192
end
93+
region_handles(n) = hg;
8294
hold on;
8395
end
8496

src/matlab/clawgraphics.m

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
%
2+
% CLAWGRAPHICS is no longer being maintained as part of Visclaw.
3+
%
4+
% As of June 1016, CLAWGRAPHICS will be maintained at a new repository.
5+
%
6+
%
17
% Routines for plotting data output from Clawpack package
28
%
39
% Basic Clawpack plotting routines and options.
@@ -112,6 +118,16 @@
112118
% Misc
113119
% ----
114120
% setviews - sets pre-defined viewing angles
115-
%
121+
%
116122
% Type 'help' on any one of the individual topics above for more help.
117123
%
124+
% NOTE
125+
% ----
126+
%
127+
% As of June 2026, CLAWGRAPHICS will be maintained at a new repository
128+
%
129+
% http://www.github.com/ForestClaw/ClawGraphics
130+
%
131+
% Clone this repository and update your MATLABPATH to stay up-to-date with
132+
% latest CLAWGRAPHICS plotting routines.
133+
%

src/matlab/map1d.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,5 @@
4545
%
4646
%
4747
% See also SETPLOTSTYLE, PLOTFRAME1EZ, GETLEGENDINFO, SETPLOT.
48+
49+

src/matlab/plotclaw1.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@
2727

2828
clawdim = 1;
2929

30+
fprintf('\n');
31+
fprintf('***********************************************************\n')
32+
fprintf('NOTE:\n')
33+
fprintf(['As of June, 2026, ClawGraphics will no longer be maintained\n',...
34+
'as part of Visclaw. Type \n\n', ...
35+
' >> help clawgraphics\n\n',...
36+
'for more information.\n'])
37+
fprintf('***********************************************************\n')
38+
fprintf('\n');
39+
3040
fprintf('\n')
3141
fprintf('plotclaw1 plots 1d results from clawpack\n')
3242

src/matlab/plotclaw2.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@
2828

2929
clawdim = 2;
3030

31+
fprintf('\n');
32+
fprintf('***********************************************************\n')
33+
fprintf('NOTE:\n')
34+
fprintf(['As of June, 2026, ClawGraphics will no longer be maintained\n',...
35+
'as part of Visclaw. Type \n\n', ...
36+
' >> help clawgraphics\n\n',...
37+
'for more information.\n'])
38+
fprintf('***********************************************************\n')
39+
fprintf('\n');
40+
3141
fprintf('\n')
3242
fprintf('plotclaw2 plots 2d results from clawpack or amrclaw\n')
3343

src/matlab/plotclaw3.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@
2424

2525
clawdim = 3;
2626

27+
fprintf('\n');
28+
fprintf('***********************************************************\n')
29+
fprintf('NOTE:\n')
30+
fprintf(['As of June, 2026, ClawGraphics will no longer be maintained\n',...
31+
'as part of Visclaw. Type \n\n', ...
32+
' >> help clawgraphics\n\n',...
33+
'for more information.\n'])
34+
fprintf('***********************************************************\n')
35+
fprintf('\n');
36+
2737
disp(' ')
2838
disp('plotclaw3 plots 3d results from clawpack or amrclaw')
2939

src/matlab/plotframe2.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@
254254
if (UserVariable == 1)
255255
% User has supplied a function to convert original q variables to
256256
% the variable which is to be plotted, e.g. Mach number, entropy.
257-
qdata = feval(UserVariableFile,data);
257+
258+
qdata = feval(UserVariableFile,data,x,y);
258259
q = reshape(qdata,mx,my);
259260
else
260261
q = reshape(data(:,mq),mx,my);
@@ -317,7 +318,7 @@
317318

318319
if (usermap1d == 1)
319320
% Users should call mapc2p from inside of map1d.
320-
[rvec,qvec] = map1d(xcm,ycm,qmesh);
321+
[rvec,qvec] = map1d(xcm,ycm,qmesh,t);
321322
[rs,cs] = size(rvec);
322323
[rq,cq] = size(qvec);
323324
if (cs > 1 || cq > 1)

src/matlab/ppcolors.m

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%
44
% CM = PPCOLORS(N) creates a colormap of length N of N distinct colors.
55
%
6-
% CM = PPCOLORS(N,S) creates a colormap based on rand seed N
6+
% CM = PPCOLORS(N,S) selects a colors based on rand seed S
77
%
88
% [CM,S] = PPCOLORS(N) returns the random seed used to generate colormap.
99
%
@@ -13,6 +13,7 @@
1313
%
1414
% See also ppcolors_colorbar to create a colorbar for this colormap.
1515

16+
% Choose colors :
1617

1718
chex = {...
1819
'#000000','#FFFF00','#1CE6FF','#FF34FF','#FF4A46','#008941','#006FA6','#A30059',...
@@ -23,6 +24,7 @@
2324
'#372101','#FFB500','#C2FFED','#A079BF','#CC0744','#C0B9B2','#C2FF99','#001E09',...
2425
'#00489C','#6F0062','#0CBD66','#EEC3FF','#456D75','#B77B68','#7A87A1','#788D66',...
2526
'#885578','#FAD09F','#FF8A9A','#D157A0','#BEC459','#456648','#0086ED','#886F4C',...
27+
...
2628
'#34362D','#B4A8BD','#00A6AA','#452C2C','#636375','#A3C8C9','#FF913F','#938A81',...
2729
'#575329','#00FECF','#B05B6F','#8CD0FF','#3B9700','#04F757','#C8A1A1','#1E6E00',...
2830
'#7900D7','#A77500','#6367A9','#A05837','#6B002C','#772600','#D790FF','#9B9700',...
@@ -31,6 +33,7 @@
3133
'#83AB58','#001C1E','#D1F7CE','#004B28','#C8D0F6','#A3A489','#806C66','#222800',...
3234
'#BF5650','#E83000','#66796D','#DA007C','#FF1A59','#8ADBB4','#1E0200','#5B4E51',...
3335
'#C895C5','#320033','#FF6832','#66E1D3','#CFCDAC','#D0AC94','#7ED379','#012C58',...
36+
...
3437
'#7A7BFF','#D68E01','#353339','#78AFA1','#FEB2C6','#75797C','#837393','#943A4D',...
3538
'#B5F4FF','#D2DCD5','#9556BD','#6A714A','#001325','#02525F','#0AA3F7','#E98176',...
3639
'#DBD5DD','#5EBCD1','#3D4F44','#7E6405','#02684E','#962B75','#8D8546','#9695C5',...
@@ -39,6 +42,7 @@
3942
'#6B94AA','#51A058','#A45B02','#1D1702','#E20027','#E7AB63','#4C6001','#9C6966',...
4043
'#64547B','#97979E','#006A66','#391406','#F4D749','#0045D2','#006C31','#DDB6D0',...
4144
'#7C6571','#9FB2A4','#00D891','#15A08A','#BC65E9','#FFFFFE','#C6DC99','#203B3C',...
45+
...
4246
'#671190','#6B3A64','#F5E1FF','#FFA0F2','#CCAA35','#374527','#8BB400','#797868',...
4347
'#C6005A','#3B000A','#C86240','#29607C','#402334','#7D5A44','#CCB87C','#B88183',...
4448
'#AA5199','#B5D6C3','#A38469','#9F94F0','#A74571','#B894A6','#71BB8C','#00B433',...
@@ -47,8 +51,35 @@
4751
'#1A3A2A','#494B5A','#A88C85','#F4ABAA','#A3F3AB','#00C6C8','#EA8B66','#958A9F',...
4852
'#BDC9D2','#9FA064','#BE4700','#658188','#83A485','#453C23','#47675D','#3A3F00',...
4953
'#061203','#DFFB71','#868E7E','#98D058','#6C8F7D','#D7BFC2','#3C3E6E','#D83D66',...
54+
...
5055
'#2F5D9B','#6C5E46','#D25B88','#5B656C','#00B57F','#545C46','#866097','#365D25',...
51-
'#252F99','#00CCFF','#674E60','#FC009C','#92896B'};
56+
'#252F99','#00CCFF','#674E60','#FC009C','#92896B','#000000','#000000','#000000',...
57+
'#000000','#000000','#000000','#000000','#000000','#000000','#000000','#000000',...
58+
'#000000','#000000','#000000','#000000','#000000','#000000','#000000','#000000',...
59+
'#000000','#000000','#000000','#000000','#000000','#000000','#000000','#000000',...
60+
'#000000','#000000','#000000','#000000','#000000','#000000','#000000','#000000',...
61+
'#000000','#000000','#000000','#000000','#000000','#000000','#000000','#000000',...
62+
'#000000','#000000','#000000','#000000','#000000','#000000','#000000','#000000'};
63+
64+
65+
% Colors to kick out;choose colors by "group", above.
66+
% Group 1 : Colors 1:64 in chex.
67+
% Group 2 : Colors 65:128 in chex
68+
% ...
69+
% For convenience, each group has indices 1-64. We increment indices to
70+
% construct list of colors to kick.
71+
72+
I1 = [1,7,8,10,11,14,17,18,20,23,25,26,27,34,35,37,39,41,48,49,50,53,55,57,62,64];
73+
I2 = [1,4,5,9,16,21,22,27,28,31,32,33,35,36,39,40,42,44,47,48,49,51,52,55,56,58,64];
74+
I3 = [3,6,7,8,12,13,14,19,20,21,22,29,30,33,35,36,39,40,44,47,48,49,51,52,55,57,64];
75+
I4 = [1,2,6,10,13,14,15,27,28,33,37,38,40,41,42,52,53,54,55,56,57,60,63];
76+
I5 = [1,2,4,6,8,9,11,14:64];
77+
78+
% Indices are incremented according to group.
79+
I = [I1, I2+64, I3+2*64, I4+3*64, I5+4*64];
80+
81+
% Remove darker colors
82+
chex(I) = [];
5283

5384
m = length(chex);
5485
r = zeros(m,1);

0 commit comments

Comments
 (0)