anchor.diff:              call check( nf90_put_att(ncid,temp_id,"units","kg m-2"))
               varid(31)=temp_id
               
  -            ! diagnosed surface fields (e.g. T2m, U10)
  -            call check( nf90_def_var(ncid, "ta2m", NF90_REAL, dimtwo_time, temp_id), trim(err)//"ta2m" )
  -            call check( nf90_put_att(ncid,temp_id,"standard_name","air_temperature"))
  -            call check( nf90_put_att(ncid,temp_id,"long_name","Bulk air temperature at 2m"))
  -            call check( nf90_put_att(ncid,temp_id,"units","K"))
  -            varid(34)=temp_id
  -
  -            call check( nf90_def_var(ncid, "hus2m", NF90_REAL, dimtwo_time, temp_id), trim(err)//"hus2m" )
  -            call check( nf90_put_att(ncid,temp_id,"standard_name","specific_humidity"))
  -            call check( nf90_put_att(ncid,temp_id,"long_name","Bulk air specific humidity at 2m"))
  -            call check( nf90_put_att(ncid,temp_id,"units","kg kg-1"))
  -            varid(35)=temp_id
  -        endif
  -        
  -        call check( nf90_def_var(ncid, "u10m", NF90_REAL, dimtwo_time, temp_id), trim(err)//"u10m" )
  -        call check( nf90_put_att(ncid,temp_id,"standard_name","eastward_10m_wind_speed"))
  -        call check( nf90_put_att(ncid,temp_id,"long_name","Eastward wind speed at 2m"))
  -        call check( nf90_put_att(ncid,temp_id,"units","m s-1"))
  -        varid(36)=temp_id
  -        
  -        call check( nf90_def_var(ncid, "v10m", NF90_REAL, dimtwo_time, temp_id), trim(err)//"v10m" )
  -        call check( nf90_put_att(ncid,temp_id,"standard_name","northward_10m_wind_speed"))
  -        call check( nf90_put_att(ncid,temp_id,"long_name","Northward wind speed at 2m"))
  -        call check( nf90_put_att(ncid,temp_id,"units","m s-1"))
  -        varid(37)=temp_id
  -        
  -        
  +        endif
           
           ! End define mode. This tells netCDF we are done defining metadata.
           call check( nf90_enddef(ncid) )
  
positive.code:             call check( nf90_put_att(ncid,temp_id,"units","W m-2"))
              varid(19)=temp_id
          endif
          
          ! these should only be output for lsm packages that compute them
          if (options%physics%landsurface==kLSM_NOAH) then
  
negative.code:         if (options%physics%radiation==kRA_SIMPLE) then
              call check( nf90_put_var(ncid, varid(22), domain%cloudfrac,  start_two_D ), trim(filename)//":cloudfrac" )
          endif
          
          call check( nf90_put_var(ncid, varid(28), domain%skin_t,       start_two_D),  trim(filename)//":skin_t" )
          call check( nf90_put_var(ncid, varid(34), domain%T2m, start_two_D),  trim(filename)//":t2m" )
          call check( nf90_put_var(ncid, varid(35), domain%Q2m, start_two_D),  trim(filename)//":hus2m" )
          call check( nf90_put_var(ncid, varid(36), domain%u10, start_two_D),  trim(filename)//":u10m" )
          call check( nf90_put_var(ncid, varid(37), domain%v10, start_two_D),  trim(filename)//":v10m" )
          call check( nf90_put_var(ncid, varid(23), domain%sensible_heat,start_two_D),  trim(filename)//":sensible_heat" )
          call check( nf90_put_var(ncid, varid(24), domain%latent_heat,  start_two_D),  trim(filename)//":latent_heat" )
          ! these should only be output for lsm packages that compute them
          if (options%physics%landsurface==kLSM_NOAH) then
              call check( nf90_put_var(ncid, varid(25), domain%ground_heat,  start_two_D),  trim(filename)//":ground_heat" )
              call check( nf90_put_var(ncid, varid(26), domain%soil_vwc,     start_three_D),trim(filename)//":soil_vwc" )
              call check( nf90_put_var(ncid, varid(27), domain%soil_t,       start_three_D),trim(filename)//":soil_t" )
              call check( nf90_put_var(ncid, varid(29), domain%lwup,         start_two_D),  trim(filename)//":lwup" )
              call check( nf90_put_var(ncid, varid(30), domain%snow_swe,     start_two_D),  trim(filename)//":snow_swe" )
              call check( nf90_put_var(ncid, varid(31), domain%canopy_water, start_two_D),  trim(filename)//":canopy_water" )
          endif
          
          last_rain=domain%rain
          ! Close the file, freeing all resources.
  