[Dart-dev] [4308] DART/trunk/obs_def: Change the name of the last argument to read/ write to match the
nancy at ucar.edu
nancy at ucar.edu
Wed Mar 10 13:22:22 MST 2010
Revision: 4308
Author: nancy
Date: 2010-03-10 13:22:22 -0700 (Wed, 10 Mar 2010)
Log Message:
-----------
Change the name of the last argument to read/write to match the
updated DEFAULT obs_def code. Also, remove the ascii_file_format()
subroutine from the obs_def_radar_mod, since it moved into utilities_mod.
Modified Paths:
--------------
DART/trunk/obs_def/obs_def_1d_state_mod.f90
DART/trunk/obs_def/obs_def_radar_mod.f90
-------------- next part --------------
Modified: DART/trunk/obs_def/obs_def_1d_state_mod.f90
===================================================================
--- DART/trunk/obs_def/obs_def_1d_state_mod.f90 2010-03-10 18:53:04 UTC (rev 4307)
+++ DART/trunk/obs_def/obs_def_1d_state_mod.f90 2010-03-10 20:22:22 UTC (rev 4308)
@@ -19,12 +19,12 @@
! BEGIN DART PREPROCESS READ_OBS_DEF
! case(RAW_STATE_1D_INTEGRAL)
-! call read_1d_integral(obs_def%key, ifile, fileformat)
+! call read_1d_integral(obs_def%key, ifile, fform)
! END DART PREPROCESS READ_OBS_DEF
! BEGIN DART PREPROCESS WRITE_OBS_DEF
! case(RAW_STATE_1D_INTEGRAL)
-! call write_1d_integral(obs_def%key, ifile, fileformat)
+! call write_1d_integral(obs_def%key, ifile, fform)
! END DART PREPROCESS WRITE_OBS_DEF
! BEGIN DART PREPROCESS INTERACTIVE_OBS_DEF
@@ -42,7 +42,8 @@
! $Date$
use types_mod, only : r8
-use utilities_mod, only : register_module, error_handler, E_ERR, E_MSG
+use utilities_mod, only : register_module, error_handler, E_ERR, E_MSG, &
+ ascii_file_format
use location_mod, only : location_type, set_location, get_location
use assim_model_mod, only : interpolate
use cov_cutoff_mod, only : comp_cov_factor
@@ -92,40 +93,40 @@
character(len=32), intent(in) :: fileformat
integer :: i
+logical :: is_ascii
if ( .not. module_initialized ) call initialize_module
+is_ascii = ascii_file_format(fileformat)
+
! Philosophy, dump ALL information about this special obs_type at once???
! For now, this means you can only write ONCE (that's all we're doing 3 June 05)
! Toggle the flag to control this writing
if(.not. already_written) then
already_written = .true.
! Write out the number of 1d_integral obs descriptions
- SELECT CASE (fileformat)
- CASE ("unf", "UNF", "unformatted", "UNFORMATTED")
- write(ifile) num_1d_integral_obs
- CASE DEFAULT
- write(ifile, *) num_1d_integral_obs
- END SELECT
+ if (is_ascii) then
+ write(ifile, *) num_1d_integral_obs
+ else
+ write(ifile) num_1d_integral_obs
+ endif
! Write out the half_width, num_points, and localization_type for each
do i = 1, num_1d_integral_obs
- SELECT CASE (fileformat)
- CASE ("unf", "UNF", "unformatted", "UNFORMATTED")
- write(ifile) half_width(i), num_points(i), localization_type(i)
- CASE DEFAULT
- write(ifile, *) half_width(i), num_points(i), localization_type(i)
- END SELECT
+ if (is_ascii) then
+ write(ifile, *) half_width(i), num_points(i), localization_type(i)
+ else
+ write(ifile) half_width(i), num_points(i), localization_type(i)
+ endif
end do
endif
! Write out the obs_def key for this observation
-SELECT CASE (fileformat)
- CASE ("unf", "UNF", "unformatted", "UNFORMATTED")
- write(ifile) key
- CASE DEFAULT
- write(ifile, *) key
-END SELECT
+if (is_ascii) then
+ write(ifile, *) key
+else
+ write(ifile) key
+endif
end subroutine write_1d_integral
@@ -140,40 +141,40 @@
character(len=32), intent(in) :: fileformat
integer :: i
+logical :: is_ascii
if ( .not. module_initialized ) call initialize_module
+is_ascii = ascii_file_format(fileformat)
+
! Philosophy, read ALL information about this special obs_type at once???
! For now, this means you can only read ONCE (that's all we're doing 3 June 05)
! Toggle the flag to control this reading
if(.not. already_read) then
already_read = .true.
! Read the number of 1d_integral obs descriptions
- SELECT CASE (fileformat)
- CASE ("unf", "UNF", "unformatted", "UNFORMATTED")
- read(ifile) num_1d_integral_obs
- CASE DEFAULT
- read(ifile, *) num_1d_integral_obs
- END SELECT
+ if (is_ascii) then
+ read(ifile, *) num_1d_integral_obs
+ else
+ read(ifile) num_1d_integral_obs
+ endif
! Read the half_width, num_points, and localization_type for each
do i = 1, num_1d_integral_obs
- SELECT CASE (fileformat)
- CASE ("unf", "UNF", "unformatted", "UNFORMATTED")
- read(ifile) half_width(i), num_points(i), localization_type(i)
- CASE DEFAULT
- read(ifile, *) half_width(i), num_points(i), localization_type(i)
- END SELECT
+ if (is_ascii) then
+ read(ifile, *) half_width(i), num_points(i), localization_type(i)
+ else
+ read(ifile) half_width(i), num_points(i), localization_type(i)
+ endif
end do
endif
! Read in the key for this particular observation
-SELECT CASE (fileformat)
- CASE ("unf", "UNF", "unformatted", "UNFORMATTED")
- read(ifile) key
- CASE DEFAULT
- read(ifile, *) key
-END SELECT
+if (is_ascii) then
+ read(ifile, *) key
+else
+ read(ifile) key
+endif
end subroutine read_1d_integral
Modified: DART/trunk/obs_def/obs_def_radar_mod.f90
===================================================================
--- DART/trunk/obs_def/obs_def_radar_mod.f90 2010-03-10 18:53:04 UTC (rev 4307)
+++ DART/trunk/obs_def/obs_def_radar_mod.f90 2010-03-10 20:22:22 UTC (rev 4308)
@@ -60,7 +60,7 @@
!-----------------------------------------------------------------------------
! BEGIN DART PREPROCESS READ_OBS_DEF
! case(DOPPLER_RADIAL_VELOCITY)
-! call read_radial_vel(obs_def%key, ifile, fileformat)
+! call read_radial_vel(obs_def%key, ifile, fform)
! case(RADAR_REFLECTIVITY)
! call read_radar_ref(obs_val, obs_def%key)
! case(RADAR_CLEARAIR_REFLECTIVITY)
@@ -73,7 +73,7 @@
!-----------------------------------------------------------------------------
! BEGIN DART PREPROCESS WRITE_OBS_DEF
! case(DOPPLER_RADIAL_VELOCITY)
-! call write_radial_vel(obs_def%key, ifile, fileformat)
+! call write_radial_vel(obs_def%key, ifile, fform)
! case(RADAR_REFLECTIVITY)
! continue
! case(RADAR_CLEARAIR_REFLECTIVITY)
@@ -109,7 +109,8 @@
use types_mod, only : r8, missing_r8, PI, deg2rad
use utilities_mod, only : register_module, error_handler, E_ERR, E_MSG, &
check_namelist_read, find_namelist_in_file, &
- nmlfileunit, do_output, do_nml_file, do_nml_term
+ nmlfileunit, do_output, do_nml_file, do_nml_term, &
+ ascii_file_format
use location_mod, only : location_type, write_location, read_location, &
interactive_location, get_location
use assim_model_mod, only : interpolate
@@ -1527,36 +1528,6 @@
!----------------------------------------------------------------------
-function ascii_file_format(fform)
-
-! Common routine for determining input file format.
-
-character(len=*), intent(in), optional :: fform
-logical :: ascii_file_format
-
-! Returns .true. if file is formatted/ascii, .false. if unformatted/binary
-! Defaults (if fform not specified) to formatted/ascii.
-
-if ( .not. module_initialized ) call initialize_module
-
-! Default to formatted/ascii.
-if ( .not. present(fform)) then
- ascii_file_format = .true.
- return
-endif
-
-SELECT CASE (trim(adjustl(fform)))
- CASE("unf", "UNF", "unformatted", "UNFORMATTED")
- ascii_file_format = .false.
- CASE DEFAULT
- ascii_file_format = .true.
-END SELECT
-
-
-end function ascii_file_format
-
-!----------------------------------------------------------------------
-
subroutine velkey_out_of_range(velkey)
! Range check velkey and trigger a fatal error if larger than allocated array.
More information about the Dart-dev
mailing list