[Dart-dev] DART/branches Revision: 11931

dart at ucar.edu dart at ucar.edu
Fri Sep 8 11:07:56 MDT 2017


thoar at ucar.edu
2017-09-08 11:07:55 -0600 (Fri, 08 Sep 2017)
460
The converter reads the lookup table from I-Te, and we removed the 
scaled height method of determining the observation error variances as per
email with I-Te.  There is a problem using the lookup table - turn on 
array bounds checking and things get references outside array bounds.
Changed the ionprf_obserr_percent() routine to use the native height
units of km, consistent with the heights in the cosmic data files.
Unrelated to the array bounds problem.




Modified: DART/branches/rma_trunk/observations/obs_converters/gps/convert_cosmic_ionosphere.f90
===================================================================
--- DART/branches/rma_trunk/observations/obs_converters/gps/convert_cosmic_ionosphere.f90	2017-09-08 15:49:07 UTC (rev 11930)
+++ DART/branches/rma_trunk/observations/obs_converters/gps/convert_cosmic_ionosphere.f90	2017-09-08 17:07:55 UTC (rev 11931)
@@ -46,7 +46,7 @@
 use      utilities_mod, only : initialize_utilities, find_namelist_in_file,      &
                                check_namelist_read, nmlfileunit, do_nml_file,    &
                                get_next_filename, error_handler, E_ERR, E_MSG,   &
-                               nc_check, find_textfile_dims, do_nml_term,        &
+                               find_textfile_dims, do_nml_term,                  &
                                to_upper, open_file, finalize_utilities
 use       location_mod, only : VERTISHEIGHT, set_location
 use   obs_sequence_mod, only : obs_sequence_type, obs_type, read_obs_seq,        &
@@ -62,6 +62,8 @@
 use  obs_utilities_mod, only : add_obs_to_seq
 use       obs_kind_mod, only : COSMIC_ELECTRON_DENSITY
 
+use netcdf_utilities_mod, only : nc_check, nc_get_variable
+
 use netcdf
 
 implicit none
@@ -77,7 +79,6 @@
 integer, parameter :: METHOD_SCALED        = 2   !> = 'scaled'
 integer, parameter :: METHOD_LOOKUP        = 3   !> = 'lookup'
 integer, parameter :: METHOD_SCALED_LOOKUP = 4   !> = 'scaled_lookup'
-integer, parameter :: METHOD_SCALED_HEIGHT = 5   !> = 'scaled_height'
 integer            :: method
 
 character (len=512) :: string1, string2, string3
@@ -103,6 +104,8 @@
 integer :: existing_num_copies  ! number of copies in existing sequence
 integer :: existing_num_qc      ! number of QC entries in existing sequence
 
+character(len=512) :: hght_units  ! should be long enough
+
 !------------------------------------------------------------------------
 !  Declare namelist parameters
 !------------------------------------------------------------------------
@@ -280,10 +283,11 @@
    call nc_check( nf90_inq_varid(ncid, "GEO_lon", varid) ,'inq varid GEO_lon', next_infile)
    call nc_check( nf90_get_var(ncid, varid, lon)         ,'get var   GEO_lon', next_infile)
    
-   ! read the altitude array
+   ! read the altitude array  - could check that units are 'km'
    call nc_check( nf90_inq_varid(ncid, "MSL_alt", varid) ,'inq varid MSL_alt', next_infile)
    call nc_check( nf90_get_var(ncid, varid, hght)        ,'get_var   MSL_alt', next_infile)
    call nc_check( nf90_get_att(ncid, varid, '_FillValue', hght_miss) ,'get_att _FillValue MSL_alt', next_infile)
+   call nc_check( nf90_get_att(ncid, varid, 'units', hght_units) ,'get_att units MSL_alt', next_infile)
    
    ! read the electron density
    call nc_check( nf90_inq_varid(ncid, "ELEC_dens", varid) ,'inq varid ELEC_dens', next_infile)
@@ -490,17 +494,16 @@
 !-----------------------------------------------------------------------
 !> computes the observation error given a variety of algorithms
 !>
-!> METHOD_CONSTANT          oerr = factor
-!> METHOD_SCALED            oerr = factor * obsval
-!> METHOD_LOOKUP            oerr = f(solar local time, magnetic equator latitude ...)
-!> METHOD_SCALED_LOOKUP     oerr = factor * f(solar local time, ...) * obsval
-!> METHOD_SCALED_HEIGHT     oerr = 30000 - abs(factor*hghto - 30000)
+!> METHOD_CONSTANT          percent = factor
+!> METHOD_SCALED            percent = factor * obsval
+!> METHOD_LOOKUP            percent = f(solar local time, magnetic equator latitude ...)
+!> METHOD_SCALED_LOOKUP     percent = factor * f(solar local time, ...) * obsval
 
 function electron_density_error(lon, lat, hght, ihour, imin, method, factor, obsval)
 
 real(r8), intent(in)  :: lon     !> input real value geometric height [km]
 real(r8), intent(in)  :: lat     !> latitude in degrees
-real(r8), intent(in)  :: hght    !> is model global or regional?
+real(r8), intent(in)  :: hght    !> height of observation
 integer,  intent(in)  :: ihour   !> hour of day ... UTC
 integer,  intent(in)  :: imin    !> minute of day ... UTC
 integer,  intent(in)  :: method  !> integer describing algorithm
@@ -520,12 +523,6 @@
    return
 endif
 
-if (method == METHOD_SCALED_HEIGHT) then
-   ! TJH - I have no idea where this comes from
-   electron_density_error = 30000.0_r8 - abs(hght*0.105_r8 - 30000.0_r8)
-   return
-endif
-
 ! The lookup table is read once in ionprf_obserr_percent().
 percent = ionprf_obserr_percent(lon, lat, hght, ihour, imin)
 
@@ -554,21 +551,23 @@
 
 real(r8), intent(in) ::  lone  !> longitude of electron density observation
 real(r8), intent(in) ::  late  !> latitude of electron density observation
-real(r8), intent(in) :: hghte  !> height of electron density observation
+real(r8), intent(in) :: hghte  !> height of electron density observation (in km)
 integer,  intent(in) :: houre  !> UTC hour of day
 integer,  intent(in) ::  mine  !> UTC minute of hour
 
+character(len=*), parameter :: routine = 'ionprf_obserr_percent'
+
 !add F3/C ionprf observation error /add by ITL 2011.01.31
 integer, parameter :: NUMZ   = 15


More information about the Dart-dev mailing list