[Dart-dev] [4328] DART/trunk: Major revision to the converters. Common c

nancy at ucar.edu nancy at ucar.edu
Fri Mar 26 15:32:33 MDT 2010


Revision: 4328
Author:   nancy
Date:     2010-03-26 15:32:33 -0600 (Fri, 26 Mar 2010)
Log Message:
-----------
Major revision to the converters.  Common code pulled out into new
obs_utilities_mod.f90, which eventually may move up another level
to be common across all types of observations.  Added makefiles for
the advance_time and obs_sequence_tool executables.  The converters
no longer have times or windows as inputs; they convert all obs in
the input file to the output, and keep the original obs times.
The rawinsonde converter still needs 2 logicals for whether to output
the significant level data or not.  Also added some scripts to show
how these might be used in converting a large number of obs.
There is a corresponding change to the wrf preprocessor to accomodate
the obs having different times.  It now needs an analysis time as input.
Thanks to Ryan and Glen for new code, and thanks to them and Rahul
for testing.

Modified Paths:
--------------
    DART/trunk/models/wrf/WRF_DART_utilities/wrf_dart_obs_preprocess.f90
    DART/trunk/observations/MADIS/MADIS.html
    DART/trunk/observations/MADIS/convert_madis_acars.f90
    DART/trunk/observations/MADIS/convert_madis_marine.f90
    DART/trunk/observations/MADIS/convert_madis_mesonet.f90
    DART/trunk/observations/MADIS/convert_madis_metar.f90
    DART/trunk/observations/MADIS/convert_madis_rawin.f90
    DART/trunk/observations/MADIS/data/README
    DART/trunk/observations/MADIS/work/input.nml
    DART/trunk/observations/MADIS/work/path_names_convert_madis_acars
    DART/trunk/observations/MADIS/work/path_names_convert_madis_marine
    DART/trunk/observations/MADIS/work/path_names_convert_madis_mesonet
    DART/trunk/observations/MADIS/work/path_names_convert_madis_metar
    DART/trunk/observations/MADIS/work/path_names_convert_madis_rawin
    DART/trunk/observations/MADIS/work/quickbuild.csh

Added Paths:
-----------
    DART/trunk/observations/MADIS/obs_utilities_mod.f90
    DART/trunk/observations/MADIS/shell_scripts/
    DART/trunk/observations/MADIS/shell_scripts/input.nml
    DART/trunk/observations/MADIS/shell_scripts/input.nml.template
    DART/trunk/observations/MADIS/shell_scripts/madis_conv.csh
    DART/trunk/observations/MADIS/shell_scripts/windowing.csh
    DART/trunk/observations/MADIS/work/mkmf_advance_time
    DART/trunk/observations/MADIS/work/mkmf_obs_sequence_tool
    DART/trunk/observations/MADIS/work/path_names_advance_time
    DART/trunk/observations/MADIS/work/path_names_obs_sequence_tool

Removed Paths:
-------------
    DART/trunk/observations/MADIS/data/acars.in

-------------- next part --------------
Modified: DART/trunk/models/wrf/WRF_DART_utilities/wrf_dart_obs_preprocess.f90
===================================================================
--- DART/trunk/models/wrf/WRF_DART_utilities/wrf_dart_obs_preprocess.f90	2010-03-25 22:10:15 UTC (rev 4327)
+++ DART/trunk/models/wrf/WRF_DART_utilities/wrf_dart_obs_preprocess.f90	2010-03-26 21:32:33 UTC (rev 4328)
@@ -39,7 +39,9 @@
 use    utilities_mod, only : find_namelist_in_file, check_namelist_read, nc_check
 use     obs_kind_mod, only : RADIOSONDE_U_WIND_COMPONENT, ACARS_U_WIND_COMPONENT, &
                              MARINE_SFC_U_WIND_COMPONENT, LAND_SFC_U_WIND_COMPONENT, &
-                             GPSRO_REFRACTIVITY, SAT_U_WIND_COMPONENT, VORTEX_LAT
+                             METAR_U_10_METER_WIND, GPSRO_REFRACTIVITY, &
+                             SAT_U_WIND_COMPONENT, VORTEX_LAT
+use time_manager_mod, only : time_type, set_calendar_type, GREGORIAN, set_date
 use        model_mod, only : static_init_model
 use           netcdf
 
@@ -55,11 +57,13 @@
                       sonde_extra        = 'obs_seq.rawin',      &
                       acars_extra        = 'obs_seq.acars',      &
                       land_sfc_extra     = 'obs_seq.land_sfc',   &
+                      metar_extra        = 'obs_seq.metar',      &
                       marine_sfc_extra   = 'obs_seq.marine_sfc', &
                       sat_wind_extra     = 'obs_seq.satwnd',     &
                       gpsro_extra        = 'obs_seq.gpsro',      &
                       trop_cyclone_extra = 'obs_seq.tc'
 integer            :: max_num_obs              = 100000   ! Largest number of obs in one sequence
+logical            :: overwrite_obs_time       = .false.  ! true to overwrite all observation times
 
 !  boundary-specific parameters
 real(r8)           :: obs_boundary             = 0.0_r8   ! number of grid points to remove obs near boundary
@@ -95,10 +99,11 @@
          include_sig_data, superob_aircraft, superob_sat_winds,     &
          sfc_elevation_check, overwrite_ncep_sfc_qc, overwrite_ncep_satwnd_qc, &
          aircraft_pres_int, sat_wind_pres_int, sfc_elevation_tol,   & 
-         obs_pressure_top, obs_height_top, obs_boundary, sonde_extra,   &
+         obs_pressure_top, obs_height_top, obs_boundary, sonde_extra, metar_extra,   &
          acars_extra, land_sfc_extra, marine_sfc_extra, sat_wind_extra, &
          trop_cyclone_extra, gpsro_extra, tc_sonde_radii, increase_bdy_error,      &
-         maxobsfac, obsdistbdy, sat_wind_horiz_int, aircraft_horiz_int
+         maxobsfac, obsdistbdy, sat_wind_horiz_int, aircraft_horiz_int, &
+         overwrite_obs_time
 
 ! ----------------------------------------------------------------------
 ! Declare other variables
@@ -106,15 +111,30 @@
 
 character(len=129)      :: obs_seq_read_format
 character(len=80)       :: name
+character (len=19)      :: datime
 
 integer                 :: io, iunit, fid, var_id, obs_seq_file_id, num_copies, &
-                           num_qc, num_obs, max_obs_seq, nx, ny
+                           num_qc, num_obs, max_obs_seq, nx, ny, gday, gsec, &
+                           iyear, imonth, iday, ihour, imin, isec
 
 logical                 :: file_exist, pre_I_format
 
 type(obs_sequence_type) :: seq_all, seq_rawin, seq_sfc, seq_acars, seq_satwnd, &
                            seq_tc, seq_gpsro, seq_other
 
+type(time_type)         :: anal_time, prev_time, time_obs
+
+print*,'Enter target assimilation time (yyyy-mm-dd_hh:mm:ss): '
+read*,datime
+call set_calendar_type(GREGORIAN)
+read(datime(1:4),   fmt='(i4)') iyear
+read(datime(6:7),   fmt='(i2)') imonth
+read(datime(9:10),  fmt='(i2)') iday
+read(datime(12:13), fmt='(i2)') ihour
+read(datime(15:16), fmt='(i2)') imin
+read(datime(18:19), fmt='(i2)') isec
+anal_time = set_date(iyear, imonth, iday, ihour, imin, isec)
+
 call static_init_obs_sequence()
 call static_init_model()
 
@@ -161,54 +181,68 @@
 !  read input obs_seq file, divide into platforms
 call read_and_parse_input_seq(file_name_input, dble(nx), dble(ny), obs_boundary, &
 include_sig_data, obs_pressure_top, obs_height_top, sfc_elevation_check, &
-sfc_elevation_tol, overwrite_ncep_sfc_qc, overwrite_ncep_satwnd_qc, seq_rawin, &
-seq_sfc, seq_acars, seq_satwnd, seq_tc, seq_gpsro, seq_other)
+sfc_elevation_tol, overwrite_ncep_sfc_qc, overwrite_ncep_satwnd_qc, &
+overwrite_obs_time, anal_time, seq_rawin, seq_sfc, seq_acars, seq_satwnd, & 
+seq_tc, seq_gpsro, seq_other)
 
 !  add supplimental rawinsonde observations from file
 call add_supplimental_obs(sonde_extra, seq_rawin, max_obs_seq, &
 RADIOSONDE_U_WIND_COMPONENT, nx, ny, obs_boundary, include_sig_data, &
-obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol)
+obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol, &
+overwrite_obs_time, anal_time)
 
 !  add supplimental ACARS observations from file
 call add_supplimental_obs(acars_extra, seq_acars, max_obs_seq, &
 ACARS_U_WIND_COMPONENT, nx, ny, obs_boundary, include_sig_data, &
-obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol)
+obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol, &
+overwrite_obs_time, anal_time)
 
 !  add supplimental marine observations from file
 call add_supplimental_obs(marine_sfc_extra, seq_sfc, max_obs_seq, &
 MARINE_SFC_U_WIND_COMPONENT, nx, ny, obs_boundary, include_sig_data, &
-obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol)
+obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol, &
+overwrite_obs_time, anal_time)
 
 !  add supplimental land surface observations from file
 call add_supplimental_obs(land_sfc_extra, seq_sfc, max_obs_seq, &
 LAND_SFC_U_WIND_COMPONENT, nx, ny, obs_boundary, include_sig_data, &
-obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol)
+obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol, &
+overwrite_obs_time, anal_time)
 
+!  add supplimental metar observations from file
+call add_supplimental_obs(metar_extra, seq_sfc, max_obs_seq, &
+METAR_U_10_METER_WIND, nx, ny, obs_boundary, include_sig_data, &
+obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol, &
+overwrite_obs_time, anal_time)
+
 !  add supplimental satellite wind observations from file
 call add_supplimental_obs(sat_wind_extra, seq_satwnd, max_obs_seq, &
 SAT_U_WIND_COMPONENT, nx, ny, obs_boundary, include_sig_data, &
-obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol)
+obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol, &
+overwrite_obs_time, anal_time)
 
 !  add supplimental GPSRO observations from file
 call add_supplimental_obs(gpsro_extra, seq_gpsro, max_obs_seq, &
 GPSRO_REFRACTIVITY, nx, ny, obs_boundary, include_sig_data, &
-obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol)
+obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol, &
+overwrite_obs_time, anal_time)
 
 !  add supplimental tropical cyclone vortex observations from file
 call add_supplimental_obs(trop_cyclone_extra, seq_tc, max_obs_seq, &
 VORTEX_LAT, nx, ny, obs_boundary, include_sig_data, &
-obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol)
+obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol, &
+overwrite_obs_time, anal_time)
 
 !  remove all sonde observations within radius of TC if desired
 if ( tc_sonde_radii > 0.0_r8 ) call remove_sondes_near_tc(seq_tc, & 
                                                seq_rawin, tc_sonde_radii)
 
 !  super-ob ACARS data
-if ( superob_aircraft ) call superob_aircraft_data(seq_acars, &
+if ( superob_aircraft ) call superob_aircraft_data(seq_acars, anal_time, &
                                      aircraft_horiz_int, aircraft_pres_int)
 
 !  super-ob satellite wind data
-if ( superob_sat_winds ) call superob_sat_wind_data(seq_satwnd, &
+if ( superob_sat_winds ) call superob_sat_wind_data(seq_satwnd, anal_time, &
                                      sat_wind_horiz_int, sat_wind_pres_int)
 
 max_obs_seq = get_num_obs(seq_tc)     + get_num_obs(seq_rawin) + &
@@ -295,28 +329,31 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 subroutine add_supplimental_obs(filename, obs_seq, max_obs_seq, plat_kind, &
                                  nx, ny, obs_bdy, siglevel, ptop, htop, &
-                                 sfcelev, elev_max)
+                                 sfcelev, elev_max, overwrite_time, atime)
 
 use         types_mod, only : r8
+use  time_manager_mod, only : time_type
 use      location_mod, only : location_type, get_location, vert_is_pressure, &
                               vert_is_height
-use  obs_sequence_mod, only : obs_sequence_type, obs_type, init_obs, &
+use  obs_sequence_mod, only : obs_sequence_type, obs_type, init_obs, set_obs_def, &
                               get_num_copies, get_num_qc, read_obs_seq, &
                               get_first_obs, get_obs_def, get_next_obs, &
-                              copy_obs, append_obs_to_seq, destroy_obs_sequence
-use       obs_def_mod, only : obs_def_type, get_obs_kind, &
+                              copy_obs, insert_obs_in_seq, destroy_obs_sequence
+use       obs_def_mod, only : obs_def_type, get_obs_kind, set_obs_def_time, &
                               get_obs_def_location
 use      obs_kind_mod, only : RADIOSONDE_U_WIND_COMPONENT, ACARS_U_WIND_COMPONENT, &
                               LAND_SFC_U_WIND_COMPONENT, MARINE_SFC_U_WIND_COMPONENT, &
-                              GPSRO_REFRACTIVITY, SAT_U_WIND_COMPONENT, VORTEX_LAT
+                              METAR_U_10_METER_WIND, GPSRO_REFRACTIVITY, &
+                              SAT_U_WIND_COMPONENT, VORTEX_LAT
 use         model_mod, only : get_domain_info 
 
 implicit none
 
 character(len=129), intent(in)         :: filename
+type(time_type),         intent(in)    :: atime
 type(obs_sequence_type), intent(inout) :: obs_seq
 integer, intent(in)                    :: max_obs_seq, plat_kind, nx, ny
-logical, intent(in)                    :: siglevel, sfcelev
+logical, intent(in)                    :: siglevel, sfcelev, overwrite_time
 real(r8), intent(in)                   :: obs_bdy, ptop, htop, elev_max
 
 integer  :: nloc, okind, dom_id
@@ -343,6 +380,8 @@
     write(6,*) 'Adding Supplimental Marine Surface Data'
   case (LAND_SFC_U_WIND_COMPONENT)
     write(6,*) 'Adding Supplimental Land Surface Data'
+  case (METAR_U_10_METER_WIND)
+    write(6,*) 'Adding Supplimental METAR Data'
   case (SAT_U_WIND_COMPONENT)
     write(6,*) 'Adding Supplimental Satellite Wind Data'
   case (VORTEX_LAT)
@@ -402,6 +441,14 @@
 
   end if
 
+  !  overwrite the observation time with the analysis time if desired
+  if ( overwrite_time ) then
+
+    call set_obs_def_time(obs_def, atime)
+    call set_obs_def(obs_in, obs_def)
+
+  end if
+
   ! perform platform-specific checks
   select case (plat_kind)
 
@@ -414,6 +461,8 @@
       pass_checks = surface_obs_check(sfcelev, elev_max, xyz_loc)
     case (LAND_SFC_U_WIND_COMPONENT)
       pass_checks = surface_obs_check(sfcelev, elev_max, xyz_loc)
+    case (METAR_U_10_METER_WIND)
+      pass_checks = surface_obs_check(sfcelev, elev_max, xyz_loc)
     case (SAT_U_WIND_COMPONENT)
       pass_checks = sat_wind_obs_check()
     case default
@@ -424,7 +473,8 @@
   if ( pass_checks ) then
 
     call copy_obs(obs, obs_in)
-    call append_obs_to_seq(obs_seq, obs)
+    !call append_obs_to_seq(obs_seq, obs)
+    call insert_obs_in_seq(obs_seq, obs)
 
   end if
 
@@ -490,7 +540,7 @@
 subroutine build_master_sequence(seq_type, seq_all)
 
 use obs_sequence_mod, only : obs_type, obs_sequence_type, init_obs, & 
-                             get_first_obs, copy_obs, append_obs_to_seq, & 
+                             get_first_obs, copy_obs, insert_obs_in_seq, & 
                              get_next_obs, get_obs_def, get_num_copies, &
                              get_num_qc
 
@@ -512,7 +562,8 @@
 do while ( .not. last_obs )
 
   call copy_obs(obs, obs_in)
-  call append_obs_to_seq(seq_all, obs)
+  !call append_obs_to_seq(seq_all, obs)
+  call insert_obs_in_seq(seq_all, obs)
 
   prev_obs = obs_in
   call get_next_obs(seq_type, prev_obs, obs_in, last_obs)
@@ -862,32 +913,41 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 subroutine read_and_parse_input_seq(filename, nx, ny, obs_bdy, siglevel, ptop, &
                                     htop, sfcelev, elev_max, new_sfc_qc, &
-                                    new_satwnd_qc, rawin_seq, sfc_seq, &
-                                    acars_seq, satwnd_seq, tc_seq, gpsro_seq, &
-                                    other_seq)
+                                    new_satwnd_qc, overwrite_time, atime, &
+                                    rawin_seq, sfc_seq, acars_seq, satwnd_seq, &
+                                    tc_seq, gpsro_seq, other_seq)
 
 use         types_mod, only : r8
 use     utilities_mod, only : nc_check
+use  time_manager_mod, only : time_type 
 use      location_mod, only : location_type, get_location, vert_is_pressure, &
                               vert_is_height
 use  obs_sequence_mod, only : obs_sequence_type, obs_type, init_obs, &
                               get_num_copies, get_num_qc, get_qc_meta_data, &
                               get_first_obs, get_obs_def, copy_obs, get_num_qc, &
-                              append_obs_to_seq, get_next_obs, get_qc, set_qc, &
-                              destroy_obs_sequence, read_obs_seq
-use       obs_def_mod, only : obs_def_type, get_obs_kind, get_obs_def_location
+                              insert_obs_in_seq, get_next_obs, get_qc, set_qc, &
+                              destroy_obs_sequence, read_obs_seq, set_obs_def
+use       obs_def_mod, only : obs_def_type, get_obs_kind, get_obs_def_location, &
+                              set_obs_def_time
 use      obs_kind_mod, only : RADIOSONDE_U_WIND_COMPONENT, RADIOSONDE_V_WIND_COMPONENT, &
                               RADIOSONDE_SURFACE_ALTIMETER, RADIOSONDE_TEMPERATURE, &
-                              RADIOSONDE_SPECIFIC_HUMIDITY, GPSRO_REFRACTIVITY, &
+                              RADIOSONDE_SPECIFIC_HUMIDITY, RADIOSONDE_DEWPOINT, &
+                              RADIOSONDE_RELATIVE_HUMIDITY, GPSRO_REFRACTIVITY, &
                               AIRCRAFT_U_WIND_COMPONENT, AIRCRAFT_V_WIND_COMPONENT, &
                               AIRCRAFT_TEMPERATURE, AIRCRAFT_SPECIFIC_HUMIDITY, &
+                              ACARS_DEWPOINT, ACARS_RELATIVE_HUMIDITY, &
                               ACARS_U_WIND_COMPONENT, ACARS_V_WIND_COMPONENT, &
                               ACARS_TEMPERATURE, ACARS_SPECIFIC_HUMIDITY, &
                               MARINE_SFC_U_WIND_COMPONENT, MARINE_SFC_V_WIND_COMPONENT, &
                               MARINE_SFC_TEMPERATURE, MARINE_SFC_SPECIFIC_HUMIDITY, &
+                              MARINE_SFC_RELATIVE_HUMIDITY, MARINE_SFC_DEWPOINT, &
                               LAND_SFC_U_WIND_COMPONENT, LAND_SFC_V_WIND_COMPONENT, &
                               LAND_SFC_TEMPERATURE, LAND_SFC_SPECIFIC_HUMIDITY, &
-                              MARINE_SFC_ALTIMETER, LAND_SFC_ALTIMETER, &
+                              LAND_SFC_RELATIVE_HUMIDITY, LAND_SFC_DEWPOINT, &
+                              METAR_U_10_METER_WIND, METAR_V_10_METER_WIND, &
+                              METAR_TEMPERATURE_2_METER, METAR_SPECIFIC_HUMIDITY_2_METER, &
+                              METAR_DEWPOINT_2_METER, METAR_RELATIVE_HUMIDITY_2_METER, &
+                              METAR_ALTIMETER, MARINE_SFC_ALTIMETER, LAND_SFC_ALTIMETER, &
                               SAT_U_WIND_COMPONENT, SAT_V_WIND_COMPONENT, &
                               VORTEX_LAT, VORTEX_LON, VORTEX_PMIN, VORTEX_WMAX
 use         model_mod, only : get_domain_info
@@ -903,7 +963,8 @@
 character(len=129),      intent(in)    :: filename
 real(r8),                intent(in)    :: nx, ny, obs_bdy, ptop, htop, elev_max
 logical,                 intent(in)    :: siglevel, sfcelev, new_sfc_qc, &
-                                          new_satwnd_qc
+                                          new_satwnd_qc, overwrite_time
+type(time_type),         intent(in)    :: atime
 type(obs_sequence_type), intent(inout) :: rawin_seq, sfc_seq, acars_seq, &
                                           satwnd_seq, tc_seq, gpsro_seq, other_seq
 
@@ -977,31 +1038,46 @@
 
   end if
 
+  !  overwrite the observation time with the analysis time if desired
+  if ( overwrite_time ) then 
+ 
+    call set_obs_def_time(obs_def, atime)
+    call set_obs_def(obs_in, obs_def)
+  
+  end if
+
   !  perform platform-specific checks
   select case (okind)
 
     case ( RADIOSONDE_U_WIND_COMPONENT, RADIOSONDE_V_WIND_COMPONENT, &
            RADIOSONDE_TEMPERATURE, RADIOSONDE_SPECIFIC_HUMIDITY, &
+           RADIOSONDE_DEWPOINT, RADIOSONDE_RELATIVE_HUMIDITY, &
            RADIOSONDE_SURFACE_ALTIMETER)
 
       if ( rawinsonde_obs_check(obs_loc, okind, siglevel, sfcelev, elev_max) ) then
 
         call copy_obs(obs, obs_in)
-        call append_obs_to_seq(rawin_seq, obs)
+        !call append_obs_to_seq(rawin_seq, obs)
+        call insert_obs_in_seq(rawin_seq, obs)
 
       end if
 
     case ( LAND_SFC_U_WIND_COMPONENT, LAND_SFC_V_WIND_COMPONENT, &
            LAND_SFC_TEMPERATURE, LAND_SFC_SPECIFIC_HUMIDITY, &
-           MARINE_SFC_U_WIND_COMPONENT, MARINE_SFC_V_WIND_COMPONENT, &
-           MARINE_SFC_TEMPERATURE, MARINE_SFC_SPECIFIC_HUMIDITY, &
-           LAND_SFC_ALTIMETER, MARINE_SFC_ALTIMETER )
+           LAND_SFC_RELATIVE_HUMIDITY, LAND_SFC_DEWPOINT,  &
+           METAR_U_10_METER_WIND, METAR_V_10_METER_WIND, &
+           METAR_TEMPERATURE_2_METER, METAR_SPECIFIC_HUMIDITY_2_METER, &
+           METAR_DEWPOINT_2_METER, METAR_RELATIVE_HUMIDITY_2_METER, &
+           METAR_ALTIMETER, MARINE_SFC_U_WIND_COMPONENT,  &
+           MARINE_SFC_V_WIND_COMPONENT, MARINE_SFC_TEMPERATURE, &
+           MARINE_SFC_SPECIFIC_HUMIDITY, MARINE_SFC_DEWPOINT, &
+           MARINE_SFC_RELATIVE_HUMIDITY, LAND_SFC_ALTIMETER, MARINE_SFC_ALTIMETER )
 
       if ( surface_obs_check(sfcelev, elev_max, xyz_loc) ) then
 
         call copy_obs(obs, obs_in)
         if ( new_sfc_qc .and. okind /= LAND_SFC_ALTIMETER .and. &
-                              okind /= MARINE_SFC_ALTIMETER  ) then
+             okind /= METAR_ALTIMETER .and. okind /= MARINE_SFC_ALTIMETER ) then
 
           call get_qc(obs, qc)
           if ( (qc(1) == sfc_qc_ok1 .or. qc(1) == sfc_qc_ok2) .and. input_ncep_qc ) then
@@ -1010,19 +1086,22 @@
           end if
 
         end if
-        call append_obs_to_seq(sfc_seq, obs)
+        !call append_obs_to_seq(sfc_seq, obs)
+        call insert_obs_in_seq(sfc_seq, obs)
 
       endif
 
     case ( AIRCRAFT_U_WIND_COMPONENT, AIRCRAFT_V_WIND_COMPONENT, &
            AIRCRAFT_TEMPERATURE, AIRCRAFT_SPECIFIC_HUMIDITY, &
+           ACARS_RELATIVE_HUMIDITY, ACARS_DEWPOINT, &
            ACARS_U_WIND_COMPONENT, ACARS_V_WIND_COMPONENT, &
            ACARS_TEMPERATURE, ACARS_SPECIFIC_HUMIDITY )
 
       if ( aircraft_obs_check() ) then
 
         call copy_obs(obs, obs_in)
-        call append_obs_to_seq(acars_seq, obs)
+        !call append_obs_to_seq(acars_seq, obs)
+        call insert_obs_in_seq(acars_seq, obs)
 
       end if
 
@@ -1041,24 +1120,28 @@
           end if
 
         end if
-        call append_obs_to_seq(satwnd_seq, obs)
+        !call append_obs_to_seq(satwnd_seq, obs)
+        call insert_obs_in_seq(satwnd_seq, obs)
 
       endif
 
     case ( VORTEX_LAT, VORTEX_LON, VORTEX_PMIN, VORTEX_WMAX )
 
       call copy_obs(obs, obs_in)
-      call append_obs_to_seq(tc_seq, obs)
+      !call append_obs_to_seq(tc_seq, obs)
+      call insert_obs_in_seq(tc_seq, obs)
 
     case ( GPSRO_REFRACTIVITY )
 
       call copy_obs(obs, obs_in)
-      call append_obs_to_seq(gpsro_seq, obs)
+      !call append_obs_to_seq(gpsro_seq, obs)
+      call insert_obs_in_seq(gpsro_seq, obs)
 
     case default
 
       call copy_obs(obs, obs_in)
-      call append_obs_to_seq(other_seq, obs)
+      !call append_obs_to_seq(other_seq, obs)
+      call insert_obs_in_seq(other_seq, obs)
 
   end select
 
@@ -1200,7 +1283,7 @@
 !    vdist - vertical interval of superobs
 !
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-subroutine superob_aircraft_data(seq, hdist, vdist)
+subroutine superob_aircraft_data(seq, atime, hdist, vdist)
 
 use         types_mod, only : r8, missing_r8, earth_radius
 use  time_manager_mod, only : time_type
@@ -1210,18 +1293,20 @@
                               get_num_copies, get_num_qc, get_first_obs, &
                               get_next_obs, destroy_obs_sequence, &
                               get_num_obs, get_obs_values, get_qc, &
-                              get_obs_def, append_obs_to_seq
+                              get_obs_def, insert_obs_in_seq
 use       obs_def_mod, only : obs_def_type, get_obs_def_location, &
                               get_obs_kind, get_obs_def_error_variance, &
                               get_obs_def_time
 use      obs_kind_mod, only : AIRCRAFT_U_WIND_COMPONENT, ACARS_U_WIND_COMPONENT, &
                               AIRCRAFT_V_WIND_COMPONENT, ACARS_V_WIND_COMPONENT, &
                               AIRCRAFT_TEMPERATURE, ACARS_TEMPERATURE, &
-                              AIRCRAFT_SPECIFIC_HUMIDITY, ACARS_SPECIFIC_HUMIDITY
+                              AIRCRAFT_SPECIFIC_HUMIDITY, ACARS_SPECIFIC_HUMIDITY, &
+                              ACARS_DEWPOINT, ACARS_RELATIVE_HUMIDITY
 
 implicit none
 
 type(obs_sequence_type), intent(inout) :: seq
+type(time_type),         intent(in)    :: atime
 real(r8), intent(in)                   :: hdist, vdist
 
 integer             :: num_copies, num_qc, nloc, k, locdex, obs_kind, n, &
@@ -1230,7 +1315,9 @@
 real(r8)            :: nuwnd, latu, lonu, preu, uwnd, erru, qcu, nvwnd, latv, &
                        lonv, prev, vwnd, errv, qcv, ntmpk, latt, lont, pret, &
                        tmpk, errt, qct, nqvap, latq, lonq, preq, qvap, errq, &
-                       qcq, obs_dist, xyz_loc(3), obs_val(1), qc_val(1)
+                       dwpt, errd, qcd, ndwpt, latd, lond, pred, relh, errr, &
+                       qcr, nrelh, latr, lonr, prer, qcq, obs_dist,  &
+                       xyz_loc(3), obs_val(1), qc_val(1)
 type(location_type) :: obs_loc
 type(obs_def_type)  :: obs_def
 type(obs_type)      :: obs, prev_obs
@@ -1239,7 +1326,8 @@
 
   real(r8)            :: lat, lon, pressure, uwnd, uwnd_err, uwnd_qc, &
                          vwnd, vwnd_err, vwnd_qc, tmpk, tmpk_err, tmpk_qc, &
-                         qvap, qvap_err, qvap_qc
+                         qvap, qvap_err, qvap_qc, dwpt, dwpt_err, dwpt_qc, &
+                         relh, relh_err, relh_qc
   type(location_type) :: obs_loc
   type(time_type)     :: time
 
@@ -1294,6 +1382,8 @@
     airobs(locdex)%vwnd     = missing_r8
     airobs(locdex)%tmpk     = missing_r8
     airobs(locdex)%qvap     = missing_r8
+    airobs(locdex)%dwpt     = missing_r8
+    airobs(locdex)%relh     = missing_r8
     airobs(locdex)%time     = get_obs_def_time(obs_def)
 
   end if
@@ -1323,6 +1413,19 @@
     airobs(locdex)%qvap_qc  = qc_val(1)
     airobs(locdex)%qvap_err = get_obs_def_error_variance(obs_def)
 
+  else if ( obs_kind == ACARS_DEWPOINT )  then
+
+    airobs(locdex)%dwpt     = obs_val(1)
+    airobs(locdex)%dwpt_qc  = qc_val(1)
+    airobs(locdex)%dwpt_err = get_obs_def_error_variance(obs_def)
+
+  else if ( obs_kind == ACARS_RELATIVE_HUMIDITY )  then
+  
+    airobs(locdex)%relh     = obs_val(1)
+    airobs(locdex)%relh_qc  = qc_val(1)
+    airobs(locdex)%relh_err = get_obs_def_error_variance(obs_def)
+
+
   end if
 
   prev_obs = obs
@@ -1344,7 +1447,12 @@
   tmpk   = 0.0_r8  ;  errt = 0.0_r8  ;  qct  = 0.0_r8
   nqvap  = 0.0_r8  ;  latq = 0.0_r8  ;  lonq = 0.0_r8  ;  preq = 0.0_r8
   qvap   = 0.0_r8  ;  errq = 0.0_r8  ;  qcq  = 0.0_r8
+  ndwpt  = 0.0_r8  ;  latd = 0.0_r8  ;  lond = 0.0_r8  ;  pred = 0.0_r8
+  dwpt   = 0.0_r8  ;  errd = 0.0_r8  ;  qcd  = 0.0_r8
+  nrelh  = 0.0_r8  ;  latr = 0.0_r8  ;  lonr = 0.0_r8  ;  prer = 0.0_r8
+  relh   = 0.0_r8  ;  errr = 0.0_r8  ;  qcr  = 0.0_r8
 
+
   if ( airobs(k)%lat /= missing_r8 ) then  !  create initial superob
 
     if ( airobs(k)%uwnd /= missing_r8 ) then
@@ -1387,6 +1495,26 @@
       qcq   = max(qcq,airobs(k)%qvap_qc)
     end if
 
+    if ( airobs(k)%dwpt /= missing_r8 ) then
+      ndwpt = ndwpt + 1.0_r8
+      latd  = latd  + airobs(k)%lat
+      lond  = lond  + airobs(k)%lon
+      pred  = pred  + airobs(k)%pressure
+      dwpt  = dwpt  + airobs(k)%dwpt
+      errd  = errd  + airobs(k)%dwpt_err
+      qcd   = max(qcd,airobs(k)%dwpt_qc)
+    end if
+
+    if ( airobs(k)%relh /= missing_r8 ) then
+      nrelh = nrelh + 1.0_r8
+      latr  = latr  + airobs(k)%lat
+      lonr  = lonr  + airobs(k)%lon
+      prer  = prer  + airobs(k)%pressure
+      relh  = relh  + airobs(k)%relh
+      errr  = errr  + airobs(k)%relh_err
+      qcr   = max(qcr,airobs(k)%relh_qc)
+    end if
+
     do n = (k+1), nloc
 
       if ( airobs(n)%lat /= missing_r8 ) then
@@ -1434,6 +1562,27 @@
             errq  = errq  + airobs(n)%qvap_err
             qcq   = max(qcq,airobs(n)%qvap_qc)
           end if
+
+          if ( airobs(n)%dwpt /= missing_r8 ) then
+            ndwpt = ndwpt + 1.0_r8
+            latd  = latd  + airobs(n)%lat
+            lond  = lond  + airobs(n)%lon
+            pred  = pred  + airobs(n)%pressure
+            dwpt  = dwpt  + airobs(n)%dwpt
+            errd  = errd  + airobs(n)%dwpt_err
+            qcd   = max(qcd,airobs(n)%dwpt_qc)
+          end if
+
+          if ( airobs(n)%relh /= missing_r8 ) then
+            nrelh = nrelh + 1.0_r8
+            latr  = latr  + airobs(n)%lat
+            lonr  = lonr  + airobs(n)%lon
+            prer  = prer  + airobs(n)%pressure
+            relh  = relh  + airobs(n)%relh
+            errr  = errr  + airobs(n)%relh_err
+            qcr   = max(qcr,airobs(n)%relh_qc)
+          end if
+
           airobs(n)%lat = missing_r8
 
         end if
@@ -1452,8 +1601,9 @@
       erru = erru / nuwnd
 
       call create_obs_type(latu, lonu, preu, VERTISPRESSURE, uwnd, &
-                           ACARS_U_WIND_COMPONENT, erru, qcu, airobs(k)%time, obs)
-      call append_obs_to_seq(seq, obs)
+                           ACARS_U_WIND_COMPONENT, erru, qcu, atime, obs)
+      !call append_obs_to_seq(seq, obs)
+      call insert_obs_in_seq(seq, obs)
 
     end if
 
@@ -1467,8 +1617,9 @@
       errv = errv / nvwnd
 
       call create_obs_type(latv, lonv, prev, VERTISPRESSURE, vwnd, &
-                           ACARS_V_WIND_COMPONENT, errv, qcv, airobs(k)%time, obs)
-      call append_obs_to_seq(seq, obs)
+                           ACARS_V_WIND_COMPONENT, errv, qcv, atime, obs)
+      !call append_obs_to_seq(seq, obs)
+      call insert_obs_in_seq(seq, obs)
 
     end if
 
@@ -1482,8 +1633,9 @@
       errt = errt / ntmpk
 
       call create_obs_type(latt, lont, pret, VERTISPRESSURE, tmpk, & 
-                           ACARS_TEMPERATURE, errt, qct, airobs(k)%time, obs)
-      call append_obs_to_seq(seq, obs)
+                           ACARS_TEMPERATURE, errt, qct, atime, obs)
+      !call append_obs_to_seq(seq, obs)
+      call insert_obs_in_seq(seq, obs)
 
     end if
 
@@ -1497,11 +1649,44 @@
       errq = errq / nqvap
 
       call create_obs_type(latq, lonq, preq, VERTISPRESSURE, qvap, & 
-                           ACARS_SPECIFIC_HUMIDITY, errq, qcq, airobs(k)%time, obs)
-      call append_obs_to_seq(seq, obs)
+                           ACARS_SPECIFIC_HUMIDITY, errq, qcq, atime, obs)
+      !call append_obs_to_seq(seq, obs)
+      call insert_obs_in_seq(seq, obs)
 
     end if
 
+    if ( ndwpt > 0.0_r8 ) then  !  write dewpoint temperature superob
+
+      latd = latd / ndwpt
+      lond = lond / ndwpt
+      if ( lond >= 360.0_r8 )  lond = lond - 360.0_r8
+      pred = pred / ndwpt
+      dwpt = dwpt / ndwpt
+      errd = errd / ndwpt
+
+      call create_obs_type(latd, lond, pred, VERTISPRESSURE, dwpt, &
+                           ACARS_DEWPOINT, errd, qcd, atime, obs)
+      !call append_obs_to_seq(seq, obs)
+      call insert_obs_in_seq(seq, obs)
+
+    end if
+
+    if ( nrelh > 0.0_r8 ) then  !  write relative humidity superob
+
+      latr = latr / nrelh
+      lonr = lonr / nrelh
+      if ( lonr >= 360.0_r8 )  lonr = lonr - 360.0_r8
+      prer = prer / nrelh
+      relh = relh / nrelh
+      errr = errr / nrelh
+
+      call create_obs_type(latr, lonr, prer, VERTISPRESSURE, relh, &
+                           ACARS_RELATIVE_HUMIDITY, errr, qcr, atime, obs)
+      !call append_obs_to_seq(seq, obs)
+      call insert_obs_in_seq(seq, obs)
+
+    end if
+
   end if
 
 end do 
@@ -1520,7 +1705,7 @@
 !    vdist - vertical interval of superobs
 !
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-subroutine superob_sat_wind_data(seq, hdist, vdist)
+subroutine superob_sat_wind_data(seq, atime, hdist, vdist)
 
 use         types_mod, only : r8, missing_r8, earth_radius
 use  time_manager_mod, only : time_type
@@ -1530,7 +1715,7 @@
                               get_num_copies, get_num_qc, get_first_obs, &
                               get_next_obs, destroy_obs_sequence, &
                               get_num_obs, get_obs_values, get_qc, &
-                              get_obs_def, append_obs_to_seq
+                              get_obs_def, insert_obs_in_seq
 use       obs_def_mod, only : obs_def_type, get_obs_def_location, &
                               get_obs_kind, get_obs_def_error_variance, &
                               get_obs_def_time
@@ -1539,6 +1724,7 @@
 implicit none
 
 type(obs_sequence_type), intent(inout) :: seq
+type(time_type),         intent(in)    :: atime
 real(r8), intent(in)                   :: hdist, vdist
 
 integer             :: num_copies, num_qc, nloc, k, locdex, obs_kind, n, &
@@ -1692,12 +1878,14 @@
 
     !  add to observation sequence
     call create_obs_type(lat, lon, pres, VERTISPRESSURE, uwnd, &
-                         SAT_U_WIND_COMPONENT, erru, qcu, satobs(k)%time, obs)
-    call append_obs_to_seq(seq, obs)
+                         SAT_U_WIND_COMPONENT, erru, qcu, atime, obs)
+    !call append_obs_to_seq(seq, obs)
+    call insert_obs_in_seq(seq, obs)
 
     call create_obs_type(lat, lon, pres, VERTISPRESSURE, vwnd, &
-                         SAT_V_WIND_COMPONENT, errv, qcv, satobs(k)%time, obs)
-    call append_obs_to_seq(seq, obs)
+                         SAT_V_WIND_COMPONENT, errv, qcv, atime, obs)
+    !call append_obs_to_seq(seq, obs)
+    call insert_obs_in_seq(seq, obs)
 
   end if
 
@@ -1744,3 +1932,4 @@
 
 return
 end function surface_obs_check
+

Modified: DART/trunk/observations/MADIS/MADIS.html
===================================================================
--- DART/trunk/observations/MADIS/MADIS.html	2010-03-25 22:10:15 UTC (rev 4327)
+++ DART/trunk/observations/MADIS/MADIS.html	2010-03-26 21:32:33 UTC (rev 4328)
@@ -18,7 +18,9 @@
 </center>
 
 <H1>MADIS Data Ingest System</H1>
-<!-- version tag follows, do not edit --><P>$Id$</P>
+<small><P>
+<!-- version tag follows, do not edit -->$Id$
+</P></small>
 
 <P>
 The <a href="http://madis.noaa.gov/">MADIS</a>
@@ -28,6 +30,28 @@
 and integration of data from a variety of sources.
 </P>
 
+<P>
+The overall flow is:
+<ol>
+<li>convert each madis file, by platform type, into an obs_seq file.
+    one file in, one file out.  no time changes.  use the 
+    <em class=file>shell_scripts/madis_conv.csh</em> script.
+    there are script options for hourly output files, or a single daily
+    output file.</li>
+<li>if you aren't using the wrf preprocessing program, you're ready to go.</li>
+<li>if you do want to do subsequent wrf preprocessing, you need to:
+<ol>
+<li>decide on the windowing.  each platform has a different convention
+    and if you're going to put them into the wrf preprocessing you'll need
+    to have the windowing match.  use the
+    <em class=file>shell_scripts/windowing.csh</em> script.</li>
+<li>the wrf preprocessing takes a list of files and assumes they will all
+    be assimilated at the same time, for superob'ing purposes, so it should
+    match the expected assimilation window when running filter.</li>
+</ol>
+</ol>
+</P>
+
 <!--==================================================================-->
 
 <A NAME="DataSources"></A>
@@ -35,7 +59,7 @@
 <H2>DATA SOURCES</H2>
 
 <P>
-&nbsp;
+<a href="http://madis.noaa.gov/">http://madis.noaa.gov</a>
 </P>
 
 <!--==================================================================-->
@@ -47,7 +71,23 @@
 The programs in the <em class=file>DART/observations/MADIS/</em> 
 directory help to extract the data from the distribution files 
 and put them into DART observation sequence (obs_seq) file format.
+Build them in the <em class=file>work</em> directory.  In addition
+to the converters, the <em class=file>advance_time</em> and
+<em class=file>obs_sequence_tool</em> utilities will be built.
 </P>
+<P>
+Example scripts for converting batches of these files are
+in the <em class=file>shell_scripts</em> directory.  Example
+data files are in the <em class=file>data</em> directory.
+These are <em>NOT</em> intended to be turnkey scripts; they will
+certainly need to be customized for your use.  There are comments
+at the top of the scripts saying what options they include, and
+should be commented enough to indicate where changes will be
+likely to need to be made.
+</P>
+<P>The converter source code files have compile-time choices
+for outputting various types of moist variables.
+</P>
 
 <!--==================================================================-->
 <!-- Describe the bugs.                                               -->
@@ -80,7 +120,7 @@
 <H2>Terms of Use</H2>
 
 <P>
-DART software - Copyright &#169; 2004 - 2010 UCAR.<br>
+DART software - Copyright &copy; 2004 - 2010 UCAR.<br>
 This open source software is provided by UCAR, "as is",<br>
 without charge, subject to all terms of use at<br>
 <a href="http://www.image.ucar.edu/DAReS/DART/DART_download">

Modified: DART/trunk/observations/MADIS/convert_madis_acars.f90
===================================================================
--- DART/trunk/observations/MADIS/convert_madis_acars.f90	2010-03-25 22:10:15 UTC (rev 4327)
+++ DART/trunk/observations/MADIS/convert_madis_acars.f90	2010-03-26 21:32:33 UTC (rev 4328)
@@ -13,33 +13,44 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !
 !   convert_madis_acars - program that reads a MADIS netCDF ACARS 
-!                         observation file and writes a DART obs_seq file
-!                         using the DART library routines.
+!                         observation file and writes a DART
+!                         obs_seq file using the DART library routines.
 !
 !     created Dec. 2007 Ryan Torn, NCAR/MMM
 !     modified Dec. 2008 Soyoung Ha and David Dowell, NCAR/MMM
 !     - added dewpoint as an output variable
 !     - added relative humidity as an output variable
 !
+!     modified to use a common set of utilities, better netcdf error checks,
+!     able to insert obs with any time correctly (not only monotonically
+!     increasing times)    nancy collins,  ncar/image   11 march 2010
+!     
+!     keep original obs times, make source for all converters as similar
+!     as possbile.   nancy collins,  ncar/image   26 march 2010
+!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-use        types_mod, only : r8, missing_r8
-use     location_mod, only : VERTISPRESSURE
-use obs_sequence_mod, only : obs_sequence_type, obs_type, read_obs_seq, &
-                             static_init_obs_sequence, init_obs, write_obs_seq, &
-                             append_obs_to_seq, init_obs_sequence, get_num_obs, &
-                             set_copy_meta_data, set_qc_meta_data
-use time_manager_mod, only : time_type, set_calendar_type, set_date, &
-                             increment_time, get_time, GREGORIAN, operator(-)
-use     obs_kind_mod, only : ACARS_U_WIND_COMPONENT, ACARS_V_WIND_COMPONENT, &
-                             ACARS_TEMPERATURE, ACARS_SPECIFIC_HUMIDITY, &
-                             ACARS_DEWPOINT, ACARS_RELATIVE_HUMIDITY
+use         types_mod, only : r8, missing_r8
+use     utilities_mod, only : nc_check, initialize_utilities, finalize_utilities
+use  time_manager_mod, only : time_type, set_calendar_type, set_date, operator(>=), &
+                              increment_time, get_time, operator(-), GREGORIAN
+use      location_mod, only : VERTISPRESSURE
+use  obs_sequence_mod, only : obs_sequence_type, obs_type, read_obs_seq, &
+                              static_init_obs_sequence, init_obs, write_obs_seq, & 
+                              init_obs_sequence, get_num_obs, & 
+                              set_copy_meta_data, set_qc_meta_data
+use        meteor_mod, only : pres_alt_to_pres, sat_vapor_pressure, &
+                              specific_humidity, wind_dirspd_to_uv
+use       obs_err_mod, only : acars_wind_error, acars_temp_error, &
+                              acars_rel_hum_error
 use dewpoint_obs_err_mod, only : dewpt_error_from_rh_and_temp, &
                                  rh_error_from_dewpt_and_temp
-use       meteor_mod, only : pres_alt_to_pres, sat_vapor_pressure, &
-                             specific_humidity, wind_dirspd_to_uv
-use      obs_err_mod, only : acars_wind_error, acars_temp_error, &
-                             acars_rel_hum_error
+use      obs_kind_mod, only : ACARS_U_WIND_COMPONENT, ACARS_V_WIND_COMPONENT, &
+                              ACARS_TEMPERATURE, ACARS_SPECIFIC_HUMIDITY, &
+                              ACARS_DEWPOINT, ACARS_RELATIVE_HUMIDITY
+use  obs_utilities_mod, only : getvar_real, get_or_fill_QC, add_obs_to_seq, &
+                               create_3d_obs, getvar_int, getdimlen, set_missing_name
+
 use           netcdf
 
 implicit none
@@ -47,7 +58,7 @@
 character(len=14),  parameter :: acars_netcdf_file = 'acars_input.nc'
 character(len=129), parameter :: acars_out_file    = 'obs_seq.acars'
 
-! the following logical parameters control which water-vapor variables appear in the output file, 
+! the following logical parameters control which water-vapor variables appear in the output file,
 ! whether to use the NCEP error or Lin and Hubbard (2004) moisture error model, and if the
 ! input file has data quality control fields, whether to use or ignore them.
 logical, parameter :: LH_err                    = .false.
@@ -56,150 +67,103 @@
 logical, parameter :: include_dewpoint          = .false.
 logical, parameter :: use_input_qc              = .true. 
 
-integer, parameter ::   num_copies = 1,   &   ! number of copies in sequence
-                        num_qc     = 1        ! number of QC entries
+integer, parameter :: num_copies = 1,   &   ! number of copies in sequence
+                      num_qc     = 1        ! number of QC entries
 
 character (len=129) :: meta_data
-character (len=80)  :: name
-character (len=19)  :: datime
-integer :: rcode, ncid, varid, nobs, nvars, n, i, window_sec, dday, dsec, &
-           oday, osec, nused, iyear, imonth, iday, ihour, imin, isec, nfrc
-logical :: file_exist, input_has_qc
+integer :: ncid, nobs, nvars, n, i, oday, osec, nused
+           
+logical  :: file_exist, first_obs
 
 real(r8) :: palt_miss, tair_miss, relh_miss, tdew_miss, wdir_miss, wspd_miss, uwnd, &
-            vwnd, qobs, qsat, oerr, window_hours, pres, qc, qerr
+            vwnd, qobs, qsat, oerr, pres, qc, qerr
 
-integer,  allocatable :: tobs(:)
+integer,  allocatable :: tobs(:), tobu(:)
 real(r8), allocatable :: lat(:), lon(:), palt(:), tair(:), relh(:), tdew(:), &
                          wdir(:), wspd(:), latu(:), lonu(:), palu(:)
 integer,  allocatable :: qc_palt(:), qc_tair(:), qc_relh(:), qc_tdew(:), qc_wdir(:), qc_wspd(:)
 
 type(obs_sequence_type) :: obs_seq
-type(obs_type)          :: obs
-type(time_type)         :: comp_day0, time_obs, time_anal
+type(obs_type)          :: obs, prev_obs
+type(time_type)         :: comp_day0, time_obs, prev_time
 
-print*,'Enter target assimilation time (yyyy-mm-dd_hh:mm:ss), obs window (hours): '
-read*,datime,window_hours
 
+call initialize_utilities('convert_madis_acars')
+
+! put the reference date into DART format
 call set_calendar_type(GREGORIAN)
-read(datime(1:4),   fmt='(i4)') iyear
-read(datime(6:7),   fmt='(i2)') imonth
-read(datime(9:10),  fmt='(i2)') iday
-read(datime(12:13), fmt='(i2)') ihour
-read(datime(15:16), fmt='(i2)') imin

@@ Diff output truncated at 40000 characters. @@


More information about the Dart-dev mailing list