[Dart-dev] DART/branches Revision: 12315
dart at ucar.edu
dart at ucar.edu
Thu Jan 11 12:34:00 MST 2018
nancy at ucar.edu
2018-01-11 12:33:58 -0700 (Thu, 11 Jan 2018)
200
make this tool not coredump on identity obs;
make the namelist items a bit less flippant
and maybe less confusing. rework the documentation
to be clearer. unless there's a bug, i'm done
with these.
Modified: DART/branches/recam/assimilation_code/programs/obs_keep_a_few/obs_keep_a_few.f90
===================================================================
--- DART/branches/recam/assimilation_code/programs/obs_keep_a_few/obs_keep_a_few.f90 2018-01-11 19:15:33 UTC (rev 12314)
+++ DART/branches/recam/assimilation_code/programs/obs_keep_a_few/obs_keep_a_few.f90 2018-01-11 19:33:58 UTC (rev 12315)
@@ -58,7 +58,7 @@
logical :: is_this_last
integer :: size_seq_in, size_seq_out
integer :: num_copies_in, num_qc_in
-integer :: num_inserted, iunit, io, i, j
+integer :: num_inserted, iunit, io, j
integer :: max_num_obs, file_id
integer :: num_rejected_badqc, num_rejected_diffqc
integer :: num_rejected_other
@@ -82,19 +82,19 @@
! Namelist input with default values
-character(len=256) :: filename_in = ''
-character(len=256) :: filename_out = ''
+character(len=256) :: filename_in = ''
+character(len=256) :: filename_out = ''
-integer :: keep_N_of_each = 10
-integer :: max_all_obs_out = -1
+integer :: max_count_per_type = 10
+integer :: max_total_count = -1
-logical :: print_only = .false.
-character(len=32) :: calendar = 'Gregorian'
+logical :: print_only = .false.
+character(len=32) :: calendar = 'Gregorian'
namelist /obs_keep_a_few_nml/ &
filename_in, filename_out, &
- keep_N_of_each, max_all_obs_out, &
+ max_count_per_type, max_total_count, &
print_only, calendar
!----------------------------------------------------------------
@@ -127,8 +127,8 @@
! end of namelist processing and setup
-! make space for the counts
-allocate(n_this_type(get_num_types_of_obs()))
+! make space for the counts. 0 is for all identity obs.
+allocate(n_this_type(0:get_num_types_of_obs()))
n_this_type(:) = 0
! single pass algorithm (unlike other obs tools).
@@ -210,7 +210,9 @@
this_type = get_obs_def_type_of_obs(this_obs_def)
- if (n_this_type(this_type) < keep_N_of_each .or. keep_N_of_each < 0) then
+ if (this_type < 0) this_type = 0 ! identity obs
+
+ if (n_this_type(this_type) < max_count_per_type .or. max_count_per_type < 0) then
! copy to output obs_seq and increment the count for this type
n_this_type(this_type) = n_this_type(this_type) + 1
@@ -232,7 +234,7 @@
endif
- if (max_all_obs_out > 0 .and. num_inserted >= max_all_obs_out) exit ObsLoop
+ if (max_total_count > 0 .and. num_inserted >= max_total_count) exit ObsLoop
call get_next_obs(seq_in, obs_in, next_obs_in, is_this_last)
@@ -251,7 +253,6 @@
endif
-
write(msgstring, *) 'Starting to process output sequence file ', &
trim(filename_out)
call error_handler(E_MSG,'obs_keep_a_few',msgstring)
Modified: DART/branches/recam/assimilation_code/programs/obs_keep_a_few/obs_keep_a_few.html
===================================================================
--- DART/branches/recam/assimilation_code/programs/obs_keep_a_few/obs_keep_a_few.html 2018-01-11 19:15:33 UTC (rev 12314)
+++ DART/branches/recam/assimilation_code/programs/obs_keep_a_few/obs_keep_a_few.html 2018-01-11 19:33:58 UTC (rev 12315)
@@ -35,16 +35,42 @@
<H2>Overview</H2>
<P>
-This program allows you to create an output observations sequence file that is
-shorter than the input observation sequence file. Observations in an
-observation sequence file are always processed in time order, so this tool
-allows you to select the first N observations, in time sequence, of any type,
-or it allows you to select the first N observations of each different
-observation type. Set the limit values to -1 to disable them. If both
-the max count per type and max total count limits are given, the program
-quits when the first one of the limits is reached.
+This program creates an output observation sequence
+(obs_seq) file that is shorter than the input obs_seq file.
+There are two ways to restrict the number of observations
+copied to the output: the total number of observations
+regardless of observation type, or up to N observations of each type.
More information about the Dart-dev
mailing list