Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions src/matlab/add_gauges.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
% See also add_regions, plot_gauges.


if (nargin < 1)
if nargin < 1
format = 'ForestClaw';
end

Expand Down Expand Up @@ -48,13 +48,13 @@
for n = 1:num_gauges
g = gauges(n);
zp = zmax;
hg = plot3(g.longitude,g.latitude,zp,'m.','linewidth',3,'markersize',95);
hg = plot3(g.x,g.y,zp,'m.','linewidth',3,'markersize',75);
set(gca,'zlim',zl);
view(2);
% set(gca,'zlimmode','auto');
set(hg,'Tag','gauge');
set(hg,'userdata',g);
h = text(g.longitude,g.latitude,zp,sprintf('%d',g.id),'fontsize',11,'color','k');
h = text(g.x,g.y,zp,sprintf('%d',g.id),'fontsize',11,'color','k','fontweight','bold');
set(h,'HorizontalAlignment','center');
% set(h,'backgroundcolor','none');
gauge_handles(n) = hg;
Expand Down Expand Up @@ -92,9 +92,11 @@
fgetl(fid);
end

gtype = struct('id',[],'longitude',[],'latitude',[],'t0',[],'t1',[]);
gtype = struct('id',[],'x',[],'y',[],'t0',[],'t1',[]);

fgetl(fid); % blank line
l = fgetl(fid); % Dimension
dim = sscanf(l,'%d',1);
l = fgetl(fid); % Get number of gauges
num_gauges = sscanf(l,'%d',1);
gauges(1:num_gauges) = gtype;
Expand All @@ -103,10 +105,17 @@
data = sscanf(l,'%d %e %e %e %d',Inf);
g = gtype;
g.id = data(1);
g.longitude = data(2);
g.latitude = data(3);
g.t0 = data(4);
g.t1 = data(5);
g.x = data(2);
g.y = data(3);
if dim == 2
g.t0 = data(4);
g.t1 = data(5);
else
g.z = data(4);
g.t0 = data(5);
g.t1 = data(6);
end

gauges(n) = g;
end

Expand Down
22 changes: 17 additions & 5 deletions src/matlab/add_regions.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function rhout = add_regions(t,format)
function rhout = add_regions(t,read_dim,format)
%
% add_regions plots regions from file 'regions.data'
%
Expand All @@ -15,8 +15,11 @@
% See also add_gauges, plot_gauges.


if (nargin < 2)
if (nargin < 3)
format = 'ForestClaw';
if (nargin < 2)
read_dim = true;
end
end

use_forestclaw = strcmpi(format,'forestclaw');
Expand All @@ -40,7 +43,15 @@
fgetl(fid);
end
fgetl(fid); % blank line
l = fgetl(fid); % Get number of gauges
if read_dim
l = fgetl(fid); % Get dimension of region
dim = sscanf(l,'%d',1);
if (dim ~= 2)
error('afterframe : Region file must be a 2d file')
end
end

l = fgetl(fid); % Get number of regions
num_regions = sscanf(l,'%d',1);

c = {'w','w','w','w','w','w','w'}; % Colors for each region
Expand All @@ -58,8 +69,8 @@
for n = 1:num_regions
l = fgetl(fid);
data = sscanf(l,'%d %d %e %e %e %e %e %e',Inf);
minlevel = data(1);
maxlevel = data(2);
% minlevel = data(1);
% maxlevel = data(2);
t0 = data(3);
t1 = data(4);
x0 = data(5);
Expand All @@ -79,6 +90,7 @@
else
set(gca,'zlim',[0,max(zl)]);
end
region_handles(n) = hg;
hold on;
end

Expand Down
2 changes: 2 additions & 0 deletions src/matlab/map1d.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@
%
%
% See also SETPLOTSTYLE, PLOTFRAME1EZ, GETLEGENDINFO, SETPLOT.


5 changes: 3 additions & 2 deletions src/matlab/plotframe2.m
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@
if (UserVariable == 1)
% User has supplied a function to convert original q variables to
% the variable which is to be plotted, e.g. Mach number, entropy.
qdata = feval(UserVariableFile,data);

qdata = feval(UserVariableFile,data,x,y);
q = reshape(qdata,mx,my);
else
q = reshape(data(:,mq),mx,my);
Expand Down Expand Up @@ -317,7 +318,7 @@

if (usermap1d == 1)
% Users should call mapc2p from inside of map1d.
[rvec,qvec] = map1d(xcm,ycm,qmesh);
[rvec,qvec] = map1d(xcm,ycm,qmesh,t);
[rs,cs] = size(rvec);
[rq,cq] = size(qvec);
if (cs > 1 || cq > 1)
Expand Down
26 changes: 25 additions & 1 deletion src/matlab/ppcolors.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
%
% See also ppcolors_colorbar to create a colorbar for this colormap.

% Choose colors :

chex = {...
'#000000','#FFFF00','#1CE6FF','#FF34FF','#FF4A46','#008941','#006FA6','#A30059',...
Expand All @@ -23,6 +24,7 @@
'#372101','#FFB500','#C2FFED','#A079BF','#CC0744','#C0B9B2','#C2FF99','#001E09',...
'#00489C','#6F0062','#0CBD66','#EEC3FF','#456D75','#B77B68','#7A87A1','#788D66',...
'#885578','#FAD09F','#FF8A9A','#D157A0','#BEC459','#456648','#0086ED','#886F4C',...
...
'#34362D','#B4A8BD','#00A6AA','#452C2C','#636375','#A3C8C9','#FF913F','#938A81',...
'#575329','#00FECF','#B05B6F','#8CD0FF','#3B9700','#04F757','#C8A1A1','#1E6E00',...
'#7900D7','#A77500','#6367A9','#A05837','#6B002C','#772600','#D790FF','#9B9700',...
Expand All @@ -31,6 +33,7 @@
'#83AB58','#001C1E','#D1F7CE','#004B28','#C8D0F6','#A3A489','#806C66','#222800',...
'#BF5650','#E83000','#66796D','#DA007C','#FF1A59','#8ADBB4','#1E0200','#5B4E51',...
'#C895C5','#320033','#FF6832','#66E1D3','#CFCDAC','#D0AC94','#7ED379','#012C58',...
...
'#7A7BFF','#D68E01','#353339','#78AFA1','#FEB2C6','#75797C','#837393','#943A4D',...
'#B5F4FF','#D2DCD5','#9556BD','#6A714A','#001325','#02525F','#0AA3F7','#E98176',...
'#DBD5DD','#5EBCD1','#3D4F44','#7E6405','#02684E','#962B75','#8D8546','#9695C5',...
Expand All @@ -39,6 +42,7 @@
'#6B94AA','#51A058','#A45B02','#1D1702','#E20027','#E7AB63','#4C6001','#9C6966',...
'#64547B','#97979E','#006A66','#391406','#F4D749','#0045D2','#006C31','#DDB6D0',...
'#7C6571','#9FB2A4','#00D891','#15A08A','#BC65E9','#FFFFFE','#C6DC99','#203B3C',...
...
'#671190','#6B3A64','#F5E1FF','#FFA0F2','#CCAA35','#374527','#8BB400','#797868',...
'#C6005A','#3B000A','#C86240','#29607C','#402334','#7D5A44','#CCB87C','#B88183',...
'#AA5199','#B5D6C3','#A38469','#9F94F0','#A74571','#B894A6','#71BB8C','#00B433',...
Expand All @@ -47,8 +51,28 @@
'#1A3A2A','#494B5A','#A88C85','#F4ABAA','#A3F3AB','#00C6C8','#EA8B66','#958A9F',...
'#BDC9D2','#9FA064','#BE4700','#658188','#83A485','#453C23','#47675D','#3A3F00',...
'#061203','#DFFB71','#868E7E','#98D058','#6C8F7D','#D7BFC2','#3C3E6E','#D83D66',...
...
'#2F5D9B','#6C5E46','#D25B88','#5B656C','#00B57F','#545C46','#866097','#365D25',...
'#252F99','#00CCFF','#674E60','#FC009C','#92896B'};
'#252F99','#00CCFF','#674E60','#FC009C','#92896B','#000000','#000000','#000000',...
'#000000','#000000','#000000','#000000','#000000','#000000','#000000','#000000',...
'#000000','#000000','#000000','#000000','#000000','#000000','#000000','#000000',...
'#000000','#000000','#000000','#000000','#000000','#000000','#000000','#000000',...
'#000000','#000000','#000000','#000000','#000000','#000000','#000000','#000000',...
'#000000','#000000','#000000','#000000','#000000','#000000','#000000','#000000',...
'#000000','#000000','#000000','#000000','#000000','#000000','#000000','#000000'};


% Colors to kick out
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];
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];
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];
I4 = [1,2,6,10,13,14,15,27,28,33,37,38,40,41,42,52,53,54,55,56,57,60,63];
I5 = [1,2,4,6,8,9,11,14:64];

I = [I1, I2+64, I3+2*64, I4+3*64, I5+4*64];

% Remove darker colors
chex(I) = [];

m = length(chex);
r = zeros(m,1);
Expand Down
33 changes: 20 additions & 13 deletions src/matlab/read_gauge_data.m
Original file line number Diff line number Diff line change
@@ -1,40 +1,47 @@
function gauges = read_gauge_data()
%
% read_gauge_data reads data in 'gauges.data' file and returns data in a
% struct.
%
% read_gauge_data() reads data in a file 'gauges.data'. Data is assumed to
% be in the current directory.
%
% See also add_gauges, add_regions.
% See also track_gauges, add_gauges, add_regions.

if (~exist('gauges.data','file'))
fprintf('File gauges.data does not exist. No gauges will be plotted.\n');
gauges = [];
return
end

gtype = struct('id',[],'longitude',[],'latitude',[],'t0',[],'t1',[]);

fid = fopen('gauges.data','r');
for i = 1:5
% Read first five lines of comments
fgetl(fid);
end

fgetl(fid); % blank line
gtype = struct('id',[],'x',[],'y',[],'t0',[],'t1',[]);

fgetl(fid); % blank line
l = fgetl(fid); % Dimension
dim = sscanf(l,'%d',1);
l = fgetl(fid); % Get number of gauges
num_gauges = sscanf(l,'%d',1);
gauges(1:num_gauges) = gtype;
for n = 1:num_gauges
for n = 1:num_gauges
l = fgetl(fid);
data = sscanf(l,'%d %e %e %e %d',Inf);
g = gtype;
g.id = data(1);
g.longitude = data(2);
g.latitude = data(3);
g.t0 = data(4);
g.t1 = data(5);
g.x = data(2);
g.y = data(3);
if dim == 2
g.t0 = data(4);
g.t1 = data(5);
else
g.z = data(4);
g.t0 = data(5);
g.t1 = data(6);
end

gauges(n) = g;
end

end
end
4 changes: 2 additions & 2 deletions src/matlab/set_colors.m
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ function set_colors(p,x,y,z,q,colormapping)
else
qmin = pp.qmin;
qmax = pp.qmax;
m_proc_color = qmin <= qm & qm <= qmax;
m_q = qm < qmin | qm > qmax;
m_q = qmin <= qm & qm <= qmax;
m_proc_color = qm < qmin | qm > qmax;
end

% Indices that should use proc colormap
Expand Down