[Dart-dev] [4057] DART/trunk/diagnostics/threed_sphere: Make this program take either a single filename, or give it another file
nancy at ucar.edu
nancy at ucar.edu
Fri Sep 18 16:02:58 MDT 2009
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/dart-dev/attachments/20090918/c0481a04/attachment-0001.html
-------------- next part --------------
Modified: DART/trunk/diagnostics/threed_sphere/obs_seq_to_netcdf.f90
===================================================================
--- DART/trunk/diagnostics/threed_sphere/obs_seq_to_netcdf.f90 2009-09-18 21:47:45 UTC (rev 4056)
+++ DART/trunk/diagnostics/threed_sphere/obs_seq_to_netcdf.f90 2009-09-18 22:02:58 UTC (rev 4057)
@@ -1,3 +1,5 @@
+! Data Assimilation Research Testbed -- DART
+! Copyright 2004-2009, Data Assimilation Research Section
! University Corporation for Atmospheric Research
! Licensed under the GPL -- www.gpl.org/licenses/gpl.html
@@ -44,7 +46,8 @@
file_exist, error_handler, E_ERR, E_WARN, E_MSG, &
initialize_utilities, nmlfileunit, timestamp, &
find_namelist_in_file, check_namelist_read, nc_check, &
- next_file, find_textfile_dims, file_to_text
+ get_next_filename, find_textfile_dims, file_to_text, &
+ do_nml_file, do_nml_term
use typeSizes
use netcdf
@@ -95,14 +98,15 @@
!-----------------------------------------------------------------------
character(len = 129) :: obs_sequence_name = 'obs_seq.final'
+character(len = 129) :: obs_sequence_list = 'obs_seq_list'
real(r8) :: lonlim1= MISSING_R8, lonlim2= MISSING_R8
real(r8) :: latlim1= MISSING_R8, latlim2= MISSING_R8
logical :: verbose = .false.
-namelist /obs_seq_to_netcdf_nml/ obs_sequence_name, lonlim1, lonlim2, &
- latlim1, latlim2, verbose
+namelist /obs_seq_to_netcdf_nml/ obs_sequence_name, obs_sequence_list, &
+ lonlim1, lonlim2, latlim1, latlim2, verbose
!-----------------------------------------------------------------------
! Quantities of interest
@@ -182,9 +186,16 @@
call check_namelist_read(ncunit, io, 'obs_seq_to_netcdf_nml')
! Record the namelist values used for the run ...
-write(nmlfileunit, nml=obs_seq_to_netcdf_nml)
-write( * , nml=obs_seq_to_netcdf_nml)
+if (do_nml_file()) write(nmlfileunit, nml=obs_seq_to_netcdf_nml)
+if (do_nml_term()) write( * , nml=obs_seq_to_netcdf_nml)
+if ((obs_sequence_name /= '') .and. (obs_sequence_list /= '')) then
+ write(msgstring,*)'in namelist only one of obs filename or filelist can be given. set other to "" '
+ call error_handler(E_ERR, 'obs_seq_to_netcdf', msgstring, &
+ source, revision, revdate)
+endif
+
+
!----------------------------------------------------------------------
! SetSchedule rectifies user input and the final binning sequence.
!----------------------------------------------------------------------
@@ -224,8 +235,21 @@
! Try to build the next input filename ...
- obs_seq_in_file_name = next_file(obs_sequence_name,ifile)
+ ! original code:
+ !obs_seq_in_file_name = next_file(obs_sequence_name,ifile)
+ ! if you give a single explicit name, only go through loop once.
+ ! otherwise, you've given a list, so loop until the list is empty
+ ! (the routine returns '' when it gets to the list end).
+ obs_seq_in_file_name = ''
+ if (obs_sequence_name /= '') then
+ if (ifile == 1) obs_seq_in_file_name = obs_sequence_name
+ else
+ obs_seq_in_file_name = get_next_filename(obs_sequence_list,ifile)
+ endif
+
+ if (obs_seq_in_file_name == '') exit ObsFileLoop
+
if ( file_exist(trim(obs_seq_in_file_name)) ) then
write(msgstring,*)'opening ', trim(obs_seq_in_file_name)
call error_handler(E_MSG,'obs_seq_to_netcdf',msgstring,source,revision,revdate)
@@ -1286,3 +1310,4 @@
end program obs_seq_to_netcdf
+
Modified: DART/trunk/diagnostics/threed_sphere/obs_seq_to_netcdf.html
===================================================================
--- DART/trunk/diagnostics/threed_sphere/obs_seq_to_netcdf.html 2009-09-18 21:47:45 UTC (rev 4056)
+++ DART/trunk/diagnostics/threed_sphere/obs_seq_to_netcdf.html 2009-09-18 22:02:58 UTC (rev 4057)
@@ -92,8 +92,8 @@
<P>
Required namelist interfaces
- <A HREF="#Namelist1"><em class=code>&obs_seq_to_netcdf</em></A> and
- <A HREF="#Namelist2"><em class=code>&schedule_nml</em></A>
+ <A HREF="#Namelist1"><em class=code>&obs_seq_to_netcdf</em></A> and
+ <A HREF="#Namelist2"><em class=code>&schedule_nml</em></A>
are read from file <em class=file>input.nml</em>.
</P>
@@ -137,10 +137,11 @@
<BR><HR><BR>
<H2>NAMELIST</H2>
<P>We adhere to the F90 standard of starting a namelist with an
- ampersand '&' and terminating with a slash '/'.
+ ampersand '&' and terminating with a slash '/'.
<div class=namelist><pre>
- <em class=call>namelist / obs_seq_to_netcdf_nml / </em> &
- obs_sequence_name, lonlim1, lonlim2, latlim1, latlim2, verbose
+ <em class=call>namelist / obs_seq_to_netcdf_nml / </em>
+ obs_sequence_name, obs_sequence_list,
+ lonlim1, lonlim2, latlim1, latlim2, verbose
</pre></div>
</P>
@@ -161,21 +162,20 @@
<TR><!--contents--><TD valign=top> obs_sequence_name </TD>
<!-- type --><TD valign=top> character(len=129) </TD>
- <!--descript--><TD>Name of the observation sequence files. <BR>
- This may be a relative or absolute filename. If the filename
- contains a '/', the filename is considered to be comprised of
- everything to the right, and a directory structure to the left.
- The directory structure is then queried to see if it can be
- incremented to handle a sequence of observation files.
- The default behavior of <em class="program">obs_seq_to_netcdf</em>
- is to look for additional files to include until the files
- are exhausted or an <em class=file>obs_seq.final</em> file
- is found that contains observations beyond the timeframe of
- interest.<BR>e.g. 'obsdir_001/obs_seq.final' will cause
- <em class="program">obs_seq_to_netcdf</em> to look for
- 'obsdir_002/obs_seq.final', and so on.<BR>
+ <!--descript--><TD>Name of an observation sequence file.
+ If this is specified, only this single file will be read,
+ and 'obs_sequence_list' must be set to ''.
Default 'obs_seq.final'</TD></TR>
+<TR><!--contents--><TD valign=top> obs_sequence_list </TD>
+ <!-- type --><TD valign=top> character(len=129) </TD>
+ <!--descript--><TD>Name of an ascii text file which contains a list
+ of one or more observation sequence files, one per line.
+ If this is specified, 'obs_sequence_name' must be set to ''.
+ Can be created by any method, including sending the output
+ of the 'ls' command to a file, a text editor, or another program.
+ Default 'obs_seq_list'</TD></TR>
+
<TR><!--contents--><TD valign=top> lonlim1 </TD>
<!-- type --><TD valign=top> real </TD>
<!--descript--><TD>Westernmost longitude of the region.<BR>
@@ -214,8 +214,8 @@
<BR><HR><BR>
<H2>schedule NAMELIST</H2>
<P><div class=namelist><pre>
- <em class=call>namelist / schedule_nml / </em> &
- calendar, first_bin_start, first_bin_end, last_bin_end, &
+ <em class=call>namelist / schedule_nml / </em> &
+ calendar, first_bin_start, first_bin_end, last_bin_end, &
bin_interval_days, bin_interval_seconds, max_num_bins, print_table
</pre></div>
</P>
@@ -312,7 +312,7 @@
<br />
<div class="routine">
<pre>
-&schedule_nml
+&schedule_nml
calendar = 'Gregorian',
first_bin_start = 2006, 8, 1, 0, 0, 0 ,
first_bin_end = 2006, 8, 1, 6, 0, 0 ,
@@ -553,7 +553,7 @@
<H4 class="indent1">example</H4>
<div class="routine">
<pre>
-&schedule_nml
+&schedule_nml
calendar = 'Gregorian',
first_bin_start = 2006, 8, 1, 3, 0, 0 ,
first_bin_end = 2006, 8, 1, 9, 0, 0 ,
@@ -564,8 +564,9 @@
print_table = .true.
/
-&obs_seq_to_netcdf_nml
- obs_sequence_name = '/users/thoar/temp/obs_0001/obs_seq.final'
+&obs_seq_to_netcdf_nml
+ obs_sequence_name = '',
+ obs_sequence_list = 'olist',
lonlim1 = 0.0,
lonlim2 = 360.0,
latlim1 = -80.0,
@@ -573,6 +574,12 @@
verbose = .false.
/
</pre>
+
+> cat olist
+/users/thoar/temp/obs_0001/obs_seq.final
+/users/thoar/temp/obs_0002/obs_seq.final
+/users/thoar/temp/obs_0003/obs_seq.final
+
</div>
<br />
<br />
@@ -588,7 +595,7 @@
2009 5 15 9 0 23
Program obs_seq_to_netcdf
--------------------------------------
-
+
Requesting 8 assimilation periods.
epoch 1 start day=148135, sec=10801
Modified: DART/trunk/diagnostics/threed_sphere/obs_seq_to_netcdf.nml
===================================================================
--- DART/trunk/diagnostics/threed_sphere/obs_seq_to_netcdf.nml 2009-09-18 21:47:45 UTC (rev 4056)
+++ DART/trunk/diagnostics/threed_sphere/obs_seq_to_netcdf.nml 2009-09-18 22:02:58 UTC (rev 4057)
@@ -1,6 +1,8 @@
-
+# note that only one of name or list can be used, and the other
+# must be set to '' to avoid ambiguity.
&obs_to_table_nml
obs_sequence_name = 'obs_seq.final',
+ obs_sequence_list = 'obs_seq_list',
lonlim1 = 0.0,
lonlim2 = 360.0,
latlim1 = -90.0,
More information about the Dart-dev
mailing list