[Dart-dev] [7099] DART/trunk/utilities: add documentation for set_filename_list, and change the arguments
nancy at ucar.edu
nancy at ucar.edu
Mon Aug 4 11:05:51 MDT 2014
Revision: 7099
Author: nancy
Date: 2014-08-04 11:05:50 -0600 (Mon, 04 Aug 2014)
Log Message:
-----------
add documentation for set_filename_list, and change the arguments
so they don't have 'seq' in them since this is a general name handling
function.
Modified Paths:
--------------
DART/trunk/utilities/utilities_mod.f90
DART/trunk/utilities/utilities_mod.html
-------------- next part --------------
Modified: DART/trunk/utilities/utilities_mod.f90
===================================================================
--- DART/trunk/utilities/utilities_mod.f90 2014-08-04 16:49:26 UTC (rev 7098)
+++ DART/trunk/utilities/utilities_mod.f90 2014-08-04 17:05:50 UTC (rev 7099)
@@ -1667,14 +1667,18 @@
!#######################################################################
-function set_filename_list(filename_seq, filename_seq_list, caller_name)
+function set_filename_list(name_array, listname, caller_name)
-! sort out the input lists, return the number of names found,
-! if a list was given put the list into the array, and return
-! -1 if an error.
+! return the count of names specified by either the name_array()
+! or the inside the listname but not both. caller_name is used
+! for error messages. verify that if a listname is used that
+! it does not contain more than the allowed number of input names
+! (specified by the length of the name_array). the listname,
+! if specified, must be the name of an ascii input file with
+! a list of names, one per line.
-character(len=*), intent(inout) :: filename_seq(:)
-character(len=*), intent(in) :: filename_seq_list
+character(len=*), intent(inout) :: name_array(:)
+character(len=*), intent(in) :: listname
character(len=*), intent(in) :: caller_name
integer :: set_filename_list
@@ -1683,29 +1687,29 @@
character(len=32) :: fsource
! here's the logic:
-! if the user specifies neither filename_seq nor filename_seq_list, error
+! if the user specifies neither name_array nor listname, error
! if the user specifies both, error.
! if the user gives a filelist, we make sure the length is not more
! than maxfiles and read it into the explicit list and continue.
! when this routine returns, the function return val is the count
-! and the names are in filename_seq()
+! and the names are in name_array()
-if (filename_seq(1) == '' .and. filename_seq_list == '') then
+if (name_array(1) == '' .and. listname == '') then
call error_handler(E_ERR, caller_name, &
'must specify either filenames in the namelist, or a filename containing a list of names', &
source,revision,revdate)
endif
! make sure the namelist specifies one or the other but not both
-if (filename_seq(1) /= '' .and. filename_seq_list /= '') then
+if (name_array(1) /= '' .and. listname /= '') then
call error_handler(E_ERR, caller_name, &
'cannot specify both filenames in the namelist and a filename containing a list of names', &
source,revision,revdate)
endif
! if they have specified a file which contains a list, read it into
-! the filename_seq array and set the count.
-if (filename_seq_list /= '') then
+! the name_array array and set the count.
+if (listname /= '') then
fsource = 'filenames contained in a list file'
from_file = .true.
else
@@ -1715,12 +1719,12 @@
! the max number of names in a namelist file is the size of the array
! that will be returned.
-max_num_input_files = size(filename_seq)
+max_num_input_files = size(name_array)
do findex = 1, max_num_input_files
if (from_file) &
- filename_seq(findex) = get_next_filename(filename_seq_list, findex)
+ name_array(findex) = get_next_filename(listname, findex)
- if (filename_seq(findex) == '') then
+ if (name_array(findex) == '') then
if (findex == 1) then
call error_handler(E_ERR, caller_name, &
'found no '//trim(fsource), source,revision,revdate)
@@ -1736,7 +1740,7 @@
! if you're reading from a file, make sure you don't have more
! names in the file than can fit in the array.
if (from_file) then
- if (get_next_filename(filename_seq_list, max_num_input_files+1) /= '') then
+ if (get_next_filename(listname, max_num_input_files+1) /= '') then
write(msgstring, *) 'cannot specify more than ',max_num_input_files,' files'
call error_handler(E_ERR, caller_name, msgstring, source,revision,revdate)
endif
@@ -1830,6 +1834,11 @@
function next_file(fname,ifile)
+
+! FIXME: THIS FUNCTION IS DEPRECATED AND SHOULD BE REMOVED.
+! FIXME: THIS FUNCTION IS DEPRECATED AND SHOULD BE REMOVED.
+! FIXME: THIS FUNCTION IS DEPRECATED AND SHOULD BE REMOVED.
+
!----------------------------------------------------------------------
! The file name can take one of three forms:
! /absolute/path/to/nirvana/obs_001/obs_seq.final (absolute path)
Modified: DART/trunk/utilities/utilities_mod.html
===================================================================
--- DART/trunk/utilities/utilities_mod.html 2014-08-04 16:49:26 UTC (rev 7098)
+++ DART/trunk/utilities/utilities_mod.html 2014-08-04 17:05:50 UTC (rev 7099)
@@ -184,6 +184,7 @@
<TR><TD> </TD><TD><A HREF="#file_to_text">file_to_text</A></TD></TR>
<TR><TD> </TD><TD><A HREF="#is_longitude_between">is_longitude_between</A></TD></TR>
<TR><TD> </TD><TD><A HREF="#get_next_filename">get_next_filename</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#set_filename_list">set_filename_list</A></TD></TR>
<TR><TD> </TD><TD><A HREF="#set_tasknum">set_tasknum</A></TD></TR>
<TR><TD> </TD><TD><A HREF="#set_output">set_output</A></TD></TR>
<TR><TD> </TD><TD><A HREF="#do_output">do_output</A></TD></TR>
@@ -703,6 +704,49 @@
<!--===================== DESCRIPTION OF A ROUTINE =====================-->
+<A NAME="set_filename_list"></A>
+<br>
+<div class=routine>
+<em class=call> var = set_filename_list( name_array, listname, caller_name ) </em>
+
+<pre>
+character(len=*), intent(inout) :: <em class=code>name_array</em>
+character(len=*), intent(in) :: <em class=code>listname</em>
+character(len=*), intent(in) :: <em class=code>caller_name</em>
+integer :: <em class=code>var</em>
+</pre>
+</div>
+
+<div class=indent1>
+<!-- Description -->
+
+<P>
+Returns the count of filenames specified.
+Verifies that one of either the name_array or the listname was specified but
+not both. If the input was a listname copy the names into the name_array
+so when this routine returns all the filenames are in name_array().
+Verifies that no more than the allowed number of names was specified if
+the input was a listname file.
+</P>
+
+<TABLE width=100% border=0 summary="" cellpadding=3>
+<TR><TD valign=top><em class=code>var </em></TD>
+ <TD>The count of input files specified.</TD></TR>
+<TR><TD valign=top><em class=code>name_array </em></TD>
+ <TD>Array of input filename strings. Either this item or the listname
+ must be specified, but not both.</TD></TR>
+<TR><TD valign=top><em class=code>listname </em></TD>
+ <TD>The filename to open and read filenames from, one per line.
+ Either this item or the name_array must be specified but not both.</TD></TR>
+<TR><TD valign=top><em class=code>caller_name</em></TD>
+ <TD>Calling subroutine name, used for error messages.</TD></TR>
+</TABLE>
+
+</div>
+<br>
+
+<!--===================== DESCRIPTION OF A ROUTINE =====================-->
+
<A NAME="to_upper"></A>
<br>
<div class=routine>
More information about the Dart-dev
mailing list