[Dart-dev] DART/branches Revision: 10957
dart at ucar.edu
dart at ucar.edu
Thu Jan 26 09:17:45 MST 2017
nancy at ucar.edu
2017-01-26 09:17:43 -0700 (Thu, 26 Jan 2017)
111
a little more cleanup - consolidate some code
and avoid passing around extra arguments to
worker subroutines.
Modified: DART/branches/rma_trunk/system_simulation/gen_sampling_err_table.f90
===================================================================
--- DART/branches/rma_trunk/system_simulation/gen_sampling_err_table.f90 2017-01-26 15:53:42 UTC (rev 10956)
+++ DART/branches/rma_trunk/system_simulation/gen_sampling_err_table.f90 2017-01-26 16:17:43 UTC (rev 10957)
@@ -12,7 +12,7 @@
!> this version is a sparse array - the ens_index array lists the ensemble
!> sizes that have been computed, using the unlimited dimension. to generate
!> a new ensemble size, it can be added at the end of the existing arrays.
-!>`
+!>
!> the initial table has the 40 sizes that the previous release of DART
!> came with. to generate other ensemble sizes, run this program with
!> the desired ensemble sizes listed in the namelist.
@@ -64,8 +64,7 @@
integer, allocatable :: index_array(:)
-integer :: ncid, num_ens, esize, next_slot
-integer :: count_id, corrmean_id, alpha_id, index_id
+integer :: ncid, num_ens, esize, this_slot
integer :: iunit, io
character(len=512) :: msgstring
@@ -104,23 +103,21 @@
endif
if (file_exist(output_filename)) then
- ncid = setup_to_append_output_file(nentries, num_samples, count_id, corrmean_id, alpha_id, index_id, next_slot)
+ ncid = setup_to_append_output_file(nentries, num_samples, this_slot)
else
- ncid = create_output_file(nentries, num_samples, count_id, corrmean_id, alpha_id, index_id, next_slot)
+ ncid = create_output_file(nentries, num_samples, this_slot)
endif
-call validate_list(ncid, index_id, next_slot-1, index_array, num_ens, ens_sizes)
+call validate_list(ncid, this_slot, index_array, num_ens, ens_sizes)
do esize=1, num_ens
+ this_slot = this_slot + 1
+
call compute_table(ens_sizes(esize), nentries, bin_count, true_correl_mean, alpha)
- call addto_output_file(ncid, next_slot, &
- count_id, bin_count(1:nentries), &
- corrmean_id, true_correl_mean, &
- alpha_id, alpha, &
- index_id, ens_sizes(esize))
+ call addto_output_file(ncid, this_slot, bin_count(1:nentries), true_correl_mean, &
+ alpha, ens_sizes(esize))
- next_slot = next_slot + 1
enddo
call close_output_file(ncid)
@@ -307,16 +304,12 @@
! netcdf i/o routines
!----------------------------------------------------------------
-!> create a netcdf file and add some global attributes
+!> create a new netcdf file and add some global attributes
-function create_output_file(nentries, num_samples, count_id, corrmean_id, alpha_id, index_id, unlimlenp1)
+function create_output_file(nentries, num_samples, unlimlen)
integer, intent(in) :: nentries
integer, intent(in) :: num_samples
-integer, intent(out) :: count_id
-integer, intent(out) :: corrmean_id
-integer, intent(out) :: alpha_id
-integer, intent(out) :: index_id
-integer, intent(out) :: unlimlenp1
+integer, intent(out) :: unlimlen
integer :: create_output_file
@@ -333,10 +326,10 @@
rc = nf90_put_att(fid, NF90_GLOBAL, 'num_samples', num_samples)
call nc_check(rc, 'create_output_file', 'adding global attribute "num_samples"')
-call setup_output_file(fid, count_id, corrmean_id, alpha_id, index_id)
+call setup_output_file(fid)
-! unlimited dim initially empty, the next to be added is going to be 1
-unlimlenp1 = 1
+! unlimited dim initially empty
+unlimlen = 0
create_output_file = fid
@@ -346,14 +339,10 @@
!> open an existing file and prepare to append to it
-function setup_to_append_output_file(nentries, num_samples, count_id, corrmean_id, alpha_id, index_id, unlimlenp1)
+function setup_to_append_output_file(nentries, num_samples, unlimlen)
integer, intent(in) :: nentries
integer, intent(in) :: num_samples
-integer, intent(out) :: count_id
-integer, intent(out) :: corrmean_id
-integer, intent(out) :: alpha_id
-integer, intent(out) :: index_id
-integer, intent(out) :: unlimlenp1
More information about the Dart-dev
mailing list