[Dart-dev] [4035] DART/trunk/observations/GTSPP: Finish up the netcdf interfaces for the gtspp obs.

nancy at ucar.edu nancy at ucar.edu
Thu Sep 3 16:35:18 MDT 2009

An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/dart-dev/attachments/20090903/86527f71/attachment.html 
-------------- next part --------------
Modified: DART/trunk/observations/GTSPP/GTSPP.html
--- DART/trunk/observations/GTSPP/GTSPP.html	2009-09-03 17:29:13 UTC (rev 4034)
+++ DART/trunk/observations/GTSPP/GTSPP.html	2009-09-03 22:35:17 UTC (rev 4035)
@@ -101,29 +101,10 @@
 do this data conversion.
 Optional namelist interface
-<A HREF="#Namelist"> <em class=code>&amp;convert_cosmic_gps_nml</em> </A>
+<A HREF="#Namelist"> <em class=code>&amp;gtspp_to_obs_nml</em> </A>
 may be read from file <em class=file>input.nml</em>.
-The work directory contains several scripts, including one which downloads
-the raw data files a day at a time (cosmic_download.csh), and one 
-which executes the conversion program (convert_script.csh).  These
-scripts make 6 hour files by default, but have options for other
-times.  The input files are downloaded a day at a time.  Be aware
-that each profile is stored in a separate netcdf file, and there
-are between 1000-2000 files/day, so the download process can be
-lengthy.  You probably want to download as a separate preprocess step
-and do not use the options to automatically delete the input files.
-Keep the files around until you are sure you are satisified with the
-output files and then delete them by hand.
-The conversion executable, convert_cosmic_gps_cdf, reads the namelist
-from the file 'input.nml', but also reads an analysis time from the
-terminal or the standard input unit.  This makes it simpler to convert
-multiple files without editing the namelist.  The program prompts for
-the time string with the required time format, 
-<em class=code>yyyy-mm-dd_hh:mm:ss</em> .
@@ -138,7 +119,7 @@
@@ -151,10 +132,11 @@
  <P>We adhere to the F90 standard of starting a namelist with an ampersand
  '&amp;' and terminating with a slash '/'.
  <div class=namelist><pre>
- <em class=call>namelist / convert_cosmic_gps_nml / </em>
-    obs_levels, local_operator, obs_window, &
-    ray_ds, ray_htop, gpsro_netcdf_file,    &
-    gpsro_netcdf_filelist, gpsro_out_file
+ <em class=call>namelist / gtspp_to_obs_nml / </em>
+    gtspp_netcdf_file,    
+    gtspp_netcdf_filelist, 
+    gtspp_out_file,
+    avg_obs_per_file
  <H3 class=indent1>Discussion</H3>
  <P>This namelist is read in a file called <em class=file>input.nml</em>
@@ -164,83 +146,40 @@
      <TH align=left>Type        </TH>
      <TH align=left>Description </TH></TR>
- <TR><!--contents--><TD valign=top>obs_levels</TD>
-     <!--  type  --><TD valign=top>integer(200)</TD>
-     <!--descript--><TD>A series of heights, in kilometers, where observations
-                        from this profile should be interpolated.  (Note that
-                        the other distances and heights in the namelist are
-                        specified in meters.)  The values should be listed in
-                        increasing height order.
-                        Default: none</TD></TR>
- <TR><!--contents--><TD valign=top>local_operator</TD>
-     <!--  type  --><TD valign=top>logical</TD>
-     <!--descript--><TD>If .true., compute the observation using a method
-                        which assumes all effects occur at the tangent point.
-                        If .false., integrate along the tangent line and do
-                        ray-path reconstruction.
-                        Default: .true.</TD></TR>
- <TR><!--contents--><TD valign=top>obs_window</TD>
-     <!--  type  --><TD valign=top>real(r8)</TD>
-     <!--descript--><TD>Accept and convert observations if they are within
-                        plus or minus this number of hours from the analysis
-                        time (which is read as an input from the terminal or
-                        the standard input unit).
-                        Default: 12.0</TD></TR>
- <TR><!--contents--><TD valign=top>ray_ds</TD>
-     <!--  type  --><TD valign=top>real(r8)</TD>
-     <!--descript--><TD>For the non-local operator only, the delta stepsize, 
-                        in meters, to use for the along-path integration in
-                        each direction out from the tangent point.
-                        Default: 5000.0</TD></TR>
- <TR><!--contents--><TD valign=top>ray_htop</TD>
-     <!--  type  --><TD valign=top>real(r8)</TD>
-     <!--descript--><TD>For the non-local operator only, stop the integration
-                        when one of the endpoints of the next integration step
-                        goes above this height.  Specified in meters.
-                        Default: 15000.0</TD></TR>
- <TR><!--contents--><TD valign=top>gpsro_netcdf_file</TD>
+ <TR><!--contents--><TD valign=top>gtspp_netcdf_file</TD>
      <!--  type  --><TD valign=top>character(len=128)</TD>
      <!--descript--><TD>The input filename when converting a single profile.  
                         Only one of the 2 filenames can have a valid value, 
                         so to use the single filename set the list name
-                        ('gpsro_netcdf_filelist') to the empty string ('').
-                        Default: 'cosmic_gps_input.nc'</TD></TR>
+                        'gtspp_netcdf_filelist' to the empty string ('').
+                        Default: '1234567.nc'</TD></TR>
- <TR><!--contents--><TD valign=top>gpsro_netcdf_filelist</TD>
+ <TR><!--contents--><TD valign=top>gtspp_netcdf_filelist</TD>
      <!--  type  --><TD valign=top>character(len=128)</TD>
      <!--descript--><TD>To convert a series of profiles in a single execution
                         create a text file which contains each input file,
                         in ascii, one filename per line.  Set this item to
-                        the name of that file, and set 'gpsro_netcdf_file' to
+                        the name of that file, and set 'gtspp_netcdf_file' to
                         the empty string ('').
-                        Default: 'cosmic_gps_input_list'</TD></TR>
+                        Default: 'gtspp_to_obs_filelist'</TD></TR>
- <TR><!--contents--><TD valign=top>gpsro_out_file</TD>
+ <TR><!--contents--><TD valign=top>gtspp_out_file</TD>
      <!--  type  --><TD valign=top>character(len=128)</TD>
      <!--descript--><TD>The output file to be created.  Note that to be
                         compatible with earlier versions of this program, if
                         this file already exists it will be read in and the
                         new data will be inserted into that file.
-                        Default: 'obs_seq.gpsro'</TD></TR>
+                        Default: 'obs_seq.gtspp'</TD></TR>
- <TR><!--contents--><TD valign=top>overwrite_time</TD>
-     <!--  type  --><TD valign=top>logical</TD>
-     <!--descript--><TD>This item is NOT in the standard namelist, but code
-                        exists in the program to support the functionality
-                        if the source is edited and this variable is added 
-                        to the namelist.  If set to
-                        .true., the output file will be created with all
-                        observations marked with the specified analysis time
-                        instead of the actual observation collection time.
-                        This is generally not what you want, but might be
-                        useful if you are binning observations by time to do 
-                        thinning or super-ob'ing data.
-                        Default: .false.</TD></TR>
+ <TR><!--contents--><TD valign=top>avg_obs_per_file</TD>
+     <!--  type  --><TD valign=top>integer</TD>
+     <!--descript--><TD>The code needs an upper limit on the number of observations
+                        generated by this program.  It can be larger than the actual
+                        number of observations converted.  The total number of obs
+                        is computed by multiplying this number by the number of input
+                        files.  If you get an error because there is no more room to
+                        add observations to the output file, increase this number.
+                        Default: 500</TD></TR>
@@ -252,14 +191,8 @@
-Some COSMIC files seem to have internal times which differ from the
-times encoded in the filenames by as much as 2-3 minutes.  If it is
-important to get all the observations within a particular time window
-files with filenames from a few minutes before and after the window 
-should be converted.
-Times really outside the window can be excluded either by setting
-the 'obs_window' namelist variable, or can be trimmed later with the
-<a href="../../obs_sequence/obs_sequence_tool.html">obs_sequence_tool</a>.
+Does not have correct code for setting observation error variance yet.
+Also, not sure if the incoming data qc is strict enough.

Modified: DART/trunk/observations/GTSPP/gtspp_to_obs.f90
--- DART/trunk/observations/GTSPP/gtspp_to_obs.f90	2009-09-03 17:29:13 UTC (rev 4034)
+++ DART/trunk/observations/GTSPP/gtspp_to_obs.f90	2009-09-03 22:35:17 UTC (rev 4035)
@@ -59,7 +59,7 @@
 integer :: rcode, ncid, varid, ndepths, k, nfiles, num_new_obs,  &
            aday, asec, dday, dsec, oday, osec,                   &
            iyear, imonth, iday, ihour, imin, isec,               &
-           zloc, obs_num, io, iunit, nobs, filenum, dummy
+           zloc, obs_num, io, iunit, filenum, dummy, i_qc
 logical :: file_exist, first_obs, did_obs, from_list = .false.
 real(r8) :: hght_miss, refr_miss, azim_miss, oerr,               & 
             qc, lato, lono, hghto, refro, azimo, wght, nx, ny,   & 
@@ -78,6 +78,7 @@
 real(r8) :: obs_depth(nmaxdepths)   = -1.0_r8
 real(r8) :: temperature(nmaxdepths) = -888888.0_r8
 real(r8) :: salinity(nmaxdepths) = -888888.0_r8
+character(len=nmaxdepths) :: str_qc = ''
 !  Declare namelist parameters
@@ -191,11 +192,12 @@
    ! get the number of depths
    call nc_check( nf90_inq_dimid(ncid, "depth", varid), 'inq dimid depth')
-   call nc_check( nf90_inquire_dimension(ncid, varid, name, nobs), 'inq dim depth')
+   call nc_check( nf90_inquire_dimension(ncid, varid, name, ndepths), 'inq dim depth')
    ! and read in the depth array
    call nc_check( nf90_inq_varid(ncid, "depth", varid),'inq varid depth')
-   call nc_check( nf90_get_var(ncid, varid, obs_depth),'get var   depth')
+   call nc_check( nf90_get_var(ncid, varid, obs_depth, &
+                  start=(/1/), count=(/ndepths/)),'get var   depth')
    ! get the single lat/lon values
    call nc_check( nf90_inq_varid(ncid,"longitude",varid) ,'inq varid longitude')
@@ -205,17 +207,22 @@
    ! need to get the actual values from the 'temperature'
    call nc_check( nf90_inq_varid(ncid,"temperature",varid) ,'inq varid temperature')
-   call nc_check( nf90_get_var(ncid, varid, temperature),   'get var   temperature')
+   print *, 'getting temp, ndepths = ', ndepths
+   call nc_check( nf90_get_var(ncid, varid, temperature, &
+                              start=(/1,1,1,1/), count=(/1,1,ndepths,1/)),   'get var   temperature')
    ! salinity?  doesn't seem to be here 
    ! plus want file QC, and what about error?
+   call nc_check( nf90_inq_varid(ncid,"TEMP_qparm",varid) ,'inq varid TEMP_qparam')
+   call nc_check( nf90_get_var(ncid, varid, str_qc, &
+                              start=(/1,1/), count=(/1,ndepths/)),   'get var   TEMP_qparam')
+print *, 'qc string = ', str_qc(1:10)
    call nc_check( nf90_close(ncid) , 'close file')
  ! FIXME:
-   d_qc(1) = 0.0
    oerr = 2.0
    first_obs = .true.
@@ -223,8 +230,12 @@
    obsloop: do k = 1, ndepths
      ! check qc here.  if bad, loop
-     if ( d_qc(1) /= 1 )  cycle obsloop
+     read(str_qc(k:k), '(I1)') i_qc
+     if ( i_qc /= 1 )  cycle obsloop    ! in this case, 1 is good
+     ! set qc
+     d_qc(1) = 0.0    ! but for dart, a QC of 0 is good
      ! set location 
      call set_obs_def_location(obs_def, &
                           set_location(glon, glat, obs_depth(k),VERTISHEIGHT))
@@ -235,7 +246,7 @@
      call set_obs_def_key(obs_def, obs_num)
      call set_obs_def(obs, obs_def)
-     obs_val(1) = obsval
+     obs_val(1) = temperature(k)
      call set_obs_values(obs, obs_val)
      qc_val(1)  = d_qc(1)
      call set_qc(obs, qc_val)
@@ -263,19 +274,17 @@
 ! done with main loop.  if we added any obs to the sequence, write it out.
 if (did_obs) then
-!print *, 'ready to write, nobs = ', get_num_obs(obs_seq)
+print *, 'ready to write, nobs = ', get_num_obs(obs_seq)
    if (get_num_obs(obs_seq) > 0) &
       call write_obs_seq(obs_seq, gtspp_out_file)
    ! minor stab at cleanup, in the off chance this will someday get turned
    ! into a subroutine in a module.  probably not all that needs to be done,
    ! but a start.
-!print *, 'calling destroy_obs'
    call destroy_obs(obs)
-   call destroy_obs(prev_obs)
-print *, 'skipping destroy_seq'
+   !call destroy_obs(prev_obs)   ! is this identical to obs?
    ! get core dumps here, not sure why?
-   !if (get_num_obs(obs_seq) > 0) call destroy_obs_sequence(obs_seq)
+   if (get_num_obs(obs_seq) > 0) call destroy_obs_sequence(obs_seq)

Modified: DART/trunk/observations/GTSPP/work/input.nml
--- DART/trunk/observations/GTSPP/work/input.nml	2009-09-03 17:29:13 UTC (rev 4034)
+++ DART/trunk/observations/GTSPP/work/input.nml	2009-09-03 22:35:17 UTC (rev 4035)
@@ -5,8 +5,8 @@
 ! flist contains a list of input filenames to convert into a single
 !  output file
-  gtspp_netcdf_file = '',
-  gtspp_netcdf_filelist = 'flist',
+  gtspp_netcdf_file = '../data/1264095.nc',
+  gtspp_netcdf_filelist = '',
   gtspp_out_file = 'obs_seq.gtspp',

More information about the Dart-dev mailing list