[Dart-dev] [3304] DART/trunk/ncep_obs: Matching changes in format (lat/lon in degrees, not radians) for input

nancy at subversion.ucar.edu nancy at subversion.ucar.edu
Wed Apr 9 16:20:02 MDT 2008


An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/dart-dev/attachments/20080409/30650a2d/attachment.html
-------------- next part --------------
Modified: DART/trunk/ncep_obs/create_real_obs.f90
===================================================================
--- DART/trunk/ncep_obs/create_real_obs.f90	2008-04-09 22:14:39 UTC (rev 3303)
+++ DART/trunk/ncep_obs/create_real_obs.f90	2008-04-09 22:20:02 UTC (rev 3304)
@@ -15,8 +15,9 @@
 use obs_sequence_mod, only : obs_sequence_type, write_obs_seq, &
                              static_init_obs_sequence, destroy_obs_sequence 
 use     real_obs_mod, only : real_obs_sequence
-use    utilities_mod, only : initialize_utilities, register_module, do_output, &
-                             error_handler, timestamp, E_ERR, E_MSG, logfileunit, &
+use    utilities_mod, only : initialize_utilities, register_module, &
+                             do_output, logfileunit, &
+                             error_handler, timestamp, E_ERR, E_MSG, &
                              find_namelist_in_file, check_namelist_read
 
 implicit none
@@ -47,24 +48,24 @@
 integer :: year = 2003, month =1, day =1, tot_days = 31
 integer :: max_num = 800000, select_obs = 0
 character(len = 129) :: ObsBase = 'temp_obs.'
-logical :: ADPUPA = .false., AIRCAR = .false., AIRCFT = .false., SATWND = .false., &
-           SATEMP = .false., SFCSHP = .false., ADPSFC = .false.
+logical :: ADPUPA = .false., AIRCAR = .false., AIRCFT = .false., &
+           SATWND = .false., SATEMP = .false., SFCSHP = .false., &
+           ADPSFC = .false.
 
 logical :: obs_U  = .false., obs_V  = .false., obs_T  = .false. , &
            obs_PS = .false., obs_QV = .false., daily_file = .true.
 
-real(r8) :: lon1 = 0.0_r8,    &   !  lower longitude bound
+real(r8) :: lon1 =   0.0_r8,  &   !  lower longitude bound
             lon2 = 360.0_r8,  &   !  upper longitude bound 
-            lat1 = -89.0_r8,  &   !  lower latitude bound
-            lat2 = 89.0_r8        !  upper latitude bound
+            lat1 = -90.0_r8,  &   !  lower latitude bound
+            lat2 =  90.0_r8       !  upper latitude bound
 
-namelist /ncepobs_nml/year, month, day, tot_days, max_num, select_obs, ObsBase, &
-        ADPUPA, AIRCAR, AIRCFT, SATEMP, SFCSHP, ADPSFC, SATWND, &
+namelist /ncepobs_nml/ year, month, day, tot_days, max_num, select_obs,  &
+        ObsBase, ADPUPA, AIRCAR, AIRCFT, SATEMP, SFCSHP, ADPSFC, SATWND, &
         obs_U, obs_V, obs_T, obs_PS, obs_QV, daily_file, lon1, lon2, lat1, lat2
 
 ! ----------------------------------------------------------------------
-! Select observation types using NCEP categories (when select_obs \= 0).
-!
+! Select observation types using NCEP categories (when select_obs /= 0).
 !  ADPUPA: upper-air reports (mostly radiosonde plus few dropsonde, PIBAL)
 !  AIRCFT: Conv. (AIREP, PIREP) and ASDAR aircraft reports
 !  AIRCAR: ACARS sircraft reports
@@ -73,10 +74,12 @@
 !  ADPSFC: SURFACE LAND SYNOPTIC STATION reports
 !  SATWND: Satellite derived wind reports
 ! ----------------------------------------------------------------------
-
-!  Select variables of U, V, T, QV, PS using the logicals:
+! Select variables of U, V, T, QV, PS using the logicals:
 !  obs_U   obs_V   obs_PS   obs_T   obs_QV  
+! ----------------------------------------------------------------------
 
+! start of executable program code
+
 call initialize_utilities('create_real_obs')
 call register_module(source,revision,revdate)
 
@@ -144,3 +147,4 @@
 call timestamp(source,revision,revdate,'end') ! close the log file.
 
 end program create_real_obs
+

Modified: DART/trunk/ncep_obs/real_obs_mod.f90
===================================================================
--- DART/trunk/ncep_obs/real_obs_mod.f90	2008-04-09 22:14:39 UTC (rev 3303)
+++ DART/trunk/ncep_obs/real_obs_mod.f90	2008-04-09 22:20:02 UTC (rev 3304)
@@ -21,7 +21,7 @@
                              get_date, set_time
 use    utilities_mod, only : get_unit, open_file, close_file, file_exist, &
                              register_module, error_handler, &
-                             E_ERR, E_MSG
+                             E_ERR, E_MSG, timestamp
 use     location_mod, only : location_type, set_location, VERTISPRESSURE, VERTISSURFACE
 use obs_sequence_mod, only : init_obs_sequence, init_obs, insert_obs_in_seq, &
                              set_obs_values, set_qc, obs_sequence_type, obs_type, &
@@ -75,14 +75,19 @@
    revdate  = "$Date$"
 
 logical, save :: module_initialized = .false.
+! set this to true if you want to print out the current time
+! after each N observations are processed, for benchmarking.
+logical :: print_timestamps = .false.
+integer :: print_every_Nth  = 10000
 !-------------------------------------------------
 
 contains
 
 
-  function real_obs_sequence (year, month, day, hourt, max_num, select_obs, &
-           ObsBase, ADDUPA, AIRCAR, AIRCFT, SATEMP, SFCSHP, ADPSFC, SATWND, &
-           obs_U, obs_V, obs_T, obs_PS, obs_QV, bin_beg, bin_end, lon1, lon2, lat1, lat2)
+function real_obs_sequence (year, month, day, hourt, max_num, select_obs, &
+          ObsBase, ADDUPA, AIRCAR, AIRCFT, SATEMP, SFCSHP, ADPSFC, SATWND, &
+          obs_U, obs_V, obs_T, obs_PS, obs_QV, bin_beg, bin_end,           &
+          lon1, lon2, lat1, lat2)
 !------------------------------------------------------------------------------
 !  this function is to prepare NCEP decoded BUFR data to DART sequence format
 !
@@ -111,7 +116,7 @@
 real (r8) :: bin_beg, bin_end
 
 character(len = 8 ) :: obsdate
-character(len = 80) :: obsfile
+character(len = 80) :: obsfile, label
 character(len = 129) :: copy_meta_data, qc_meta_data
 character(len = 6 ) :: subset
 logical :: pass
@@ -154,7 +159,7 @@
 call get_time(current_day, sec0, day0)
 
 !   output the day and sec.
-print*, 'day, sec= ', sec0, day0
+print*, 'processing data for day, sec= ', day0, sec0
 
 ! open NCEP observation data file
 
@@ -162,10 +167,10 @@
 obsfile   = trim(adjustl(ObsBase))//obsdate//hourt
 obs_unit  = get_unit()
 open(unit = obs_unit, file = obsfile, form='formatted', status='old')
-print*, 'file opened= ', obsfile
+print*, 'input file opened= ', trim(obsfile)
 rewind (obs_unit)
 
-print*, 'ncep obsdates = ', obsdate
+!print*, 'ncep obsdates = ', obsdate
 
 obs_num = 0
 iskip   = 0
@@ -182,6 +187,7 @@
 
 !   A 'day' is from 03:01Z of one day through 03Z of the next.
 !   skip the observations at exact 03Z of the beginning of the day
+!   (obs at 03Z the next day have a time of 27.)
 !------------------------------------------------------------------------------
    if(time == 3.0_r8) then
       iskip = iskip + 1
@@ -194,6 +200,14 @@
       cycle obsloop
    endif
 
+   ! verify the location is not outside valid limits
+   if((lon > 360.0_r8) .or. (lon <   0.0_r8) .or.  &
+      (lat >  90.0_r8) .or. (lat < -90.0_r8)) then
+      write(*,*) 'invalid location.  lon,lat = ', lon, lat
+      iskip = iskip + 1
+      cycle obsloop
+   endif
+
    lonc = lon
    if (lon2 > 360.0_r8 .and. lon < 180.0_r8) lonc = lon + 360.0_r8
 
@@ -264,15 +278,15 @@
 !   check to see if this observation is desired
 !------------------------------------------------------------------------------
 
-   if(select_obs == 0) then
+   ! if select_obs is 0, we are going to include all observations
+   ! and we skip the selection code below.
+   if(select_obs /= 0) then
 
-      pass = .false.
-
-   else
- 
+      ! assume we are going to ignore this obs, unless it is
+      ! specifically included by one of the selections below.
       pass = .true.
 
-      !    select the specific NCEP obs types
+      ! select the specific NCEP obs types
       if( (ADDUPA .and. (subset =='ADPUPA')) .or. &
           (AIRCAR .and. (subset =='AIRCAR')) .or. &
           (AIRCFT .and. (subset =='AIRCFT')) .or. &
@@ -292,33 +306,39 @@
 
       endif
      
-   endif
+      ! if pass is still true, we want to ignore this obs.
+      if(pass) then
+         iskip = iskip + 1
+         cycle obsloop 
+      endif
 
-   if(pass) then
-      iskip = iskip + 1
-      cycle obsloop 
    endif
 
-!   this observation has passed all tests, process it 
+!   process this observation
 !------------------------------------------------------------------------------
 
    obs_num = obs_num + 1
-   if(mod(obs_num, 1000) ==0) print*, 'doing obs = ', obs_num
+
+   ! print a reassuring message after every Nth processed obs.
+   ! if requested, print in the form of a timestamp.  
+   ! the default is just a plain string with the current obs count.
+   if(mod(obs_num, print_every_Nth) == 0) then
+       write(label, *) 'obs count = ', obs_num
+       if (print_timestamps) then
+          call timestamp(string1=label, pos='')
+       else
+          write(*,*) trim(label)
+       endif
+   endif
    if(obs_num == max_num) then
-      print*, 'max_num for obs is reached'
+      print*, 'Max limit for observation count reached.  Increase value in namelist'
       stop
    endif
    
-   ! set up observation location
-   if(lon >= 360.0_r8) lon = 360.0_r8
-   if(lon <=   0.0_r8) lon =   0.0_r8
-   if(lat >=  90.0_r8) lat =  90.0_r8
-   if(lat <= -90.0_r8) lat = -90.0_r8
-
    ! set vertical coordinate for upper-air observations
    if (subset == 'AIRCAR' .or. subset == 'AIRCFT' .or. &
        subset == 'SATWND' .or. subset == 'ADPUPA' ) then
-       vloc = lev*100.0_r8         ! (transfer Pressure coordinate from mb to Pascal) 
+       vloc = lev*100.0_r8          ! convert from mb to Pascal
        which_vert = VERTISPRESSURE
    endif
 
@@ -330,8 +350,8 @@
    endif
 
    ! set obs value and error if necessary
-   if ( obs_kind == LAND_SFC_ALTIMETER .or. obs_kind == MARINE_SFC_ALTIMETER .or. &
-        obs_kind == RADIOSONDE_SURFACE_ALTIMETER ) then
+   if ( obs_kind == LAND_SFC_ALTIMETER .or. obs_kind == MARINE_SFC_ALTIMETER &
+        .or. obs_kind == RADIOSONDE_SURFACE_ALTIMETER ) then
       vloc = lev                  ! station height, not used now for Ps obs
       which_vert = VERTISSURFACE
       obs_value  = compute_altimeter(zob, vloc)  !  altimeter is hPa
@@ -388,7 +408,8 @@
 
 close(obs_unit)
 
-print*, 'obs_num= ',obs_num,' skipped= ',obsdate,iskip
+print*, 'date ', obsdate, ' obs used = ', obs_num, ' obs skipped = ', iskip
+!print*, 'obs_num= ',obs_num,' skipped= ',obsdate,iskip
 
 end function real_obs_sequence
 


More information about the Dart-dev mailing list