[Dart-dev] [4892] DART/trunk/obs_sequence: Change the namelist to specify 'calendar' as a string, not just

nancy at ucar.edu nancy at ucar.edu
Wed May 4 14:14:03 MDT 2011


Revision: 4892
Author:   nancy
Date:     2011-05-04 14:14:03 -0600 (Wed, 04 May 2011)
Log Message:
-----------
Change the namelist to specify 'calendar' as a string, not just
a boolean for 'gregorian_cal'.  This brings this tool in line with others
for how to specify the calendar.  Also remove some unused variables to
get rid of warnings.  No functional changes.

Fix up the documentation to remove leftover sections and debris from 
the original it was copied from. 

Modified Paths:
--------------
    DART/trunk/obs_sequence/obs_selection.f90
    DART/trunk/obs_sequence/obs_selection.html
    DART/trunk/obs_sequence/obs_selection.nml

-------------- next part --------------
Modified: DART/trunk/obs_sequence/obs_selection.f90
===================================================================
--- DART/trunk/obs_sequence/obs_selection.f90	2011-05-04 19:54:22 UTC (rev 4891)
+++ DART/trunk/obs_sequence/obs_selection.f90	2011-05-04 20:14:03 UTC (rev 4892)
@@ -27,7 +27,7 @@
                              read_obs_kind
 use time_manager_mod, only : time_type, operator(>), print_time, set_time, &
                              print_date, set_calendar_type, GREGORIAN,     &
-                             operator(/=)
+                             operator(/=), NO_CALENDAR, get_calendar_type
 use obs_sequence_mod, only : obs_sequence_type, obs_type, write_obs_seq, &
                              init_obs, assignment(=), get_obs_def, &
                              init_obs_sequence, static_init_obs_sequence, &
@@ -58,11 +58,10 @@
 integer                 :: size_seq_in, num_copies_in, num_qc_in
 integer                 :: size_seq_out, num_copies_out, num_qc_out
 integer                 :: num_inserted, iunit, io, i, j, total_num_inserted
-integer                 :: max_num_obs, file_id, remaining_obs_count
+integer                 :: max_num_obs, file_id
 integer                 :: first_seq
 character(len = 129)    :: read_format, meta_data
-logical                 :: pre_I_format, all_gone
-logical                 :: trim_first, trim_last
+logical                 :: pre_I_format, cal
 character(len = 129)    :: msgstring
 
 ! could go into namelist if you wanted more control
@@ -75,9 +74,7 @@
 ! lazy, pick big numbers.  make them bigger if too small.
 integer, parameter               :: max_num_input_files = 1000
 integer, parameter               :: max_obs_input_types = 500
-character(len = obstypelength)   :: obs_types(max_obs_input_types) = ''
 integer                          :: num_input_files = 0
-integer                          :: num_obs_input_types
 type(obs_def_type),  allocatable :: obs_def_list(:)
 integer                          :: obs_def_count
 
@@ -91,12 +88,12 @@
 
 logical  :: selections_is_obs_seq = .false.
 logical  :: print_only            = .false.
-logical  :: gregorian_cal         = .true.
+character(len=32) :: calendar     = 'Gregorian'
 
 
 namelist /obs_selection_nml/ &
          num_input_files, filename_seq, filename_seq_list, filename_out, &
-         selections_file, selections_is_obs_seq, print_only, gregorian_cal
+         selections_file, selections_is_obs_seq, print_only, calendar
 
 !----------------------------------------------------------------
 ! Start of the program:
@@ -130,11 +127,10 @@
 
 call handle_filenames(filename_seq, filename_seq_list, num_input_files)
 
-! if you are not using a gregorian cal, set this to false in the namelist.
-! if users need it, we could add a calendar type integer to the namelist,
-! if users want to specify a particular calendar which is not gregorian.
-! (earlier versions of this file had the test before the namelist read - duh.)
-if (gregorian_cal) call set_calendar_type(GREGORIAN)
+! set the calendar type, and set a flag to say whether it is something
+! other than no_calendar.  note that cal is set as a logical.
+call set_calendar_type(calendar)
+cal = (get_calendar_type() /= NO_CALENDAR)
 
 call read_selection_list(selections_file, selections_is_obs_seq, obs_def_list, obs_def_count)
 
@@ -490,8 +486,7 @@
 
 integer :: num_copies1, num_qc1
 integer :: num_copies2, num_qc2
-integer :: num_copies , num_qc, i, j
-logical :: have_match1, have_match2
+integer :: num_copies , num_qc, i
 character(len=129) :: str1, str2
 character(len=255) :: msgstring1, msgstring2
 
@@ -642,10 +637,8 @@
 is_this_last = .false.
 
 call get_obs_def(obs, this_obs_def)
-call print_time(get_obs_def_time(this_obs_def), ' First timestamp: ')
-if (gregorian_cal) then
-   call print_date(get_obs_def_time(this_obs_def), '   Gregorian day: ')
-endif
+         call print_time(get_obs_def_time(this_obs_def), ' First timestamp: ')
+if (cal) call print_date(get_obs_def_time(this_obs_def), '   which is date: ')
 
 ObsLoop : do while ( .not. is_this_last)
 
@@ -663,10 +656,8 @@
    if (.not. is_this_last) then 
       obs = next_obs
    else
-      call print_time(get_obs_def_time(this_obs_def), '  Last timestamp: ')
-      if (gregorian_cal) then
-         call print_date(get_obs_def_time(this_obs_def), '   Gregorian day: ')
-      endif
+               call print_time(get_obs_def_time(this_obs_def), '  Last timestamp: ')
+      if (cal) call print_date(get_obs_def_time(this_obs_def), '   which is date: ')
    endif
 
 enddo ObsLoop
@@ -756,10 +747,10 @@
 
    if (last_time > this_time) then
       ! bad time order of observations in linked list
-      call print_time(last_time, ' previous timestamp: ')
-      if (gregorian_cal) call print_date(last_time, '   Gregorian day: ')
-      call print_time(this_time, ' next timestamp: ')
-      if (gregorian_cal) call print_date(this_time, '   Gregorian day: ')
+               call print_time(last_time, ' previous timestamp: ')
+      if (cal) call print_date(last_time, '      which is date: ')
+               call print_time(this_time, '     next timestamp: ')
+      if (cal) call print_date(this_time, '      which is date: ')
 
       key = get_obs_key(obs)
       write(msgstring,*)'obs number ', key, ' has earlier time than previous obs'

Modified: DART/trunk/obs_sequence/obs_selection.html
===================================================================
--- DART/trunk/obs_sequence/obs_selection.html	2011-05-04 19:54:22 UTC (rev 4891)
+++ DART/trunk/obs_sequence/obs_selection.html	2011-05-04 20:14:03 UTC (rev 4892)
@@ -26,10 +26,7 @@
 </table>
 
 <A HREF="#Namelist">NAMELIST</A> /
-<A HREF="#Examples">EXAMPLES</A> /
 <A HREF="#Building">BUILDING</A> /
-<A HREF="#Discussion">DISCUSSION</A> /
-<A HREF="#FAQ">FAQ</A> /
 <A HREF="#FilesUsed">FILES</A> /
 <A HREF="#References">REFERENCES</A> /
 <A HREF="#Errors">ERRORS</A> /
@@ -41,9 +38,9 @@
 <P>
 This specialized tool selects out a subset of the input observations.
 For a more general purpose tool, see the 
-<a href="obs_sequence_tool.hmtl>obs_sequence_tool</a>.
+<a href="obs_sequence_tool.hmtl">obs_sequence_tool</a>.
 The tool which creates the input selection file is
-<a href="obs_seq_coverage.hmtl>obs_seq_coverage</a>.
+<a href="obs_seq_coverage.hmtl">obs_seq_coverage</a>.
 This tool takes a selected list of observation
 types, times, and locations, and extracts only the matching
 observations out of a longer set of obs_sequence files.
@@ -57,12 +54,6 @@
 The names used in this discussion refer to these namelist items.
 </P>
 
-<P>
-The following section contains examples of common usages for this tool.
-Below that are more details about DART observation sequence files, the
-structure of individual observations, and general background information.
-</P>
-
 <!--==================================================================-->
 <!--=================== DESCRIPTION OF A NAMELIST ====================-->
 <!--==================================================================-->
@@ -77,7 +68,7 @@
 <pre>
 <em class=call>namelist / obs_selection_nml / </em> 
         filename_seq, filename_seq_list, num_input_files, filename_out,
-        selection_file, print_only, gregorian_cal
+        selection_file, print_only, calendar
 </pre>
 </div>
 
@@ -92,26 +83,27 @@
 <TR><TH align=left>Contents    </TH>
     <TH align=left>Type        </TH>
     <TH align=left>Description </TH></TR>
-<TR><!--contents--><TD valign=top>num_input_files</TD>
-    <!--  type  --><TD>integer</TD>
-    <!--descript--><TD>The number of observation sequence files to process.
-                       Maximum of 500.  If left 0, the length is set by the
-                       number of input files given.  If non-zero, must match
-                       the given input file list length.
-                       Default: 0</TD></TR>
 <TR><!--contents--><TD valign=top>filename_seq</TD>
     <!--  type  --><TD>character(len=129), dimension(500)</TD>
-    <!--descript--><TD>The array of names of the observation sequence files to process.
-                       With the F90 namelist mechanism, it is only necessary
-                       to specify the names you are going to use, not all.
+    <!--descript--><TD>The array of names of the observation sequence files to process, 
+                       up to a max count of 500 files. (Specify only the actual number of
+                       input files.  It is not necessary to specify 500 entries.)
                        Default: ''</TD></TR>
 <TR><!--contents--><TD valign=top>filename_seq_list</TD>
     <!--  type  --><TD>character(len=129)</TD>
-    <!--descript--><TD>The name of a text file which contains, one per line,
+    <!--descript--><TD>An alternative way to specify the list of input files.
+                       The name of a text file which contains, one per line,
                        the names of the observation sequence files to process.
                        You can only specify one of filename_seq OR 
                        filename_seq_list, not both.
                        Default: ''</TD></TR>
+<TR><!--contents--><TD valign=top>num_input_files</TD>
+    <!--  type  --><TD>integer</TD>
+    <!--descript--><TD>Optional.  The number of observation sequence files to process.
+                       Maximum of 500.  If left 0, the length is set by the
+                       number of input files given.  If non-zero, must match
+                       the given input file list length.
+                       Default: 0</TD></TR>
 <TR><!--contents--><TD valign=top>filename_out</TD>
     <!--  type  --><TD>character(len=129)</TD>
     <!--descript--><TD>The name of the resulting output observation sequence file.
@@ -123,189 +115,18 @@
                        Default: 'obsdef_mask.txt'</TD></TR>
 <TR><!--contents--><TD valign=top>print_only</TD>
     <!--  type  --><TD>logical</TD>
-    <!--descript--><TD>If .TRUE., do not create an output file, but print a summary of the
+    <!--descript--><TD>If .TRUE. do not create an output file, but print a summary of the
                        number and types of each observation in each input file, and then
                        the number of observations and types which would have been created in
-                       an output file.  If other namelist selections are specified (e.g. start
-                       and end times, select by observation type, qc value, etc) the summary
-                       message will include the results of that processing.
+                       an output file.
                        Default: .false.</TD></TR>
-<TR><!--contents--><TD valign=top>first_obs_days</TD>
-    <!--  type  --><TD>integer</TD>
-    <!--descript--><TD>If non-negative, restrict the timestamps of the observations
-                       copied to the output file to be equal to or after this day number
-                       (specified in the Gregorian calendar; day number since 1600).
-                       Default: -1, process all observations</TD></TR>
-<TR><!--contents--><TD valign=top>first_obs_seconds</TD>
-    <!--  type  --><TD>integer</TD>
-    <!--descript--><TD>If non-negative, restrict the timestamps of the observations
-                       copied to the output file to be equal to or after this time.
-                       Default: -1, process all observations</TD></TR>
-<TR><!--contents--><TD valign=top>last_obs_days</TD>
-    <!--  type  --><TD>integer</TD>
-    <!--descript--><TD>If non-negative, restrict the timestamps of the observations
-                       copied to the output file to be equal to or before this date
-                       (specified in the Gregorian calendar; day number since 1600).
-                       Default: -1, process all observations</TD></TR>
-<TR><!--contents--><TD valign=top>last_obs_seconds</TD>
-    <!--  type  --><TD>integer</TD>
-    <!--descript--><TD>If non-negative, restrict the timestamps of the observations
-                       copied to the output file to be equal to or before this time.
-                       Default: -1, process all observations</TD></TR>
-<TR><!--contents--><TD valign=top>obs_types</TD>
-    <!--  type  --><TD>character(len=32), dimension(500)</TD>
-    <!--descript--><TD>The array of observation type names to process.  If any names
-                       specified, then based on the setting of <em class=code>keep_types</em>,
-                       these observation types will either be the only types kept in the
-                       output file, or they will be removed and all other types will be copied
-                       to the output file.
-                       Default: empty list </TD></TR>
-<TR><!--contents--><TD valign=top>keep_types</TD>
-    <!--  type  --><TD>logical</TD>
-    <!--descript--><TD>Ignored unless one or more observation types are specified in the
-                       <em class=code>obs_types</em> namelist.  If .TRUE., only the specified
-                       observation types will be copied to the output file; if .FALSE., all
-                       types except the listed ones will be copied to the output file.
-                       Default: .true.</TD></TR>
-<TR><!--contents--><TD valign=top>min_lat</TD>
-    <!--  type  --><TD>real(r8)</TD>
-    <!--descript--><TD>If specified, the minimum latitude, in degrees, of observations
-                       to be copied to the output file.  This assumes compiling with 
-                       the 3d-sphere locations module.
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>max_lat</TD>
-    <!--  type  --><TD>real(r8)</TD>
-    <!--descript--><TD>If specified, the maximum latitude, in degrees, of observations
-                       to be copied to the output file.  This assumes compiling with 
-                       the 3d-sphere locations module.
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>min_lon</TD>
-    <!--  type  --><TD>real(r8)</TD>
-    <!--descript--><TD>If specified, the minimum longitude, in degrees, of observations
-                       to be copied to the output file.  This assumes compiling with 
-                       the 3d-sphere locations module.  If min_lon is more than max_lon,
-                       wrap across 360 to 0 is assumed.
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>max_lon</TD>
-    <!--  type  --><TD>real(r8)</TD>
-    <!--descript--><TD>If specified, the maximum longitude, in degrees, of observations
-                       to be copied to the output file.  This assumes compiling with 
-                       the 3d-sphere locations module.  If min_lon is more than max_lon,
-                       wrap across 360 to 0 is assumed.
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>min_box</TD>
-    <!--  type  --><TD>real(r8)(:)</TD>
-    <!--descript--><TD>If the locations are 1D, set a min value here instead of using
-                       the lat/lon box values.
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>max_box</TD>
-    <!--  type  --><TD>real(r8)(:)</TD>
-    <!--descript--><TD>If the locations are 1D, set a max value here instead of using
-                       the lat/lon box values.
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>qc_metadata</TD>
-    <!--  type  --><TD>character</TD>
-    <!--descript--><TD>If specified, the metadata string describing one of the quality
-                       control (QC) fields in the input observation sequence files.
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>min_qc</TD>
-    <!--  type  --><TD>real</TD>
-    <!--descript--><TD>If specified, the minimum qc value in the QC field matching the
-                       qc_metadata name that will be copied to the output file. 
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>max_qc</TD>
-    <!--  type  --><TD>real</TD>
-    <!--descript--><TD>If specified, the maximum qc value in the QC field matching the
-                       qc_metadata name that will be copied to the output file. 
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>copy_type</TD>
+<TR><!--contents--><TD valign=top>calendar</TD>
     <!--  type  --><TD>character(len=32)</TD>
-    <!--descript--><TD>If specified, the string name of an observation type to be copied
-                       to the output file only if the min and max values specified are in range.
-                       All other observation types are discarded if this option is specified.
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>copy_metadata</TD>
-    <!--  type  --><TD>character</TD>
-    <!--descript--><TD>If specified, the metadata string describing one of the data
-                       copy fields in the input observation sequence files.
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>min_copy</TD>
-    <!--  type  --><TD>real</TD>
-    <!--descript--><TD>If specified, the minimum value in the data copy field matching the
-                       copy_metadata name that will be copied to the output file. 
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>max_copy</TD>
-    <!--  type  --><TD>real</TD>
-    <!--descript--><TD>If specified, the maximum value in the data copy field matching the
-                       copy_metadata name that will be copied to the output file. 
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>gregorian_cal</TD>
-    <!--  type  --><TD>logical</TD>
-    <!--descript--><TD>If .TRUE., the dates of the first and last observations in each file
-                       will be printed in both (day/seconds) format and in gregorian calendar
-                       year/month/day hour:min:sec format.  Set this to .false. if the observations
-                       were not created with gregorian calendar times.
-                       Default: .TRUE.</TD></TR>
-<TR><!--contents--><TD valign=top>edit_copy_metadata</TD>
-    <!--  type  --><TD>logical</TD>
-    <!--descript--><TD>If true, replace the output file metadata strings with the list
-                       specified in the new_copy_metadata list.
-                       Default: .false.</TD></TR>
-<TR><!--contents--><TD valign=top>new_copy_metadata</TD>
-    <!--  type  --><TD>character(len=*)(:)</TD>
-    <!--descript--><TD>List of new metadata strings.  Use with care, there is no error checking
-                       to ensure you are doing a valid replacement.
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>edit_copies</TD>
-    <!--  type  --><TD>logical</TD>
-    <!--descript--><TD>If true, subset or rearrange the actual data copies in the output.
-                       The new_copy_index list controls the output order of copies from the
-                       input files.
-                       Default: .false.</TD></TR>
-<TR><!--contents--><TD valign=top>new_copy_index</TD>
-    <!--  type  --><TD>integer(:)</TD>
-    <!--descript--><TD>An array of integers, which control how copies in the input are
-                       moved to the output sequence.
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>edit_qc_metadata</TD>
-    <!--  type  --><TD>logical</TD>
-    <!--descript--><TD>If true, replace the output file metadata strings with the list
-                       specified in the new_qc_metadata list.
-                       Default: .false.</TD></TR>
-<TR><!--contents--><TD valign=top>new_qc_metadata</TD>
-    <!--  type  --><TD>character(len=*)(:)</TD>
-    <!--descript--><TD>List of new metadata strings.  Use with care, there is no error checking
-                       to ensure you are doing a valid replacement.
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>edit_qcs</TD>
-    <!--  type  --><TD>logical</TD>
-    <!--descript--><TD>If true, subset or rearrange the actual data qcs in the output.
-                       The new_qc_index list controls the output order of qcs from the
-                       input files.
-                       Default: .false.</TD></TR>
-<TR><!--contents--><TD valign=top>new_qc_index</TD>
-    <!--  type  --><TD>integer(:)</TD>
-    <!--descript--><TD>An array of integers, which control how qcs in the input are
-                       moved to the output sequence.
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>synonym_copy_list</TD>
-    <!--  type  --><TD>character(len=*)(:)</TD>
-    <!--descript--><TD>An array of strings which are to be considered synonyms in the copy
-                       metadata strings for all the input obs seq files.
-                       Any string in this list
-                       will match any other string.  The first obs sequence file to copy
-                       observations to the output file will set the actual values used,
-                       unless they are explicitly overridden by edit_copy_metadata.
-                       Default: none</TD></TR>
-<TR><!--contents--><TD valign=top>synonym_qc_list</TD>
-    <!--  type  --><TD>character(len=*)(:)</TD>
-    <!--descript--><TD>An array of strings which are to be considered synonyms in the qc
-                       metadata strings for all the input obs seq files.
-                       Any string in this list
-                       will match any other string.  The first obs sequence file to qc
-                       observations to the output file will set the actual values used,
-                       unless they are explicitly overridden by edit_qc_metadata.
-                       Default: none</TD></TR>
+    <!--descript--><TD>Set to the name of the calendar; only controls the
+         printed output for the dates of the first and last observations in 
+         the file.  Set this to "no_calendar" if the 
+         observations are not using any calendar.
+                       Default "gregorian".</TD></TR>
 </TABLE>
 
 </div>
@@ -313,35 +134,6 @@
 
 <!--==================================================================-->
 
-<A NAME="Examples"></A>
-<HR>
-<H2>EXAMPLES</H2>
-
-FIXME!!
-
-<A NAME="keepval"></A>
-<h3>Subset by Observation or QC Value</h3>
-<P>
-You can specify a min, max data value and/or min, max qc value,
-and only those within the range will be kept.  There is no exclude option.
-For the data value, you must also specify an observation type since
-different types have different units and valid ranges.  For example:
-</P>
-<pre>
-# keep only observations with a DART QC of 0:
-   qc_metadata        = 'Dart quality control',
-   min_qc             = 0,
-   max_qc             = 0,
-
-# keep only radiosonde temp obs between 250 and 300 K:
-   copy_metadata      = 'NCEP BUFR observation',
-   copy_type          = 'RADIOSONDE_TEMPERATURE',
-   min_copy           = 250.0,
-   max_copy           = 300.0,
-</pre>
-
-<!--==================================================================-->
-
 <A NAME="Building"></A>
 <HR>
 <H2>BUILDING</H2>
@@ -361,7 +153,13 @@
 the <tt>oned</tt> module should be used; for real-world observations,
 the <tt>threed_sphere</tt> module should be used.
 </P>
+<P>Generally the directories where executables are built will include
+a "quickbuild.csh" script which will build and run preprocess and then
+build the rest of the executables.  The "input.nml" namelists will need
+to be edited to include all the required observation types first.
+</P>
 
+
 <!--==================================================================-->
 
 <A NAME="OtherModulesUsed"></A>

Modified: DART/trunk/obs_sequence/obs_selection.nml
===================================================================
--- DART/trunk/obs_sequence/obs_selection.nml	2011-05-04 19:54:22 UTC (rev 4891)
+++ DART/trunk/obs_sequence/obs_selection.nml	2011-05-04 20:14:03 UTC (rev 4892)
@@ -9,5 +9,5 @@
    selections_file       = 'obsdef_mask.txt', 
    selections_is_obs_seq = .false.,
    print_only            = .false., 
-   gregorian_cal         = .true.,
+   calendar              = "Gregorian",
 /


More information about the Dart-dev mailing list