[Dart-dev] [5696] DART/branches/development/obs_sequence/obs_seq_coverage.f90: Fixed problem writing ReportTime netCDF variable.

nancy at ucar.edu nancy at ucar.edu
Fri Apr 13 15:29:35 MDT 2012


Revision: 5696
Author:   thoar
Date:     2012-04-13 15:29:34 -0600 (Fri, 13 Apr 2012)
Log Message:
-----------
Fixed problem writing ReportTime netCDF variable.

Modified Paths:
--------------
    DART/branches/development/obs_sequence/obs_seq_coverage.f90

-------------- next part --------------
Modified: DART/branches/development/obs_sequence/obs_seq_coverage.f90
===================================================================
--- DART/branches/development/obs_sequence/obs_seq_coverage.f90	2012-04-12 21:29:58 UTC (rev 5695)
+++ DART/branches/development/obs_sequence/obs_seq_coverage.f90	2012-04-13 21:29:34 UTC (rev 5696)
@@ -222,7 +222,7 @@
 if (temporal_coverage_percent < 100.0_r8) then
    write(string1,*)'namelist: temporal_coverage_percent (',temporal_coverage_percent,&
                    ') must be == 100.0 for now.)' 
-   call error_handler(E_ERR, 'obs_seq_coverage', string1, source, revision, revdate)
+!  call error_handler(E_ERR, 'obs_seq_coverage', string1, source, revision, revdate)
 endif
 
 if ((obs_sequence_name /= '') .and. (obs_sequence_list /= '')) then
@@ -267,12 +267,22 @@
           verification_interval_seconds, temporal_coverage_percent)
 
 if (verbose) then
+
    write(*,*) ! whitespace
-   write(*,*)'At least',nT_minimum,' observations times are required at:'
+   write(*,*)'The analysis times (the start of the forecasts) are:'
+   do i=1,size(verification_times,1)
+      write(string1,*)'analysis # ',i,' at '
+      call print_date(verification_times(i,1),trim(string1))
+   enddo
+
+   write(*,*) ! whitespace
+   write(*,*)'At least',nT_minimum,' observations times are required during:'
    do i=1,num_verification_times
       write(string1,*)'verification # ',i,' at '
       call print_date(all_verif_times(i),trim(string1))
    enddo
+
+
    write(*,*) ! whitespace
 endif
 
@@ -493,7 +503,7 @@
             station_id = add_new_station(flavor, obs_loc, stations)
       endif
 
-      if ( is_time_wanted( obs_time, station_id, stations, timeindex) ) &
+      if ( time_is_wanted( obs_time, station_id, stations, timeindex) ) &
          call update_time( obs_time, station_id, stations, timeindex)
 
  100  continue
@@ -531,6 +541,8 @@
       num_out_total = num_out_total + stations(i)%ntimes
    endif
 
+   if (debug) write(*,*) 'Station ID ',i,' has ',stations(i)%ntimes, ' reports.'
+
 enddo
 
 if (verbose) write(*,*)'There were ',num_out_stat,' stations matching the input criterion.'
@@ -717,7 +729,7 @@
 !============================================================================
 
 
-function is_time_wanted(ObsTime, stationid, stationlist, timeindex)
+function time_is_wanted(ObsTime, stationid, stationlist, timeindex)
 
 ! The station has a list of the observation times closest to the
 ! verification times. Determine if the observation time is closer to
@@ -727,13 +739,13 @@
 integer,                     intent(in)  :: stationid
 type(station), dimension(:), intent(in)  :: stationlist
 integer,                     intent(out) :: timeindex
-logical                                  :: is_time_wanted
+logical                                  :: time_is_wanted
 
 type(time_type) :: stndelta, obdelta
 integer :: i
 
 timeindex = 0
-is_time_wanted = .FALSE.
+time_is_wanted = .FALSE.
 
 ! the time_minus function always returns a positive difference
 
@@ -742,9 +754,10 @@
    obdelta = ObsTime - all_verif_times(i)
 
    ! If observation is not within half a verification step,
-   ! try the next one. 
+   ! try the next verification time. 
    if (obdelta >= half_stride) cycle TimeLoop 
 
+   ! we must be close now ...
    stndelta = stationlist(stationid)%times(i) - all_verif_times(i)
 
    ! Check to see if the observation is closer to the verification time
@@ -752,14 +765,14 @@
    if (obdelta < stndelta) then
       if (debug) call print_time(stationlist(stationid)%times(i),'replacing ')
       if (debug) call print_time(ObsTime,'with this observation time')
-      timeindex = i
-      is_time_wanted = .TRUE.
+      timeindex      = i
+      time_is_wanted = .TRUE.
       exit TimeLoop
    endif
 
 enddo TimeLoop
 
-end function is_time_wanted
+end function time_is_wanted
 
 
 !============================================================================
@@ -793,7 +806,7 @@
 ! as long as ntimes /= 0 we are OK.
 ! When the stations get written to the netCDF file, count the
 ! number of non-zero times in the times array for a real count.
-stationlist(stationid)%ntimes = timeindex
+stationlist(stationid)%ntimes = stationlist(stationid)%ntimes + 1 
 
 ! Stuff the time in the appropriate slot ... finally.
 stationlist(stationid)%times(timeindex) = ObsTime
@@ -1226,7 +1239,6 @@
 
 WriteObs : do stationindex = 1,num_stations
 
-   ntimes    = stations(stationindex)%ntimes
    istart(1) = stationindex
    icount(1) = 1
 
@@ -1261,7 +1273,7 @@
    ! time : fill, write
    !----------------------------------------------------------------------------
    mytimes = 0.0_digits12
-   do i = 1,stations(stationindex)%ntimes
+   do i = 1,ntimes
       call get_time(stations(stationindex)%times(i), secs, days)
       mytimes(i) = days + secs/(60.0_digits12 * 60.0_digits12 * 24.0_digits12)
    enddo


More information about the Dart-dev mailing list