[Dart-dev] DART/branches Revision: 11662

dart at ucar.edu dart at ucar.edu
Thu May 25 16:50:33 MDT 2017


nancy at ucar.edu
2017-05-25 16:50:31 -0600 (Thu, 25 May 2017)
594
in model_mod.f90: remove Xdim and Ydim from model_mod.f90; improve comments
about starting from a template file vs starting from init_conditions().
in input.nml: remove unneeded namelists and move more important namelists
closer to the top of thefile.
in netcdf_utilities_mod.f90: apparently arrays of characters don't contribute
to the signature of overloaded subroutine names.  change from trying to have
distinct 2d and 3d routines to Nd and query the number of items in the 
character array (not the number of chars in each string, but the number
of strings) to decide the dimensionality.




Modified: DART/branches/rma_updates_nancy/assimilation_code/modules/utilities/netcdf_utilities_mod.f90
===================================================================
--- DART/branches/rma_updates_nancy/assimilation_code/modules/utilities/netcdf_utilities_mod.f90	2017-05-25 20:52:03 UTC (rev 11661)
+++ DART/branches/rma_updates_nancy/assimilation_code/modules/utilities/netcdf_utilities_mod.f90	2017-05-25 22:50:31 UTC (rev 11662)
@@ -63,20 +63,17 @@
 
 interface nc_define_integer_variable
    module procedure nc_define_var_int_1d
-   module procedure nc_define_var_int_2d
-   module procedure nc_define_var_int_3d
+   module procedure nc_define_var_int_Nd
 end interface
 
 interface nc_define_real_variable
    module procedure nc_define_var_real_1d
-   module procedure nc_define_var_real_2d
-   module procedure nc_define_var_real_3d
+   module procedure nc_define_var_real_Nd
 end interface
 
 interface nc_define_double_variable
    module procedure nc_define_var_double_1d
-   module procedure nc_define_var_double_2d
-   module procedure nc_define_var_double_3d
+   module procedure nc_define_var_double_Nd
 end interface
 
 interface nc_put_variable
@@ -120,7 +117,7 @@
 
 subroutine nc_check(istatus, subr_name, context, context2, filename)
 
-integer, intent (in)                   :: istatus
+integer,          intent(in)           :: istatus
 character(len=*), intent(in)           :: subr_name
 character(len=*), intent(in), optional :: context
 character(len=*), intent(in), optional :: context2
@@ -137,18 +134,9 @@
   msgstring1 = trim(context) // ': ' // trim(msgstring1)
 endif
 
-! more context if needed
-if (present(context2)) then
-  msgstring1 = trim(msgstring1) // ', ' // trim(context2)
-endif
-
-! filename is optional, but is very useful if specified.
-if (present(filename)) then
-  msgstring1 = trim(msgstring1) // ', file "' // trim(filename) // '"'
-endif
-
 ! this does not return 
-call error_handler(E_ERR, subr_name, msgstring1, source, revision, revdate)
+call error_handler(E_ERR, subr_name, msgstring1, source, revision, revdate, &
+                   text2=context2, text3=filename)
   
 
 end subroutine nc_check
@@ -384,28 +372,52 @@
 
 !--------------------------------------------------------------------
 
-subroutine nc_define_var_real_1d(ncid, varname, dimname, context, filename)
+subroutine nc_define_var_int_Nd(ncid, varname, dimnames, context, filename)
 
 integer,          intent(in) :: ncid
 character(len=*), intent(in) :: varname
-character(len=*), intent(in) :: dimname
+character(len=*), intent(in) :: dimnames(:)
 character(len=*), intent(in), optional :: context
 character(len=*), intent(in), optional :: filename
 
-character(len=*), parameter :: routine = 'nc_define_var_real_1d'
-integer :: ret, dimid, varid
+character(len=*), parameter :: routine = 'nc_define_var_int_Nd'
+integer :: ret, dimid1, dimid2, dimid3, varid
 
-ret = nf90_inq_dimid(ncid, dimname, dimid)
-call nc_check(ret, routine, 'inquire dimension id for dim '//trim(dimname), context, filename)
+if (size(dimnames) >= 1) then
+   ret = nf90_inq_dimid(ncid, dimnames(1), dimid1)
+   call nc_check(ret, routine, 'inquire dimension id for dim '//trim(dimnames(1)), context, filename)
+endif
 
-ret = nf90_def_var(ncid, varname, nf90_real, dimid, varid)
-call nc_check(ret, routine, 'define real variable '//trim(varname), context, filename)
+if (size(dimnames) >= 2) then
+   ret = nf90_inq_dimid(ncid, dimnames(2), dimid2)
+   call nc_check(ret, routine, 'inquire dimension id for dim '//trim(dimnames(2)), context, filename)
+endif
 
-end subroutine nc_define_var_real_1d
+if (size(dimnames) >= 3) then
+   ret = nf90_inq_dimid(ncid, dimnames(3), dimid3)
+   call nc_check(ret, routine, 'inquire dimension id for dim '//trim(dimnames(3)), context, filename)
+endif
 
+if (size(dimnames) >= 4) then
+   call error_handler(E_ERR, routine, 'only 1d, 2d and 3d integer variables supported', &
+                      source, revision, revdate, text2='variable '//trim(varname))
+endif


More information about the Dart-dev mailing list