Home > fvcom_prepro > write_river_info.m

write_river_info

PURPOSE ^

Write information on the rivers

SYNOPSIS ^

function write_river_info(Mobj,filename)

DESCRIPTION ^

 Write information on the rivers

 function write_river_info(Mobj,filename)

 DESCRIPTION:
    Generate an ascii format containing river information this can be used
    to setup a RIVER name list which connects model nodes to Rivers and to the
    NetCDF file containing those rivers

 INPUT 
   Mobj     = Mesh object
   filename = river information file

 OUTPUT:
    river information file: filename

 EXAMPLE USAGE
    write_FVCOM_grid(Mobj,'riv_info')   

 Author(s):  
    Geoff Cowles (University of Massachusetts Dartmouth)

 Revision history
   
==============================================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function write_river_info(Mobj,filename) 
0002 
0003 % Write information on the rivers
0004 %
0005 % function write_river_info(Mobj,filename)
0006 %
0007 % DESCRIPTION:
0008 %    Generate an ascii format containing river information this can be used
0009 %    to setup a RIVER name list which connects model nodes to Rivers and to the
0010 %    NetCDF file containing those rivers
0011 %
0012 % INPUT
0013 %   Mobj     = Mesh object
0014 %   filename = river information file
0015 %
0016 % OUTPUT:
0017 %    river information file: filename
0018 %
0019 % EXAMPLE USAGE
0020 %    write_FVCOM_grid(Mobj,'riv_info')
0021 %
0022 % Author(s):
0023 %    Geoff Cowles (University of Massachusetts Dartmouth)
0024 %
0025 % Revision history
0026 %
0027 %==============================================================================
0028 subname = 'write_river_info';
0029 fprintf('\n'); fprintf(['begin : ' subname '\n']);
0030 
0031 %------------------------------------------------------------------------------
0032 % Parse input arguments
0033 %------------------------------------------------------------------------------
0034 if(exist('Mobj')*exist('filename')==0)
0035     error('arguments to write_river_info are incorrect')
0036 end;
0037 
0038 %------------------------------------------------------------------------------
0039 % Dump the file
0040 %------------------------------------------------------------------------------
0041 fid = fopen(filename,'w');
0042 fprintf(fid,'nRivers = %d\n',Mobj.nRivers);
0043 if(Mobj.nRivers>0)
0044     for i=1:Mobj.nRivers
0045         fprintf(fid,'River# %d name %s #Nodes %d\n',i,char(Mobj.riv_name(i)),Mobj.nRivNodes(i));
0046         for j=1:Mobj.nRivNodes(i)
0047             fprintf(fid,'%d  ',Mobj.riv_nodes(i,j));
0048         end;
0049         fprintf('\n')
0050     end;
0051 end;
0052         
0053 
0054 
0055 fprintf(['end   : ' subname '\n'])
0056

Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005