[Dart-dev] [7101] DART/trunk/obs_sequence: Increased the filename/ string lengths to 256.
nancy at ucar.edu
nancy at ucar.edu
Mon Aug 4 14:16:20 MDT 2014
Revision: 7101
Author: thoar
Date: 2014-08-04 14:16:19 -0600 (Mon, 04 Aug 2014)
Log Message:
-----------
Increased the filename/string lengths to 256.
Uses utilities_mod:set_filename_list() routine.
Now that it supports multiple input filenames, changed
the singular obs_sequence_name to something more appropriate.
Modified Paths:
--------------
DART/trunk/obs_sequence/obs_seq_coverage.f90
DART/trunk/obs_sequence/obs_seq_coverage.html
DART/trunk/obs_sequence/obs_seq_coverage.nml
-------------- next part --------------
Modified: DART/trunk/obs_sequence/obs_seq_coverage.f90
===================================================================
--- DART/trunk/obs_sequence/obs_seq_coverage.f90 2014-08-04 17:17:48 UTC (rev 7100)
+++ DART/trunk/obs_sequence/obs_seq_coverage.f90 2014-08-04 20:16:19 UTC (rev 7101)
@@ -55,7 +55,7 @@
file_exist, error_handler, E_ERR, E_WARN, E_MSG, &
initialize_utilities, nmlfileunit, finalize_utilities, &
find_namelist_in_file, check_namelist_read, nc_check, &
- next_file, get_next_filename, find_textfile_dims, &
+ next_file, set_filename_list, find_textfile_dims, &
file_to_text, do_nml_file, do_nml_term
use typeSizes
@@ -105,9 +105,6 @@
type(obs_def_type) :: obs_def
type(location_type) :: obs_loc, minl, maxl
-character(len = 129) :: obs_seq_in_file_name
-character(len = 129), allocatable, dimension(:) :: obs_seq_filenames
-
integer :: flavor, flavor_of_interest
integer :: num_copies, num_qc, num_obs, max_num_obs, obs_seq_file_id
@@ -115,16 +112,20 @@
logical :: pre_I_format
logical :: last_ob_flag
+character(len=256) :: obs_seq_in_file_name
+integer, parameter :: MAX_INPUT_FILES = 500
+integer :: num_input_files
+
!-----------------------------------------------------------------------
! Namelist with (some scalar) default values
!-----------------------------------------------------------------------
-character(len = 129) :: obs_sequence_list = 'obs_coverage_list.txt'
-character(len = 129) :: obs_sequence_name = ''
-character(len = obstypelength) :: obs_of_interest(MAX_OBS_NAMES_IN_NAMELIST) = ''
-character(len = 129) :: textfile_out = 'obsdef_mask.txt'
-character(len = 129) :: netcdf_out = 'obsdef_mask.nc'
-character(len = 129) :: calendar = 'Gregorian'
+character(len=256) :: obs_sequences(MAX_INPUT_FILES) = ''
+character(len=256) :: obs_sequence_list = ''
+character(len=256) :: textfile_out = 'obsdef_mask.txt'
+character(len=256) :: netcdf_out = 'obsdef_mask.nc'
+character(len=129) :: calendar = 'Gregorian'
+character(len=obstypelength) :: obs_of_interest(MAX_OBS_NAMES_IN_NAMELIST) = ''
integer, dimension(6) :: first_analysis = (/ 2003, 1, 1, 0, 0, 0 /)
integer, dimension(6) :: last_analysis = (/ 2003, 1, 2, 0, 0, 0 /)
@@ -139,8 +140,7 @@
logical :: verbose = .false.
logical :: debug = .false. ! undocumented ... on purpose
-
-namelist /obs_seq_coverage_nml/ obs_sequence_list, obs_sequence_name, &
+namelist /obs_seq_coverage_nml/ obs_sequences, obs_sequence_list, &
obs_of_interest, textfile_out, netcdf_out, calendar, &
first_analysis, last_analysis, forecast_length_days, &
forecast_length_seconds, verification_interval_seconds, &
@@ -156,7 +156,7 @@
type(time_type) :: obs_time, no_time, last_possible_time
-character(len = 129) :: ncName, string1, string2, string3
+character(len=256) :: ncName, string1, string2, string3
! ~# of degrees for 1/2 meter at Earth equator
! 360 deg-earth/(40000 km-earth * 1000m-km)
@@ -221,12 +221,7 @@
call error_handler(E_MSG, 'obs_seq_coverage', string1, source, revision, revdate)
endif
-if ((obs_sequence_name /= '') .and. (obs_sequence_list /= '')) then
- write(string1,*)'specify "obs_sequence_name" or "obs_sequence_list"'
- write(string2,*)'set other to an empty string ... i.e. ""'
- call error_handler(E_ERR, 'obs_seq_coverage', string1, source, revision, &
- revdate, text2=string2)
-endif
+num_input_files = set_filename_list(obs_sequences, obs_sequence_list,'obs_seq_coverage')
call set_calendar_type(calendar)
call get_calendar_string(calendar)
@@ -302,10 +297,7 @@
! Prepare the variables
!----------------------------------------------------------------------
-allocate(obs_seq_filenames(1000))
-obs_seq_filenames = 'null'
-
-ObsFileLoop : do ifile=1, size(obs_seq_filenames)
+ObsFileLoop : do ifile = 1, num_input_files
!-----------------------------------------------------------------------
! Because of the ability to 'cycle' the ObsFileLoop, we need to
@@ -319,14 +311,9 @@
if (allocated(qc_copy_names)) deallocate(qc_copy_names)
if (allocated(obs_copy_names)) deallocate(obs_copy_names)
- ! Determine the next input filename ...
+ ! Determine the next input filename and check for existence.
- if (obs_sequence_list == '') then
- obs_seq_in_file_name = next_file(obs_sequence_name,ifile)
- else
- obs_seq_in_file_name = get_next_filename(obs_sequence_list,ifile)
- if (obs_seq_in_file_name == '') exit ObsFileLoop
- endif
+ obs_seq_in_file_name = obs_sequences(ifile)
if ( file_exist(trim(obs_seq_in_file_name)) ) then
write(string1,*)'opening ', trim(obs_seq_in_file_name)
@@ -342,9 +329,6 @@
! Read in information about observation sequence so we can allocate
! observations. We need info about how many copies, qc values, etc.
- obs_seq_in_file_name = trim(obs_seq_in_file_name) ! Lahey requirement
- obs_seq_filenames(ifile) = trim(obs_seq_in_file_name)
-
call read_obs_seq_header(obs_seq_in_file_name, &
num_copies, num_qc, num_obs, max_num_obs, &
obs_seq_file_id, obs_seq_read_format, pre_I_format, &
@@ -471,7 +455,7 @@
write(*,*) ! whitespace
endif
- if (obs_time > last_possible_time) exit ObsFileLoop
+ if (obs_time > last_possible_time) exit ObservationLoop
!-----------------------------------------------------------------
! * reject if dart_qc exists and QC is undesirable
@@ -576,7 +560,6 @@
if (allocated(obs_copy_names)) deallocate(obs_copy_names)
if (allocated(module_obs_copy_names)) deallocate(module_obs_copy_names)
if (allocated(module_qc_copy_names )) deallocate(module_qc_copy_names )
-if (allocated(obs_seq_filenames)) deallocate(obs_seq_filenames)
if (allocated(Desiredvoxels)) deallocate(Desiredvoxels)
call error_handler(E_MSG,'obs_seq_coverage','Finished successfully.',source,revision,revdate)
@@ -842,7 +825,7 @@
character(len=*), intent(in) :: fname
integer :: InitNetCDF
-integer :: ncid, i, indx1, nlines, linelen
+integer :: ncid, i, nlines, linelen
integer :: LineLenDimID, nlinesDimID, stringDimID
integer :: TimeDimID, voxelsDimID, FcstDimID, VerifyDimID
integer :: VarID, FcstVarID, VerifVarID, ExperimentVarID
@@ -853,7 +836,7 @@
character(len=5) :: crzone ! needed by F90 DATE_AND_TIME intrinsic
integer, dimension(8) :: values ! needed by F90 DATE_AND_TIME intrinsic
-character(len=129), allocatable, dimension(:) :: textblock
+character(len=256), allocatable, dimension(:) :: textblock
real(digits12), allocatable, dimension(:) :: mytimes
integer, allocatable, dimension(:) :: forecast_length
@@ -916,15 +899,11 @@
enddo TYPELOOP
! write all observation sequence files used
-FILEloop : do i = 1,SIZE(obs_seq_filenames)
+FILEloop : do i = 1,num_input_files
- indx1 = index(obs_seq_filenames(i),'null')
-
- if (indx1 > 0) exit FILEloop
-
write(string1,'(''obs_seq_file_'',i3.3)')i
call nc_check(nf90_put_att(ncid, NF90_GLOBAL, &
- trim(string1), trim(obs_seq_filenames(i)) ), &
+ trim(string1), trim(obs_sequences(i)) ), &
'InitNetCDF', 'put_att:filenames')
enddo FILEloop
Modified: DART/trunk/obs_sequence/obs_seq_coverage.html
===================================================================
--- DART/trunk/obs_sequence/obs_seq_coverage.html 2014-08-04 17:17:48 UTC (rev 7100)
+++ DART/trunk/obs_sequence/obs_seq_coverage.html 2014-08-04 20:16:19 UTC (rev 7101)
@@ -186,8 +186,8 @@
<div class=namelist>
<pre>
&obs_seq_coverage_nml
+ obs_sequences = ''
obs_sequence_list = 'obs_coverage_list.txt'
- obs_sequence_name = ''
obs_of_interest = ''
textfile_out = 'obsdef_mask.txt'
netcdf_out = 'obsdef_mask.nc'
@@ -221,7 +221,7 @@
The allowable ranges for the region boundaries are: latitude [-90.,90],
longitude [0.,Inf.]
</P> <P>
-You can specify <strong>either</strong> <em class=option>obs_sequence_name</em>
+You can specify <strong>either</strong> <em class=option>obs_sequences</em>
<strong>or</strong> <em class=option>obs_sequence_list</em> -- not both.
One of them has to be an empty string ... i.e. <em class=option>''</em>.
</P>
@@ -236,8 +236,8 @@
<TBODY valign=top>
-<TR><TD> obs_sequence_name </TD>
- <TD> character(len=129) </TD>
+<TR><TD> obs_sequences </TD>
+ <TD> character(len=256) </TD>
<TD>Name of the observation sequence file(s). <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
@@ -253,10 +253,10 @@
</TD></TR>
<TR><TD> obs_sequence_list </TD>
- <TD> character(len=129) </TD>
+ <TD> character(len=256) </TD>
<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, <em class=option>obs_sequence_name</em> must be set to ' '.
+specified, <em class=option>obs_sequences</em> 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.
</TD></TR>
@@ -271,7 +271,7 @@
</TD></TR>
<TR><TD> textfile_out </TD>
- <TD> character(len=129) </TD>
+ <TD> character(len=256) </TD>
<TD>The name of the file that will contain the observation
definitions of the verfication observations. Only the metadata from the
observations (location, time, obs_type) are preserved in this file. They are
@@ -281,7 +281,7 @@
</TD></TR>
<TR><TD> netcdf_out </TD>
- <TD> character(len=129) </TD>
+ <TD> character(len=256) </TD>
<TD>The name of the file that will contain the observation
definitions of the unique locations that match <strong>any</strong> of the
verification times. This file is used in conjunction with
@@ -382,8 +382,8 @@
<P>For example:
<pre>
&obs_seq_coverage_nml
+ obs_sequences = ''
obs_sequence_list = 'obs_coverage_list.txt'
- obs_sequence_name = ''
obs_of_interest = 'METAR_U_10_METER_WIND',
'METAR_V_10_METER_WIND'
textfile_out = 'obsdef_mask.txt'
@@ -500,7 +500,7 @@
<div class=routine>
<pre>
&obs_seq_coverage_nml
- obs_sequence_name = ''
+ obs_sequences = ''
obs_sequence_list = <em class=input>'obs_file_list.txt'</em>
obs_of_interest = <em class=input>'METAR_U_10_METER_WIND'</em>,
<em class=input>'METAR_V_10_METER_WIND'</em>
@@ -644,7 +644,7 @@
analysisT = 1 ;
forecast_lead = 9 ;
nlevels = 14 ;
- linelen = 129 ;
+ linelen = 256 ;
nlines = 446 ;
stringlength = 32 ;
location = 3 ;
@@ -787,7 +787,7 @@
be present for all forecasts</TD></TR>
<TR><!-- routine --><TD VALIGN=top>obs_seq_coverage</TD>
- <!-- message --><TD VALIGN=top>'specify "obs_sequence_name" or
+ <!-- message --><TD VALIGN=top>'specify "obs_sequences" or
"obs_sequence_list"'</TD>
<!-- comment --><TD VALIGN=top>one of these namelist variables MUST
be an empty string</TD></TR>
Modified: DART/trunk/obs_sequence/obs_seq_coverage.nml
===================================================================
--- DART/trunk/obs_sequence/obs_seq_coverage.nml 2014-08-04 17:17:48 UTC (rev 7100)
+++ DART/trunk/obs_sequence/obs_seq_coverage.nml 2014-08-04 20:16:19 UTC (rev 7101)
@@ -11,8 +11,8 @@
# 21600 secs == 6 hours
&obs_seq_coverage_nml
+ obs_sequences = ''
obs_sequence_list = 'obs_coverage_list.txt'
- obs_sequence_name = ''
obs_of_interest = ''
textfile_out = 'obsdef_mask.txt'
netcdf_out = 'obsdef_mask.nc'
More information about the Dart-dev
mailing list