[Dart-dev] DART/branches Revision: 11528

dart at ucar.edu dart at ucar.edu
Wed Apr 26 16:45:30 MDT 2017


thoar at ucar.edu
2017-04-26 16:45:30 -0600 (Wed, 26 Apr 2017)
251
The nc_write_model_atts() routine is now being called and works.
The filter namelist section still needs to be updated, and the
cice.r.nc file is an 'old' one that does not have the somtp variable
from the slab ocean model - one of Fei's extensions.




Modified: DART/branches/rma_output_files/models/cice/model_mod.f90
===================================================================
--- DART/branches/rma_output_files/models/cice/model_mod.f90	2017-04-26 22:31:00 UTC (rev 11527)
+++ DART/branches/rma_output_files/models/cice/model_mod.f90	2017-04-26 22:45:30 UTC (rev 11528)
@@ -1937,31 +1937,15 @@
 end subroutine end_model
 
 !------------------------------------------------------------------
+!> Writes the model-specific attributes to a netCDF file.
+!> This includes coordinate variables and some metadata, but NOT
+!> the model state vector.
 
-!CMB edited a lot
 function nc_write_model_atts( ncFileID, model_mod_writes_state_variables ) result (ierr)
- integer, intent(in)  :: ncFileID      ! netCDF file identifier
- logical, intent(out) :: model_mod_writes_state_variables
- integer              :: ierr          ! return value of function
+integer, intent(in)  :: ncFileID      ! netCDF file identifier
+logical, intent(out) :: model_mod_writes_state_variables
+integer              :: ierr          ! return value of function
 
-! TJH -- Writes the model-specific attributes to a netCDF file.
-!     This includes coordinate variables and some metadata, but NOT
-!     the model state vector.
-!
-! assim_model_mod:init_diag_output uses information from the location_mod
-!     to define the location dimension and variable ID. All we need to do
-!     is query, verify, and fill ...
-!
-! Typical sequence for adding new dimensions,variables,attributes:
-! NF90_OPEN             ! open existing netCDF dataset
-!    NF90_redef         ! put into define mode 
-!    NF90_def_dim       ! define additional dimensions (if any)
-!    NF90_def_var       ! define variables: from name, type, and dims
-!    NF90_put_att       ! assign attribute values
-! NF90_ENDDEF           ! end definitions: leave define mode
-!    NF90_put_var       ! provide values for variable
-! NF90_CLOSE            ! close: save updated netCDF dataset
-
 integer :: nDimensions, nVariables, nAttributes, unlimitedDimID
 
 !----------------------------------------------------------------------
@@ -1969,7 +1953,6 @@
 !----------------------------------------------------------------------
 
 integer :: StateVarDimID   ! netCDF pointer to state variable dimension (model size)
-integer :: MemberDimID     ! netCDF pointer to dimension of ensemble    (ens_size)
 integer :: TimeDimID       ! netCDF pointer to time dimension           (unlimited)
 
 integer :: StateVarVarID   ! netCDF pointer to state variable coordinate array
@@ -2012,13 +1995,12 @@
 integer     :: i
 character(len=128)  :: filename
 
-integer  :: model_size_i4 ! this is for checking model_size
-
 if ( .not. module_initialized ) call static_init_model
 
 ierr = -1 ! assume things go poorly
-model_mod_writes_state_variables = .true. 
 
+model_mod_writes_state_variables = .false. 
+
 !--------------------------------------------------------------------
 ! we only have a netcdf handle here so we do not know the filename
 ! or the fortran unit number.  but construct a string with at least
@@ -2045,8 +2027,6 @@
 
 call nc_check(nf90_inq_dimid(ncid=ncFileID, name='NMLlinelen', dimid=LineLenDimID), &
                            'nc_write_model_atts','inq_dimid NMLlinelen')
-call nc_check(nf90_inq_dimid(ncid=ncFileID, name='copy', dimid=MemberDimID), &
-                           'nc_write_model_atts', 'copy dimid '//trim(filename))
 call nc_check(nf90_inq_dimid(ncid=ncFileID, name='time', dimid=  TimeDimID), &
                            'nc_write_model_atts', 'time dimid '//trim(filename))
 
@@ -2057,24 +2037,6 @@
 endif
 
 !-------------------------------------------------------------------------------
-! Define the model size / state variable dimension / whatever ...
-!-------------------------------------------------------------------------------
-! JH -- nf90_def_dim is expecting a lenght that is i4.  Here we type cast size and
-!    check if the values are the same.  In the case where model_size is larger
-!    than the largest i4 integer we error out.
-!-------------------------------------------------------------------------------
-
-model_size_i4 = int(model_size,i4) 
-if (model_size_i4 /= model_size) then
-   write(msgstring,*)'model_size =  ', model_size, ' is too big to write ', &
-             ' diagnostic files.'
-   call error_handler(E_ERR,'nc_write_model_atts', msgstring, source, revision, revdate)
-endif
-
-call nc_check(nf90_def_dim(ncid=ncFileID, name='StateVariable', len=model_size_i4, &
-        dimid = StateVarDimID),'nc_write_model_atts', 'state def_dim '//trim(filename))
-
-!-------------------------------------------------------------------------------
 ! Write Global Attributes 
 !-------------------------------------------------------------------------------
 
@@ -2122,49 +2084,8 @@


More information about the Dart-dev mailing list