[Dart-dev] [5907] DART/branches/development: The COSMOS work has been reviewed and is ready for use by the general public .

nancy at ucar.edu nancy at ucar.edu
Tue Oct 30 13:12:51 MDT 2012


Revision: 5907
Author:   thoar
Date:     2012-10-30 13:12:50 -0600 (Tue, 30 Oct 2012)
Log Message:
-----------
The COSMOS work has been reviewed and is ready for use by the general public.

Modified Paths:
--------------
    DART/branches/development/obs_def/obs_def_COSMOS_mod.f90
    DART/branches/development/observations/COSMOS/COSMOS_level2_to_obs.f90
    DART/branches/development/observations/COSMOS/work/input.nml

Added Paths:
-----------
    DART/branches/development/observations/COSMOS/COSMOS_level2_to_obs.html
    DART/branches/development/observations/COSMOS/data/COSMIC_parlist.nc

-------------- next part --------------
Modified: DART/branches/development/obs_def/obs_def_COSMOS_mod.f90
===================================================================
--- DART/branches/development/obs_def/obs_def_COSMOS_mod.f90	2012-10-29 20:01:07 UTC (rev 5906)
+++ DART/branches/development/obs_def/obs_def_COSMOS_mod.f90	2012-10-30 19:12:50 UTC (rev 5907)
@@ -96,8 +96,6 @@
              interactive_cosmos_metadata, &
           get_expected_neutron_intensity
 
-integer :: num_neutron_intensity = 0 ! observation counter ... useful length of metadata arrays
-
 ! version controlled file description for error handling, do not edit
 character(len=128), parameter :: &
    source   = "$URL$", &
@@ -113,11 +111,6 @@
 
 type site_metadata
    private
-!  character(len=metadatalength) :: sitename
-!  type(location_type) :: location
-!  real(r8)            :: latitude
-!  real(r8)            :: longitude
-!  real(r8)            :: elevation
    real(r8)            :: bd         ! Dry Soil Bulk Density [  g / cm^3]
    real(r8)            :: lattwat    ! Lattice Water Content [M^3 /  M^3]
    real(r8)            :: N          ! High Energy Neutron Intensity
@@ -129,18 +122,18 @@
 end type site_metadata
 
 type(site_metadata), allocatable, dimension(:) :: observation_metadata
+type(site_metadata) :: missing_metadata
 character(len=6), parameter :: COSMOSSTRING = 'cosmic'
 
 logical :: debug = .FALSE.
 integer :: MAXcosmoskey = 24*366  ! one year of hourly data - to start
-integer ::    cosmoskey = 0
+integer ::    cosmoskey = 0       ! useful length of metadata arrays
 
 !----------------------------------------------------------------------------
 contains
 !----------------------------------------------------------------------------
 
 
-
   subroutine initialize_module
 !----------------------------------------------------------------------------
 ! subroutine initialize_module
@@ -152,19 +145,18 @@
 
 module_initialized = .true.
 
+missing_metadata%bd       = MISSING_R8
+missing_metadata%lattwat  = MISSING_R8
+missing_metadata%N        = MISSING_R8
+missing_metadata%alpha    = MISSING_R8
+missing_metadata%L1       = MISSING_R8
+missing_metadata%L2       = MISSING_R8
+missing_metadata%L3       = MISSING_R8
+missing_metadata%L4       = MISSING_R8
+
 allocate(observation_metadata(MAXcosmoskey))
 
-do i = 1,MAXcosmoskey
-   observation_metadata(i)%bd       = MISSING_R8
-   observation_metadata(i)%lattwat  = MISSING_R8
-   observation_metadata(i)%N        = MISSING_R8
-   observation_metadata(i)%alpha    = MISSING_R8
-   observation_metadata(i)%L1       = MISSING_R8
-   observation_metadata(i)%L2       = MISSING_R8
-   observation_metadata(i)%L3       = MISSING_R8
-   observation_metadata(i)%L4       = MISSING_R8
-!  observation_metadata(i)%location = set_location_missing()
-enddo
+observation_metadata(:) = missing_metadata
 
 end subroutine initialize_module
 
@@ -184,7 +176,7 @@
 cosmoskey = cosmoskey + 1  ! increase module storage used counter
 
 ! Make sure the new key is within the length of the metadata arrays.
-call key_out_of_range(cosmoskey,'set_cosmos_metadata')
+call grow_metadata(cosmoskey,'set_cosmos_metadata')
 
 key = cosmoskey ! now that we know its legal
 
@@ -214,7 +206,7 @@
 if ( .not. module_initialized ) call initialize_module
 
 ! Make sure the desired key is within the length of the metadata arrays.
-call key_out_of_range(key,'get_cosmos_metadata')
+call key_within_range(key,'get_cosmos_metadata')
 
 bd       = observation_metadata(key)%bd
 lattwat  = observation_metadata(key)%lattwat
@@ -407,8 +399,7 @@
 
  subroutine get_expected_neutron_intensity(state, location, key, val, istatus)
 !----------------------------------------------------------------------
-!subroutine get_expected_neutron_intensity(state, location, key, val, istatus)
-! uses a weighting function calculated by COSMIC (COsmic-ray Soil
+! Uses a weighting function calculated by COSMIC (COsmic-ray Soil
 ! Moisture Interaction Code)
 
 real(r8),            intent(in)  :: state(:) ! state vector
@@ -484,7 +475,7 @@
 integer  :: angle, angledz, maxangle  ! loop indices for an integration interval
 integer  :: i, zi, nlevels, iunit
 real(r8) :: loc_array(3)
-real(r8) :: loc_lon, loc_lat, obs_val
+real(r8) :: loc_lon, loc_lat, loc_value
 type(location_type) :: loc
 
 !=================================================================================
@@ -498,7 +489,7 @@
 !=================================================================================
 
 ! Make sure the desired key is within the length of the metadata arrays.
-call key_out_of_range(key,'get_expected_neutron_intensity')
+call key_within_range(key,'get_expected_neutron_intensity')
 
 bd     = observation_metadata(key)%bd
 vwclat = observation_metadata(key)%lattwat
@@ -509,11 +500,6 @@
 L3     = observation_metadata(key)%L3
 L4     = observation_metadata(key)%L4
 
-write(*,*)'TJH debug '
-write(*,*)bd, vwclat, N, alpha
-write(*,*)L1,L2,L3,L4
-write(*,*)
-
 !=================================================================================
 ! Determine the number of soil layers and their depths
 ! using only the standard DART interfaces to model
@@ -527,7 +513,7 @@
 nlevels = 0
 COUNTLEVELS : do i = 1,maxlayers
    loc = set_location(loc_lon, loc_lat, real(i,r8), VERTISLEVEL)
-   call model_interpolate(state,loc,KIND_GEOPOTENTIAL_HEIGHT,obs_val,istatus)
+   call model_interpolate(state,loc,KIND_GEOPOTENTIAL_HEIGHT,loc_value,istatus)
    if (istatus /= 0) exit COUNTLEVELS
    nlevels = nlevels + 1
 enddo COUNTLEVELS
@@ -553,7 +539,7 @@
    ! not checking this error code because it worked just a few lines earlier
 
    loc = set_location(loc_lon, loc_lat, layerz(i), VERTISHEIGHT)
-   call model_interpolate(state,loc,KIND_SOIL_MOISTURE,obs_val,istatus)
+   call model_interpolate(state,loc,KIND_SOIL_MOISTURE,loc_value,istatus)
 
    if (istatus /= 0) then
       write(string1,*) 'FAILED to determine soil moisture for layer',i
@@ -563,7 +549,7 @@
       return
    endif
 
-   soil_moisture(i) = obs_val
+   soil_moisture(i) = loc_value
 
 enddo FINDLEVELS
 
@@ -636,14 +622,6 @@
    zthick(i) = dz(i) - dz(i-1) ! Remaining layers
 enddo
 
-if ( 2 == 1 ) then ! TJH DEBUG OUTPUT BLOCK
-   iunit = open_file('cosmos_layers.txt',form='formatted',action='write')
-   do i = 1,nlyr
-      write(iunit,*)dz(i),vwc(i),zthick(i)
-   enddo
-   call close_file(iunit)
-endif
-
 ! Angle distribution parameters (HARDWIRED)
 !rr: Using 0.5 deg angle intervals appears to be sufficient
 !rr: (smaller angles increase the computing time for COSMIC)
@@ -736,27 +714,71 @@
 
 
 
-subroutine key_out_of_range(key, routine)
+subroutine key_within_range(key, routine)
 !----------------------------------------------------------------------
-! Make sure we are addrssing within the metadata arrays
+! Make sure we are addressing within the metadata arrays
 
 integer,          intent(in) :: key
 character(len=*), intent(in) :: routine
 
 ! fine -- no problem.
-if (key <= MAXcosmoskey) return
+if ((key > 0) .and. (key <= cosmoskey)) return
 
-! Bad news.  Tell the user.
-write(string1, *) 'key (',key,') exceeds Nmax_neutron_intensity (', MAXcosmoskey,')'
-write(string2, *) 'Increase MAXcosmoskey in namelist and rerun.'
-call error_handler(E_ERR,routine,string1,source,revision,revdate,text2=string2)
+! Bad news. Tell the user.
+write(string1, *) 'key (',key,') not within known range ( 1,', cosmoskey,')'
+call error_handler(E_ERR,routine,string1,source,revision,revdate)
 
-! FIXME ... reallocate and get on with it.
+end subroutine key_within_range
 
-end subroutine key_out_of_range
 
 
+subroutine grow_metadata(key, routine)
+!----------------------------------------------------------------------
+! If the allocatable metadata arrays are not big enough ... try again
 
+integer,          intent(in) :: key
+character(len=*), intent(in) :: routine
+
+integer :: i, orglength
+type(site_metadata), allocatable, dimension(:) :: safe_metadata
+
+! fine -- no problem.
+if ((key > 0) .and. (key <= MAXcosmoskey)) return
+
+orglength    =     MAXcosmoskey
+MAXcosmoskey = 2 * orglength
+
+! Check for some error conditions.
+if (key < 1) then
+   write(string1, *) 'key (',key,') must be >= 1'
+   call error_handler(E_ERR,routine,string1,source,revision,revdate)
+elseif (key >= 2*MAXcosmoskey) then
+   write(string1, *) 'key (',key,') really unexpected.'
+   write(string2, *) 'doubling storage will not help.'
+   call error_handler(E_ERR,routine,string1,source,revision,revdate, &
+                      text2=string2)
+endif
+
+! News. Tell the user we are increasing storage.
+write(string1, *) 'key (',key,') exceeds Nmax_neutron_intensity (',orglength,')'
+write(string2, *) 'Increasing Nmax_neutron_intensity to ',MAXcosmoskey
+call error_handler(E_MSG,routine,string1,source,revision,revdate,text2=string2)
+
+allocate(safe_metadata(orglength))
+safe_metadata(:) = observation_metadata(:)
+
+deallocate(observation_metadata)
+  allocate(observation_metadata(MAXcosmoskey))
+
+observation_metadata(1:orglength)              = safe_metadata(:)
+observation_metadata(orglength+1:MAXcosmoskey) = missing_metadata
+
+deallocate(safe_metadata)
+
+end subroutine grow_metadata
+
+
+
 end module obs_def_COSMOS_mod
 
 ! END DART PREPROCESS MODULE CODE

Modified: DART/branches/development/observations/COSMOS/COSMOS_level2_to_obs.f90
===================================================================
--- DART/branches/development/observations/COSMOS/COSMOS_level2_to_obs.f90	2012-10-29 20:01:07 UTC (rev 5906)
+++ DART/branches/development/observations/COSMOS/COSMOS_level2_to_obs.f90	2012-10-30 19:12:50 UTC (rev 5907)
@@ -83,12 +83,11 @@
 character(len=128) :: text_input_file = 'corcounts.txt'
 character(len=128) :: obs_out_file    = 'obs_seq.out'
 character(len=128) :: sitename        = 'missing'
-integer            :: year
 real(r8)           :: maxgoodqc       = 3
 logical            :: verbose         = .false.
 
 namelist /COSMOS_to_obs_nml/ site_metadata_file, text_input_file, &
-   obs_out_file, sitename, year, maxgoodqc, verbose
+   obs_out_file, sitename, maxgoodqc, verbose
 
 !-----------------------------------------------------------------------
 ! globally-scoped variables
@@ -179,7 +178,7 @@
 
 ! Read the COSMOS metadata/parameters for each site.
 ! These will be added to the metadata for neutron intensity observations.
-nSites   = read_cosmos_metadata(site_metadata_file)
+nSites   = read_site_metadata(site_metadata_file)
 siteIndx = find_site_index(sitename)
 bd       = cosmos_metadata(siteIndx)%bd
 lattwat  = cosmos_metadata(siteIndx)%lattwat
@@ -204,6 +203,14 @@
 
 call find_textfile_dims(text_input_file, max_obs)
 
+if (max_obs < 0) then
+   write (string1,*) '<'//trim(text_input_file)//'> does not exist.'
+   call error_handler(E_ERR,'main', string1, source, revision, revdate)
+elseif (max_obs < 2) then
+   write (string1,*) trim(text_input_file)//' has no observation values in it.'
+   call error_handler(E_ERR,'main', string1, source, revision, revdate)
+endif
+
 iunit = open_file(text_input_file, 'formatted', 'read')
 if (verbose) print *, 'opened input file ' // trim(text_input_file)
 
@@ -413,14 +420,14 @@
 
 
 
-  function read_cosmos_metadata(site_metadata_file)
+  function read_site_metadata(site_metadata_file)
 !----------------------------------------------------------------------------
-! nsites = read_cosmos_metadata(site_metadata_file)
+! nsites = read_site_metadata(site_metadata_file)
 !
 ! Read the list of parameters for every site we know about and
 ! return the number of sites we know about.
 
-integer                      :: read_cosmos_metadata
+integer                      :: read_site_metadata
 character(len=*), intent(in) :: site_metadata_file
 
 integer                               :: strlength
@@ -432,34 +439,34 @@
 
 if ( .not. file_exist(site_metadata_file) ) then
    write(string1,*) 'COSMIC parameter file [', trim(site_metadata_file),'] does not exist.'
-   call error_handler(E_ERR,'read_cosmos_metadata',string1,source,revision,revdate)
+   call error_handler(E_ERR,'read_site_metadata',string1,source,revision,revdate)
 endif
 
 call nc_check(nf90_open(site_metadata_file, NF90_NOWRITE, ncid), &
-                   'read_cosmos_metadata', 'open '//trim(site_metadata_file))
+                   'read_site_metadata', 'open '//trim(site_metadata_file))
 
 call nc_check(nf90_inq_dimid(ncid, 'nsites', dimIDs(1)), &
-                  'read_cosmos_metadata','inq_dimid nsites '//trim(site_metadata_file))
-call nc_check(nf90_inquire_dimension(ncid, dimIDs(1), len=read_cosmos_metadata), &
-                  'read_cosmos_metadata','inquire_dimension nsites '//trim(site_metadata_file))
+                  'read_site_metadata','inq_dimid nsites '//trim(site_metadata_file))
+call nc_check(nf90_inquire_dimension(ncid, dimIDs(1), len=read_site_metadata), &
+                  'read_site_metadata','inquire_dimension nsites '//trim(site_metadata_file))
 
 call nc_check(nf90_inq_dimid(ncid, 'strlength', dimIDs(2)), &
-                  'read_cosmos_metadata','inq_dimid strlength '//trim(site_metadata_file))
+                  'read_site_metadata','inq_dimid strlength '//trim(site_metadata_file))
 call nc_check(nf90_inquire_dimension(ncid, dimIDs(2), len=strlength), &
-                  'read_cosmos_metadata','inquire_dimension strlength '//trim(site_metadata_file))
+                  'read_site_metadata','inquire_dimension strlength '//trim(site_metadata_file))
 
 call nc_check(nf90_inq_varid(ncid, 'sitenames', VarID), &
-                 'read_cosmos_metadata','inq_varid sitenames '//trim(site_metadata_file))
+                 'read_site_metadata','inq_varid sitenames '//trim(site_metadata_file))
 
-allocate(cosmos_metadata(read_cosmos_metadata))
+allocate(cosmos_metadata(read_site_metadata))
 
-do isite = 1,read_cosmos_metadata
+do isite = 1,read_site_metadata
 
    sitename = ''
 
    write(string1,*)'get_var sitename site ',isite,' '//trim(site_metadata_file)
    call nc_check(nf90_get_var(ncid, VarID, sitename(1:strlength), &
-           start=(/1, isite/), count=(/strlength,1/)), 'read_cosmos_metadata', string1)
+           start=(/1, isite/), count=(/strlength,1/)), 'read_site_metadata', string1)
 
    cosmos_metadata(isite)%sitename = trim(sitename(1:strlength))
 
@@ -467,10 +474,10 @@
 
 enddo
 
-call nc_check(nf90_close(ncid), 'read_cosmos_metadata', 'close '//trim(site_metadata_file))
+call nc_check(nf90_close(ncid), 'read_site_metadata', 'close '//trim(site_metadata_file))
 
 if (verbose) then
-do isite = 1,read_cosmos_metadata
+do isite = 1,read_site_metadata
    write(*,*)
    write(*,*)'site name ',cosmos_metadata(isite)%sitename
    write(*,*)'longitude ',cosmos_metadata(isite)%longitude 
@@ -488,7 +495,7 @@
 enddo
 endif
 
-end function read_cosmos_metadata
+end function read_site_metadata
 
 
 
@@ -534,9 +541,9 @@
 start(1) = siteindx
 count(1) = 1
 
-call nc_check(nf90_inq_varid(ncid, varname, VarID), 'read_cosmos_metadata', 'inq_varid '//trim(varname))
+call nc_check(nf90_inq_varid(ncid, varname, VarID), 'read_site_metadata', 'inq_varid '//trim(varname))
 call nc_check(nf90_get_var(ncid, VarID, tempspace, start=start, count=count ), &
-                     'read_cosmos_metadata', 'get_var '//trim(varname))
+                     'read_site_metadata', 'get_var '//trim(varname))
 slot = tempspace(1)
 
 end subroutine get_var

Added: DART/branches/development/observations/COSMOS/COSMOS_level2_to_obs.html
===================================================================
--- DART/branches/development/observations/COSMOS/COSMOS_level2_to_obs.html	                        (rev 0)
+++ DART/branches/development/observations/COSMOS/COSMOS_level2_to_obs.html	2012-10-30 19:12:50 UTC (rev 5907)
@@ -0,0 +1,475 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+          "http://www.w3.org/TR/html4/strict.dtd">
+<HTML>
+<HEAD>
+<TITLE>program COSMOS_level2_to_obs</TITLE>
+<link rel="stylesheet" type="text/css" href="../../doc/html/doc.css">
+<link href="../../doc/html/dart.ico" rel="shortcut icon" />
+</HEAD>
+<BODY>
+<A NAME="TOP"></A>
+
+<H1>PROGRAM <em class=program>COSMOS_level2_to_obs</em></H1>
+
+<table border=0 summary="" cellpadding=5>
+<tr>
+    <td valign=middle>
+    <img src="../../doc/html/Dartboard7.png" alt="DART project logo" height=70 />
+    </td>
+    <td>
+       <P>Jump to <a href="../../index.html">DART Documentation Main Index</a><br />
+          <small><small>version information for this file: <br />
+          <!-- version tag follows, do not edit -->
+          $Id$</small></small>
+       </P></td>
+</tr>
+</table>
+
+<A HREF="#DataSources">DATA SOURCES</A> /
+<A HREF="#Programs">PROGRAMS</A> /
+<A HREF="#Namelist">NAMELIST</A> /
+<A HREF="#References">REFERENCES</A> /
+<A HREF="#Errors">ERRORS</A> /
+<A HREF="#FuturePlans">PLANS</A> / 
+<A HREF="#Legalese">TERMS OF USE</A>
+
+<H1>Overview</H1>
+
+<H4>COSMOS "Level 2" Text File to DART Converter</H4>
+
+<P>
+<a href="http://cosmos.hwr.arizona.edu/">COSMOS</a> is an NSF supported 
+project to measure soil moisture on the horizontal scale of hectometers 
+and depths of decimeters using cosmic-ray neutrons.
+The data for each station is available from the COSMOS data portal with 
+several levels of processing. The metadata for each station 
+(location, height, etc) is also available from the data portal.
+The <b>Level 2 Data</b> is most suited for use with DART.
+<br />
+<br />
+Since each site has a separate input data file, and the metadata for
+each site must essentially be hand-input to the converter program, it is
+generally easiest to convert the observations for each site separately
+and then use the <a href="../../obs_sequence/obs_sequence_tool.html">
+obs_sequence_tool.f90</a> to combine the observations from multiple sites
+and restrict the DART observation sequence file to contain just the 
+observations of the timeframe of interest.
+<br />
+<br />
+FYI - in DART, the soil moisture profile is converted to expected neutron counts using 
+the <b>CO</b>smic-ray <b>S</b>oil <b>M</b>oisture <b>I</b>nteraction <b>C</b>ode (COSMIC),
+developed at the University of Arizona by Rafael Rosolem and Jim Shuttleworth.
+<br />
+<br />
+The workflow is usually: 
+</P>
+<ol>
+<li><a href="http://cosmos.hwr.arizona.edu/Probes/probemap.php">get the site metadata</a>
+    and enter it in the <em class=file>input.nml</em>
+    <em class=input>&amp;COSMOS_to_obs_nml</em></li>
+
+<li>download the Level 2 Data and prefix the filename with the station name (or else they
+    all get named <em class=file>corcounts.txt</em>)
+    and enter the filename into <em class=input>&amp;COSMOS_to_obs_nml</em></li>
+
+<li>make sure the station soil parameters and COSMIC parameters are contained in the 
+    <em class=file>observations/COSMOS/data/COSMIC_parlist.nc</em>
+    (more on this in <a href="#COSMICparameters">the section on COSMIC parameters</a>)</li>
+
+<li>run <em class=program>COSMOS_level2_to_obs</em> to generate a DART observation sequence 
+    file for the station and rename the output file if necessary
+    (you can explicity name the output file via the namelist).</li>
+
+<li>repeat steps 1-4 for this converter to generate a DART observation sequence 
+    file for each station.</li>
+
+<li>use the <a href="../../obs_sequence/obs_sequence_tool.html">obs_sequence_tool.f90</a> 
+    to combine the observations from multiple sites</li>
+</ol>
+
+
+<!--==================================================================-->
+
+<A NAME="DataSources"></A>
+<div class="top">[<a href="#">top</a>]</div><hr />
+<H2>DATA SOURCES</H2>
+
+<P>
+The COSMOS data portal can be found at:
+<a href="http://cosmos.hwr.arizona.edu/Probes/probemap.php">
+http://cosmos.hwr.arizona.edu/Probes/probemap.php</a>
+The data for each station is available from the data portal with several
+levels of processing. The metadata for each station (location, height, etc) is also
+available from the data portal. The <b>Level 2 Data</b> is most suited for use with DART.
+An example of the Level 2 Data follows:
+</P>
+<pre>
+YYYY-MM-DD HH:MM  MOD PROBE PRESS  SCALE SANPE INTEN OTHER CORR ERR
+2009-10-23 18:34 5996 0.800 1.087 06.901 2.486 1.062 1.000 1768 022
+2009-10-23 19:34 5885 0.800 1.080 06.901 2.486 1.059 1.000 1729 022
+2009-10-23 20:34 6085 0.800 1.072 06.901 2.486 1.059 1.000 1774 022
+2009-10-23 21:34 6339 0.800 1.068 06.901 2.486 1.059 1.000 1843 023
+...
+</pre>
+
+<!--==================================================================-->
+
+<A NAME="Programs"></A>
+<div class="top">[<a href="#">top</a>]</div><hr />
+<H2>PROGRAMS</H2>
+<P>
+The <em class=file>COSMOS_level2_to_obs.f90</em> file is the source code
+for the main converter program.
+At present there is an uncomfortable assumption that the order of the columns
+in the Level 2 data is fixed. I hope to relax that requirement in the near future.
+<em class=program>COSMOS_level2_to_obs</em>
+reads each text line into a character buffer
+and then reads from that buffer to parse up the data items.
+The items are then combined with the COSMIC parameters for that site 
+and written to a DART-format observation sequence file. The DART format
+allows for the additional COSMIC parameters to be contained as metadata for
+each observation.
+</P>
+<P>
+To compile and test, go into the <em class=file>COSMOS/work</em> subdirectory and 
+run the <em class=program>quickbuild.csh</em>
+script to build the converter and a couple of general purpose utilities.
+The <a href="../../obs_sequence/obs_sequence_tool.html">obs_sequence_tool</a>
+manipulates (i.e. combines, subsets) DART observation files once they have been created.
+The default observations supported are those defined in 
+<a href="../../obs_def/obs_def_tower_mod.f90">DART/obs_def/obs_def_tower_mod.f90</a> and
+<a href="../../obs_def/obs_def_COSMOS_mod.f90">DART/obs_def/obs_def_COSMOS_mod.f90</a>.
+If you need additional observation types, you will have to add the 
+appropriate <em class=file>obs_def_XXX_mod.f90</em> file to the
+<em class=file>input.nml</em>&nbsp;<em class=code>&amp;preprocess_nml:input_files</em>
+variable and run <em class=program>quickbuild.csh</em> again.
+It rebuilds the table of supported observation types before 
+compiling the source code.
+</P>
+
+<A NAME="COSMICparameters"></A>
+<div class=indent1>
+<H3>COSMIC parameters</H3>
+<P>
+Additional information is needed by DART to convert soil moisture profiles
+to neutron counts. Each COSMOS instrument has site-specific parameters 
+describing soil properties etc. Those parameters have been inserted into
+the observation file as metadata for each observation to simplify the 
+DART observation operator.
+It is a bit redundant as currently implemented, but it is convenient.
+<br />
+<br />
+<em class=program>COSMOS_level2_to_obs</em> reads the site name from
+the input namelist and the known station information from 
+<em class=file>COSMIC_parlist.nc</em>. The simplest way to add a new station to
+<em class=file>COSMIC_parlist.nc</em> is probably to:
+</P>
+<ol><li>manually enter the information into the "data" section of 
+        <em class=file>COSMIC_parlist_station.txt</em></li>
+    <li>then use <em class=program>ncgen</em> to convert 
+        <em class=file>COSMIC_parlist_station.txt</em> to a netCDF file.</li>
+    <li>That netCDF file can be concatenated onto <em class=file>COSMIC_parlist.nc</em>
+        with a simple <em class=program>ncrcat</em> command.</li>
+</ol>
+<P>
+Listing the sites already supported is easy:
+</P>
+<div class=unix>
+<pre>
+observations/COSMOS/data % <em class=input>ncdump -v sitenames COSMIC_parlist.nc</em>
+netcdf COSMIC_parlist {
+dimensions:
+        nsites = UNLIMITED ; // (42 currently)
+        strlength = 21 ;
+variables:
+        char sitenames(nsites, strlength) ;
+                sitenames:long_name = "COSMOS Site Names" ;
+        double longitude(nsites) ;
+                longitude:long_name = "Longitude" ;
+                longitude:units = "degrees" ;
+        double latitude(nsites) ;
+                latitude:long_name = "Latitude" ;
+                latitude:units = "degrees" ;
+        double elevation(nsites) ;
+                elevation:long_name = "Elevation" ;
+                elevation:units = "m" ;
+        double bd(nsites) ;
+                bd:long_name = "Dry Soil Bulk Density" ;
+                bd:units = "g cm{-3}" ;
+        double lattwat(nsites) ;
+                lattwat:long_name = "Lattice Water Content" ;
+                lattwat:units = "m{3} m{-3}" ;
+        double N(nsites) ;
+                N:long_name = "High Energy Neutron Intensity" ;
+                N:units = "relative counts" ;
+        double alpha(nsites) ;
+                alpha:long_name = "Ratio of Fast Neutron Creation Factor (Soil to Water)" ;
+                alpha:units = "-" ;
+        double L1(nsites) ;
+                L1:long_name = "High Energy Soil Attenuation Length" ;
+                L1:units = "g cm{-2}" ;
+        double L2(nsites) ;
+                L2:long_name = "High Energy Water Attenuation Length" ;
+                L2:units = "g cm{-2}" ;
+        double L3(nsites) ;
+                L3:long_name = "Fast Neutron Soil Attenuation Length" ;
+                L3:units = "g cm{-2}" ;
+        double L4(nsites) ;
+                L4:long_name = "Fast Neutron Water Attenuation Length" ;
+                L4:units = "g cm{-2}" ;
+
+// global attributes:
+                :website = "COsmic-ray Soil Moisture Observing System (COSMOS) - 
+                            http://cosmos.hwr.arizona.edu" ;
+data:
+
+ sitenames =
+  "ARM-1                ",
+  "Austin_Cary          ",
+  "Bondville            ",
+  "Brookings            ",
+  "Chestnut_Ridge_NOAA  ",
+  "Coastal_Sage_UCI     ",
+  "Daniel_Forest        ",
+  "Desert_Chaparral_UCI ",
+  "Fort_Peck            ",
+  "Harvard_Forest       ",
+  "Hauser_Farm_North    ",
+  "Hauser_Farm_South    ",
+  "Howland              ",
+  "Iowa_Validation_Site ",
+  "Island_Dairy         ",
+  "JERC                 ",
+  "Kendall              ",
+  "KLEE                 ",
+  "Manitou_Forest_Ground",
+  "Metolius             ",
+  "Morgan_Monroe        ",
+  "Mozark               ",
+  "Mpala_North          ",
+  "Neb_Field_3          ",
+  "P301                 ",
+  "Park_Falls           ",
+  "Pe-de-Gigante        ",
+  "Rancho_No_Tengo      ",
+  "Reynolds_Creek       ",
+  "Rietholzbach         ",
+  "Rosemount            ",
+  "San_Pedro_2          ",
+  "Santa_Rita_Creosote  ",
+  "Savannah_River       ",
+  "Silver_Sword         ",
+  "SMAP-OK              ",
+  "Soaproot             ",
+  "Sterling             ",
+  "Tonzi_Ranch          ",
+  "UMBS                 ",
+  "UVA                  ",
+  "Wind_River           " ;
+}
+</pre>
+</div>
+
+<P>The observation sequence files will look something like the following,
+the attributes in yellow are the information from <em class=file>COSMIC_parlist.nc</em>:
+</P>
+
+<div class=unix>
+<pre>
+ obs_sequence
+obs_kind_definitions
+           1
+          20 COSMOS_NEUTRON_INTENSITY
+  num_copies:            1  num_qc:            1
+  num_obs:         3840  max_num_obs:         3840
+observation
+COSMOS QC
+  first:            1  last:         3840
+ OBS            1
+   1048.0000000000000
+   1.0000000000000000
+          -1           2          -1
+obdef
+loc3d
+     4.154723123116714        0.7997185899100618         0.000000000000000     -1
+kind
+          20
+<div style="color: yellow"> cosmic
+  0.88500000000000001       5.84099999999999966E-002   336.95696938999998       0.31918025877000000
+   161.98621864285701        129.14558984999999        55.311849408000000        3.8086191933000002
+           1</div>
+ 77340     150034
+   1225.0000000000000
+   ...
+</pre>
+</div>
+</div><!-- end of block indent -->
+<P></P><!-- needed to make 'top' align correctly -->
+
+<!--==================================================================-->
+<!--=================== DESCRIPTION OF A NAMELIST  ===================-->
+<!--==================================================================-->
+
+<A NAME="Namelist"></A>
+<div class="top">[<a href="#">top</a>]</div><hr />
+<H2>NAMELIST</H2>
+<P>We adhere to the F90 standard of starting a namelist with an ampersand
+'&amp;' and terminating with a slash '/' for all our namelist input.
+Consider yourself forewarned that character strings that contain a '/' must be
+enclosed in quotes to prevent them from prematurely terminating the namelist.
+</P>
+<div class=namelist><pre>
+<em class=call>namelist /COSMOS_to_obs_nml/ </em> site_metadata_file, &amp;
+          text_input_file, obs_out_file, sitename, maxgoodqc, verbose
+</pre>
+</div>
+
+<div class=indent1>
+<!-- Description -->
+
+<P>This namelist is read in a file called <em class=file>input.nml</em>.
+</P>
+
+<TABLE border=0 cellpadding=3 width=100%>
+<TR><TH align=left>Contents    </TH>
+    <TH align=left>Type        </TH>
+    <TH align=left>Description </TH></TR>
+
+<TR><!--contents--><TD valign=top>site_metadata_file</TD>
+    <!--  type  --><TD valign=top>character(len=256)</TD>
+    <!--descript--><TD valign=top>The netCDF file containing the 
+                       parameter values for each site.<br \>
+                       <em class=units>[default:&nbsp;'COSMIC_parlist.nc']</em>
+                       </TD></TR>
+
+<TR><!--contents--><TD valign=top>text_input_file</TD>
+    <!--  type  --><TD valign=top>character(len=128)</TD>
+    <!--descript--><TD valign=top>The text file containing the 
+                       raw observations for each site.<br \>
+                       <em class=units>[default:&nbsp;'corcounts.txt']</em>
+                       </TD></TR>
+
+<TR><!--contents--><TD valign=top>obs_out_file</TD>
+    <!--  type  --><TD valign=top>character(len=128)</TD>
+    <!--descript--><TD valign=top>The observation sequence file 
+                       for DART.<br \>
+                       <em class=units>[default:&nbsp;'obs_seq.out']</em>
+                       </TD></TR>
+
+<TR><!--contents--><TD valign=top>sitename</TD>
+    <!--  type  --><TD valign=top>character(len=128)</TD>
+    <!--descript--><TD valign=top>The name of the site. Must match one of the 
+                       site names in <em class=code>site_metadata_file</em>.
+                       Case-insensitive match, trailing blanks ignored.<br />Use
+                       <em class=input>ncdump&nbsp;-v&nbsp;sitenames&nbsp;COSMIC_parlist.nc</em><br \>
+                       <em class=units>[default:&nbsp;'missing']</em>
+                       </TD></TR>
+
+<TR><!--contents--><TD valign=top>maxgoodqc</TD>
+    <!--  type  --><TD valign=top>integer</TD>
+    <!--descript--><TD valign=top>left for future implementation.
+                       <em class=units>[default: 3]</em>
+                       </TD></TR>
+
+<TR><!--contents--><TD valign=top>verbose</TD>
+    <!--  type  --><TD valign=top>logical</TD>
+    <!--descript--><TD valign=top>The switch to specify the run-time output.
+                       <em class=code>.true.</em> the most amount of output.
+                       <em class=code>.false.</em> the least amount of output.
+                       <em class=units>[default:&nbsp;.false.]</em>
+                       </TD></TR>
+
+</TABLE>
+
+<H3 class=indent1>Example</H3>
+
+<pre>
+&amp;COSMOS_to_obs_nml
+   site_metadata_file = 'COSMIC_parlist.nc',
+   text_input_file    = 'SantaRita_corcounts.txt',
+   obs_out_file       = 'SantaRita_obs_seq.out',
+   sitename           = 'Santa_Rita_Creosote',
+</pre>
+
+</div><!-- end of indent1 -->
+
+<!--==================================================================-->
+<!-- References.                                                      -->
+<!--==================================================================-->
+
+<A NAME="References"></A>
+<div class="top">[<a href="#">top</a>]</div><hr />
+<H2>References</H2>
+<ul>
+<li><a href="http://cosmos.hwr.arizona.edu">The COSMOS web page.</a></li>
+
+<li>Franz, T.E, M. Zreda, T.P.A. Ferre, R. Rosolem, C. Zweck, S. Stillman, 
+    X. Zeng and W.J. Shuttleworth, 2012: Measurement depth of the cosmic-ray 
+    soil moisture probe affected by hydrogen from various sources.
+    <span style="font-style: italic;"> Water Resources Research</span>
+    <span style="font-weight: bold;">48</span>, W08515, 
+    <a href="http://dx.doi.org/10.1029/2012WR011871">doi:10.1029/2012WR011871</a>
+    </li>
+
+<li>Franz, T.E, M. Zreda, R. Rosolem, T.P.A. Ferre, 2012: 
+    Field validation of cosmic-ray soil moisture probe using a distributed sensor network.
+    <span style="font-style: italic;">Vadose Zone Journal</span> (in press), 
+    <a href="http://dx.doi.org/10.2136/vzj2012.0046">doi:10.2136/vzj2012.0046</a>
+    </li>
+</ul>
+
+<!--==================================================================-->
+<!-- Describe the bugs.                                               -->
+<!--==================================================================-->
+
+<A NAME="KnownBugs"></A>
+<div class="top">[<a href="#">top</a>]</div><hr />
+<H2>KNOWN BUGS</H2>
+<P>
+none
+</P>
+
+<!--==================================================================-->
+<!-- Describe Future Plans.                                           -->
+<!--==================================================================-->
+
+<A NAME="FuturePlans"></A>
+<div class="top">[<a href="#">top</a>]</div><hr />
+<H2>FUTURE PLANS</H2>
+<ul>
+<li>Implement a routine to automatically determine the column indices of
+the columns of interest.</li>
+<li>Implement a QC encoding that reflects the uncertainty of the measurement. 
+Presently, all Level 2 data have an incoming QC of 1.</li>
+</ul>
+<P>
+</P>
+
+<!--==================================================================-->
+<!-- Legalese & Metadata                                              -->
+<!--==================================================================-->
+
+<A NAME="Legalese"></A>
+<div class="top">[<a href="#">top</a>]</div><hr />
+<H2>Terms of Use</H2>
+
+<P>
+DART software - Copyright 2004 - 2011 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">
+http://www.image.ucar.edu/DAReS/DART/DART_download</a>
+</P>
+
+<TABLE border=0 cellpadding=0 width=100% summary="">
+<TR><TD valign=top>Contact:       </TD><TD> Tim Hoar </TD></TR>
+<TR><TD valign=top>Revision:      </TD><TD> $Revision$ </TD></TR>
+<TR><TD valign=top>Source:        </TD><TD> $URL$ </TD></TR>
+<TR><TD valign=top>Change Date:   </TD><TD> $Date$ </TD></TR>
+<TR><TD valign=top>Change&nbsp;history:&nbsp;</TD><TD> try "svn&nbsp;log" or "svn&nbsp;diff" </TD></TR>
+</TABLE>
+
+<!--==================================================================-->
+
+</BODY>
+</HTML>


Property changes on: DART/branches/development/observations/COSMOS/COSMOS_level2_to_obs.html
___________________________________________________________________
Added: svn:mime-type
   + text/html
Added: svn:keywords
   + Date Rev Author HeadURL Id
Added: svn:eol-style
   + native

Added: DART/branches/development/observations/COSMOS/data/COSMIC_parlist.nc
===================================================================
(Binary files differ)


Property changes on: DART/branches/development/observations/COSMOS/data/COSMIC_parlist.nc
___________________________________________________________________
Added: svn:mime-type
   + application/x-netcdf

Modified: DART/branches/development/observations/COSMOS/work/input.nml
===================================================================
--- DART/branches/development/observations/COSMOS/work/input.nml	2012-10-29 20:01:07 UTC (rev 5906)
+++ DART/branches/development/observations/COSMOS/work/input.nml	2012-10-30 19:12:50 UTC (rev 5907)
@@ -3,7 +3,7 @@
    output_obs_kind_mod_file = '../../../obs_kind/obs_kind_mod.f90',
      input_obs_def_mod_file = '../../../obs_def/DEFAULT_obs_def_mod.F90',
     output_obs_def_mod_file = '../../../obs_def/obs_def_mod.f90',
-   input_files              = '../../../obs_def/obs_def_tower_mod.f90'
+   input_files              = '../../../obs_def/obs_def_tower_mod.f90',
                               '../../../obs_def/obs_def_COSMOS_mod.f90'
    /
 
@@ -25,12 +25,24 @@
 
 &COSMOS_to_obs_nml
    site_metadata_file = '../data/COSMIC_parlist.nc',
-   text_input_file    = '../data/corcounts.txt',
-   obs_out_file       = 'obs_seq.out',
-   sitename           = 'wind_river',
+   text_input_file    = '../data/SantaRita.corcounts.txt',
+   obs_out_file       = 'SantaRita.obs_seq.out',
+   sitename           = 'Santa_Rita_Creosote',
    maxgoodqc          =    1,
    verbose            = .TRUE.
    /
 
 # For COSMOS_level2_to_obs, the filename is data/corcounts.txt
 # For COSMOS_to_obs,        the filename is data/COSMOS_SantaRita_2011.dat
+
+&obs_sequence_tool_nml
+   filename_seq         = 'Austin_Cary.obs_seq.out', 'SantaRita.obs_seq.out',
+   filename_out         = 'obs_seq.combined',
+   filename_seq_list    = '',
+   num_input_files      = 2,
+   first_obs_days       = -1,
+   first_obs_seconds    = -1,
+   last_obs_days        = -1,
+   last_obs_seconds     = -1 
+   /
+


More information about the Dart-dev mailing list