


Add a set of river nodes comprising a single river to Mesh structure
Using a set of user-defined nodes
[Mobj] = add_river_nodes(Mobj)
DESCRIPTION:
Select using ginput the set of nodes comprising a river
INPUT
Mobj = Matlab mesh object
RiverName = Name of the River
OUTPUT:
Mobj = Matlab mesh object with an additional river nodelist
EXAMPLE USAGE
Mobj = add_river_nodes(Mobj,'Potomac')
Author(s):
Geoff Cowles (University of Massachusetts Dartmouth)
Note:
Uses ginput2 which allows zooming before selecting points and displays
clicked points realtime
Revision history
==============================================================================

0001 function [Mobj] = add_river_nodes(Mobj,Nlist,RiverName) 0002 0003 % Add a set of river nodes comprising a single river to Mesh structure 0004 % Using a set of user-defined nodes 0005 % 0006 % [Mobj] = add_river_nodes(Mobj) 0007 % 0008 % DESCRIPTION: 0009 % Select using ginput the set of nodes comprising a river 0010 % 0011 % INPUT 0012 % Mobj = Matlab mesh object 0013 % RiverName = Name of the River 0014 % 0015 % OUTPUT: 0016 % Mobj = Matlab mesh object with an additional river nodelist 0017 % 0018 % EXAMPLE USAGE 0019 % Mobj = add_river_nodes(Mobj,'Potomac') 0020 % 0021 % Author(s): 0022 % Geoff Cowles (University of Massachusetts Dartmouth) 0023 % 0024 % Note: 0025 % Uses ginput2 which allows zooming before selecting points and displays 0026 % clicked points realtime 0027 % 0028 % Revision history 0029 % 0030 %============================================================================== 0031 subname = 'add_river_nodes'; 0032 global ftbverbose 0033 if(ftbverbose) 0034 fprintf('\n') 0035 fprintf(['begin : ' subname '\n']) 0036 end; 0037 0038 %------------------------------------------------------------------------------ 0039 % Get a unique list and make sure they are in the range of node numbers 0040 %------------------------------------------------------------------------------ 0041 Nlist = unique(Nlist); 0042 0043 if(max(Nlist) > Mobj.nVerts); 0044 fprintf('your river node number(s) exceed the total number of nodes in the domain\n'); 0045 fprintf('stop screwing around\n'); 0046 error('stopping...\n') 0047 end; 0048 0049 %------------------------------------------------------------------------------ 0050 % Plot the mesh 0051 %------------------------------------------------------------------------------ 0052 0053 if(lower(Mobj.nativeCoords(1:3)) == 'car') 0054 x = Mobj.x; 0055 y = Mobj.y; 0056 else 0057 x = Mobj.lon; 0058 y = Mobj.lat; 0059 end; 0060 0061 figure 0062 patch('Vertices',[x,y],'Faces',Mobj.tri,... 0063 'Cdata',Mobj.h,'edgecolor','k','facecolor','interp'); 0064 hold on; 0065 0066 plot(x(Nlist),y(Nlist),'ro'); 0067 title('river nodes'); 0068 0069 % add to mesh object 0070 npts = numel(Nlist); 0071 Mobj.nRivers = Mobj.nRivers + 1; 0072 Mobj.nRivNodes(Mobj.nRivers) = npts; 0073 Mobj.riv_nodes(Mobj.nRivers,1:npts) = Nlist; 0074 Mobj.riv_name{Mobj.nRivers} = RiverName; 0075 0076 0077 if(ftbverbose) 0078 fprintf(['end : ' subname '\n']) 0079 end; 0080