[Dart-dev] DART/branches Revision: 12312

dart at ucar.edu dart at ucar.edu
Thu Jan 11 11:48:07 MST 2018


nancy at ucar.edu
2018-01-11 11:48:04 -0700 (Thu, 11 Jan 2018)
203
added another option to limit the total obs count
to some number regardless of type.  either can
be disabled by setting them to -1.

also (hope you're sitting down for this) added
a documentation page.




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 16:56:58 UTC (rev 12311)
+++ DART/branches/recam/assimilation_code/programs/obs_keep_a_few/obs_keep_a_few.f90	2018-01-11 18:48:04 UTC (rev 12312)
@@ -85,7 +85,8 @@
 character(len=256)   :: filename_in = ''
 character(len=256)   :: filename_out = ''
 
-integer              :: keep_N_of_each = 10
+integer              :: keep_N_of_each  = 10
+integer              :: max_all_obs_out = -1
 
 logical              :: print_only    = .false.
 character(len=32)    :: calendar      = 'Gregorian'
@@ -93,7 +94,7 @@
 
 namelist /obs_keep_a_few_nml/ &
          filename_in, filename_out, &
-         keep_N_of_each, &
+         keep_N_of_each, max_all_obs_out, &
          print_only, calendar
 
 !----------------------------------------------------------------
@@ -209,33 +210,30 @@
 
       this_type = get_obs_def_type_of_obs(this_obs_def)
 
-      if (n_this_type(this_type) >= keep_N_of_each) goto 100
+      if (n_this_type(this_type) < keep_N_of_each .or. keep_N_of_each < 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
+         ! copy to output obs_seq and increment the count for this type
+         n_this_type(this_type) = n_this_type(this_type) + 1
+   
+         if (num_inserted > 0) then
+            call insert_obs_in_seq(seq_out, obs_out, prev_obs_out)
+         else
+            call insert_obs_in_seq(seq_out, obs_out)
+         endif
+   
+         prev_obs_out = obs_out  ! update position in seq for next insert
+         num_inserted = num_inserted + 1
+   
+         if (print_every > 0) then
+            if (mod(num_inserted,print_every) == 0) then
+               print*, 'inserted number ',num_inserted,' of ',size_seq_out
+            endif
+         endif
 
-      ! Since the stride through the observation sequence file is always
-      ! guaranteed to be in temporally-ascending order, we can use the
-      ! 'previous' observation as the starting point to search for the
-      ! correct insertion point.  This speeds up the insert code a lot.
-
-      if (num_inserted > 0) then
-         call insert_obs_in_seq(seq_out, obs_out, prev_obs_out)
-      else
-         call insert_obs_in_seq(seq_out, obs_out)
       endif
 
-      prev_obs_out = obs_out  ! update position in seq for next insert
-      num_inserted = num_inserted + 1
+      if (max_all_obs_out > 0 .and. num_inserted >= max_all_obs_out) exit ObsLoop
 
-      if (print_every > 0) then
-         if (mod(num_inserted,print_every) == 0) then
-            print*, 'inserted number ',num_inserted,' of ',size_seq_out
-         endif
-      endif
-
-100 continue
-
       call get_next_obs(seq_in, obs_in, next_obs_in, is_this_last)
 
    enddo ObsLoop

Added: 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	                        (rev 0)
+++ DART/branches/recam/assimilation_code/programs/obs_keep_a_few/obs_keep_a_few.html	2018-01-11 18:48:04 UTC (rev 12312)
@@ -0,0 +1,237 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+          "http://www.w3.org/TR/html4/strict.dtd">
+<HTML>
+<HEAD>
+<TITLE>program obs_keep_a_few</TITLE>
+<link rel="stylesheet" type="text/css" href="../../../documentation/html/doc.css" />
+<link href="../../../documentation/images/dart.ico" rel="shortcut icon" />
+</HEAD>
+<BODY>
+<A NAME="TOP"></A>
+
+<H1>program <em class=program>obs_keep_a_few</em></H1>
+
+<table border=0 summary="" cellpadding=5>
+<tr>
+    <td valign=middle>
+    <img src="../../../documentation/images/Dartboard7.png" alt="DART project logo" height=70 />
+    </td>
+    <td>


More information about the Dart-dev mailing list