[Dart-dev] DART/branches Revision: 10938
dart at ucar.edu
dart at ucar.edu
Mon Jan 23 17:10:18 MST 2017
hendric at ucar.edu
2017-01-23 17:10:16 -0700 (Mon, 23 Jan 2017)
56
perfect model working for single file input and output
Modified: DART/branches/rma_single_file/filter/filter_mod.f90
===================================================================
--- DART/branches/rma_single_file/filter/filter_mod.f90 2017-01-24 00:05:18 UTC (rev 10937)
+++ DART/branches/rma_single_file/filter/filter_mod.f90 2017-01-24 00:10:16 UTC (rev 10938)
@@ -1091,11 +1091,14 @@
! Set up diagnostic output for model state, if output is desired
PreAssimStateUnit = init_singlefile_output('filter_preassim', 'preassim ensemble state', &
- num_state_copies, state_meta, prior_inflate, post_inflate)
+ num_state_copies, state_meta, output_mean, output_sd, &
+ prior_inflate, post_inflate)
PostAssimStateUnit = init_singlefile_output('filter_postassim', 'postassim ensemble state', &
- num_state_copies, state_meta, prior_inflate, post_inflate)
+ num_state_copies, state_meta, output_mean, output_sd, &
+ prior_inflate, post_inflate)
OutputStateUnit = init_singlefile_output('filter_output', 'output ensemble state', &
- num_state_copies, state_meta, prior_inflate, post_inflate)
+ num_state_copies, state_meta, output_mean, output_sd, &
+ prior_inflate, post_inflate)
! Set the metadata for the observations.
Modified: DART/branches/rma_single_file/io/state_space_diag_mod.f90
===================================================================
--- DART/branches/rma_single_file/io/state_space_diag_mod.f90 2017-01-24 00:05:18 UTC (rev 10937)
+++ DART/branches/rma_single_file/io/state_space_diag_mod.f90 2017-01-24 00:10:16 UTC (rev 10938)
@@ -87,6 +87,7 @@
netcdf_file_type, &
init_singlefile_output, &
finalize_singlefile_output, &
+ aoutput_variable, &
aoutput_diagnostics, &
write_single_file
@@ -134,6 +135,10 @@
!-------------------------------------------------------------------------------
+interface write_single_file
+ module procedure write_single_file_filter
+ module procedure write_single_file_pmo
+end interface
contains
@@ -329,7 +334,8 @@
function init_singlefile_output(FileName, global_meta_data, copies_of_field_per_time, &
- meta_data_per_copy, prior_inflate, post_inflate, lagID) result(ncFileID)
+ meta_data_per_copy, output_mean, output_sd, &
+ prior_inflate, post_inflate, lagID) result(ncFileID)
! Typical sequence:
! NF90_OPEN ! create netCDF dataset: enter define mode
! NF90_def_dim ! define dimenstions: from name and length
@@ -356,9 +362,11 @@
character(len=*), intent(in) :: FileName, global_meta_data
integer, intent(in) :: copies_of_field_per_time
character(len=*), intent(in) :: meta_data_per_copy(copies_of_field_per_time)
-type(adaptive_inflate_type), intent(in) :: prior_inflate
-type(adaptive_inflate_type), intent(in) :: post_inflate
-integer, OPTIONAL,intent(in) :: lagID
+logical , OPTIONAL, intent(in) :: output_mean
+logical , OPTIONAL, intent(in) :: output_sd
+type(adaptive_inflate_type), OPTIONAL, intent(in) :: prior_inflate
+type(adaptive_inflate_type), OPTIONAL, intent(in) :: post_inflate
+integer, OPTIONAL, intent(in) :: lagID
type(netcdf_file_type) :: ncFileID
integer :: i, metadata_length, nlines, linelen, createmode
@@ -479,59 +487,70 @@
!#! call nc_check(nf90_put_att(ncFileID%ncid, MemberVarID, "long_name", "state"), &
!#! 'init_singlefile_output', 'long_name')
- !#! if (output_mean())
- !>@todo need to append variable name before for models with multiple variables
- call nc_check(nf90_def_var(ncid=ncFileID%ncid, name="state_mean", xtype=nf90_double, &
- dimids=(/ModelSizeDimID, TimeDimID/), varid=EnsMeanVarID), &
- 'init_singlefile_output', 'def_var state_mean')
- call nc_check(nf90_put_att(ncFileID%ncid, EnsMeanVarID, "long_name", &
- "ensemble mean"), 'init_singlefile_output', 'long_name')
- !#! endif
- !#! if (output_sd())
- !>@todo need to append variable name before for models with multiple variables
- call nc_check(nf90_def_var(ncid=ncFileID%ncid, name="state_sd", xtype=nf90_double, &
- dimids=(/ModelSizeDimID, TimeDimID/), varid=EnsSdVarID), &
- 'init_singlefile_output', 'def_var state_sd')
- call nc_check(nf90_put_att(ncFileID%ncid, EnsSdVarID, "long_name", &
- "ensemble spread"), 'init_singlefile_output', 'long_name')
- !#! endif
+ ! Variable Mean
+ if (present(output_mean)) then
+ if(output_mean) then
+ !>@todo need to append variable name before for models with multiple variables
+ call nc_check(nf90_def_var(ncid=ncFileID%ncid, name="state_mean", xtype=nf90_double, &
+ dimids=(/ModelSizeDimID, TimeDimID/), varid=EnsMeanVarID), &
+ 'init_singlefile_output', 'def_var state_mean')
+ call nc_check(nf90_put_att(ncFileID%ncid, EnsMeanVarID, "long_name", &
+ "ensemble mean"), 'init_singlefile_output', 'long_name')
+ endif
More information about the Dart-dev
mailing list