[Dart-dev] [7170] DART/trunk/models/wrf: updates from ryan sobash to seed the additive noise with
nancy at ucar.edu
nancy at ucar.edu
Thu Sep 11 10:42:12 MDT 2014
Revision: 7170
Author: nancy
Date: 2014-09-11 10:42:11 -0600 (Thu, 11 Sep 2014)
Log Message:
-----------
updates from ryan sobash to seed the additive noise with
a consistent seed based on analysis time and ensemble number,
instead of milliseconds from system clock. with this change
you can reproduce exactly a previous run.
Modified Paths:
--------------
DART/trunk/models/wrf/WRF_DART_utilities/add_pert_where_high_refl.f90
DART/trunk/models/wrf/shell_scripts/add_noise.csh
-------------- next part --------------
Modified: DART/trunk/models/wrf/WRF_DART_utilities/add_pert_where_high_refl.f90
===================================================================
--- DART/trunk/models/wrf/WRF_DART_utilities/add_pert_where_high_refl.f90 2014-09-10 19:54:10 UTC (rev 7169)
+++ DART/trunk/models/wrf/WRF_DART_utilities/add_pert_where_high_refl.f90 2014-09-11 16:42:11 UTC (rev 7170)
@@ -24,6 +24,9 @@
! (9) td_sd -- std. dev. of dewpoint noise (K), before smoothing
! (10) qv_sd -- std. dev. of water vapor mixing ratio noise, before smoothing
! (input value is in g/kg, value after conversion is in kg/kg)
+! (11) ens_num -- ensemble number for consistently seeding the random number generator
+! (12) gdays -- gregorian day number of wrf analysis time
+! (13) gsecs -- gregorian seconds of day of wrf analysis time
!
! output:
@@ -52,6 +55,9 @@
real(r8) :: t_sd
real(r8) :: td_sd
real(r8) :: qv_sd
+integer :: ens_num
+integer :: gdays
+integer :: gsecs
! local variables
integer :: n_obs ! number of gridded reflectivity observations
@@ -107,7 +113,7 @@
! Get command-line parameters, using the F2KCLI interface. See f2kcli.f90 for details.
-if( COMMAND_ARGUMENT_COUNT() .ne. 10 ) then
+if( COMMAND_ARGUMENT_COUNT() .ne. 13 ) then
print*, 'INCORRECT # OF ARGUMENTS ON COMMAND LINE: ', COMMAND_ARGUMENT_COUNT()
call exit(1)
else
@@ -188,6 +194,30 @@
read(string,*) qv_sd
endif
+ call GET_COMMAND_ARGUMENT(11,string,length,status)
+ if( status .ne. 0 ) then
+ print*, 'ens_num NOT RETRIEVED FROM COMMAND LINE: ', status
+ call exit(1)
+ else
+ read(string,*) ens_num
+ endif
+
+ call GET_COMMAND_ARGUMENT(12,string,length,status)
+ if( status .ne. 0 ) then
+ print*, 'gdays NOT RETRIEVED FROM COMMAND LINE: ', status
+ call exit(1)
+ else
+ read(string,*) gdays
+ endif
+
+ call GET_COMMAND_ARGUMENT(13,string,length,status)
+ if( status .ne. 0 ) then
+ print*, 'gsecs NOT RETRIEVED FROM COMMAND LINE: ', status
+ call exit(1)
+ else
+ read(string,*) gsecs
+ endif
+
endif
qv_sd = 0.001_r8 * qv_sd ! convert g/kg to kg/kg
@@ -281,13 +311,17 @@
enddo
-! Initialize random number generator with a seed based on the milliseconds
-! portion of the current time.
+! Initialize random number generator based on the analysis time and
+! the ensemble number so repeated runs have reproducible values.
+call init_random_seq(rs, (gdays + gsecs)*1000 + ens_num)
-call date_and_time(crdate,crtime,crzone,values)
-call init_random_seq(rs, -int(values(8)))
+! Original code was setting the seed based on the milliseconds of
+! the system clock, so all seeds were random but not reproducible.
+!call date_and_time(crdate,crtime,crzone,values)
+!call init_random_seq(rs, -int(values(8)))
+
! Add perturbations.
if (u_sd .gt. 0.0_r8) then
Modified: DART/trunk/models/wrf/shell_scripts/add_noise.csh
===================================================================
--- DART/trunk/models/wrf/shell_scripts/add_noise.csh 2014-09-10 19:54:10 UTC (rev 7169)
+++ DART/trunk/models/wrf/shell_scripts/add_noise.csh 2014-09-11 16:42:11 UTC (rev 7170)
@@ -129,10 +129,10 @@
if ($transition_relative_time <= 0) then
echo "(1) member ${ensemble_member} calling add_pert_where_high_refl"
- ../add_pert_where_high_refl ../refl_obs_${wrfsecs}_${wrfdays}.txt wrfinput_d01 $lh $lv $u_noise_1 $v_noise_1 $w_noise_1 $t_noise_1 $td_noise_1 $qv_noise_1
+ ../add_pert_where_high_refl ../refl_obs_${wrfsecs}_${wrfdays}.txt wrfinput_d01 $lh $lv $u_noise_1 $v_noise_1 $w_noise_1 $t_noise_1 $td_noise_1 $qv_noise_1 $ensemble_member $wrfdays $wrfsecs
else
echo "(2) member ${ensemble_member} calling add_pert_where_high_refl"
- ../add_pert_where_high_refl ../refl_obs_${wrfsecs}_${wrfdays}.txt wrfinput_d01 $lh $lv $u_noise_2 $v_noise_2 $w_noise_2 $t_noise_2 $td_noise_2 $qv_noise_2
+ ../add_pert_where_high_refl ../refl_obs_${wrfsecs}_${wrfdays}.txt wrfinput_d01 $lh $lv $u_noise_2 $v_noise_2 $w_noise_2 $t_noise_2 $td_noise_2 $qv_noise_2 $ensemble_member $wrfdays $wrfsecs
endif
More information about the Dart-dev
mailing list