[Dart-dev] DART/branches Revision: 11934

dart at ucar.edu dart at ucar.edu
Thu Sep 14 12:59:40 MDT 2017


thoar at ucar.edu
2017-09-14 12:59:39 -0600 (Thu, 14 Sep 2017)
658
trans_coamps_to_dart  works and uses the hdf variable names
for the variables in the hdf files. The nuisance variables
have names that are consistent with the naming scheme.
The hdf_names are now part of the state variable structure
and are filled during the 'coamps_[read,write]_all_fields()' call.

Unfortunately, those routines are not called by static_init_model().
There are two instances of the state_vector - one for the DART state, 
and one for the COAMPS state. The list of 'variables' needed to construct
the DART state vector are contained in 'state.vars' but this table only has
the short name of the variable (UUWIND) and a list of attributes.




Modified: DART/branches/coamps/models/coamps_nest/coamps_netcdf_mod.f90
===================================================================
--- DART/branches/coamps/models/coamps_nest/coamps_netcdf_mod.f90	2017-09-12 22:46:34 UTC (rev 11933)
+++ DART/branches/coamps/models/coamps_nest/coamps_netcdf_mod.f90	2017-09-14 18:59:39 UTC (rev 11934)
@@ -41,7 +41,7 @@
 
     use coamps_statevar_mod, only : state_variable,             &
                                   get_var_substate,             &
-                                  get_var_name,                 &
+                                  get_var_name, get_hdf_name,   &
                                   get_nc_varid,                 &
                                   set_nc_varid,                 &
                                   get_vert_value,               &
@@ -466,20 +466,14 @@
 
         cur_var => get_next(iterator)
 
-        select case (get_vert_type(cur_var))
-          case(VERTISHEIGHT)
-            write(var_name, 402) trim(get_var_name(cur_var)), 'Z', &
-                                 int(get_vert_value(cur_var)), get_nest_number(cur_var)
-          case(VERTISPRESSURE)
-            write(var_name, 402) trim(get_var_name(cur_var)), 'P', &
-                                 int(get_vert_value(cur_var)), get_nest_number(cur_var)
-          case(VERTISSURFACE, VERTISUNDEF)
-            write(var_name, 402) trim(get_var_name(cur_var)), 'S', &
-                                 get_vert_value(cur_var), get_nest_number(cur_var)
-          case default
-            write(var_name, 400) trim(get_var_name(cur_var)), get_nest_number(cur_var)
-        end select
+        ! use the hdf variable name if possible
+        var_name = get_hdf_name(cur_var)
 
+        if (var_name == 'nohdfname') then
+           write(var_name, 400) trim(get_var_name(cur_var)), &
+                                     get_nest_number(cur_var)
+        endif
+
         ndims  = get_var_rank(cur_var, domain)
 
         dimids = get_dimids(ndims        = ndims,                         &

Modified: DART/branches/coamps/models/coamps_nest/coamps_statevar_mod.f90
===================================================================
--- DART/branches/coamps/models/coamps_nest/coamps_statevar_mod.f90	2017-09-12 22:46:34 UTC (rev 11933)
+++ DART/branches/coamps/models/coamps_nest/coamps_statevar_mod.f90	2017-09-14 18:59:39 UTC (rev 11934)
@@ -72,17 +72,15 @@
     public :: get_mean_flag
     public :: get_io_flag
     public :: get_mass_level_flag
-    public :: get_sigma_record
     public :: get_var_max_level
     public :: get_var_min_level
-    public :: get_nc_varid
-    public :: get_var_stagger
+    public :: get_sigma_record, set_sigma_record
+    public :: get_nc_varid,     set_nc_varid
+    public :: get_var_stagger,  set_var_stagger
+    public :: get_hdf_name,     set_hdf_name
 
-    public :: set_sigma_record
     public :: set_2d_flag
     public :: set_position
-    public :: set_nc_varid
-    public :: set_var_stagger
     public :: define_mean_var
 
     ! Logical array sectioning
@@ -151,6 +149,7 @@
     integer, parameter :: VAR_NAME_LEN  = 10
     integer, parameter :: VAR_QTY_LEN   = 32
     integer, parameter :: PERT_TYPE_LEN = 7
+    integer, parameter :: HDF_NAME_LEN  = 64 ! seems to be preferred length
 
     ! Perturbation types - don't perturb at all, perturb whole sigma
     ! level field uniformly, or perturb each grid point individually.
@@ -236,6 +235,7 @@
         character(len=1)            :: var_stagger          ! IN
         integer                     :: vert_type            ! IN
         real(kind=r8)               :: vert_value           ! IN
+        character(len=HDF_NAME_LEN) :: hdf_name = 'nohdfname'
     end type state_variable
 
     !------------------------------
@@ -868,6 +868,28 @@
         set_position = var%state_end
     end function set_position
 
+    ! set_hdf_name
+    !  PARAMETERS
+    !  INOUT var        State variable to modify
+    !  IN    varid      netcdf variable id
+    subroutine set_hdf_name(var, hdf_name)
+        type(state_variable), intent(inout) :: var
+        character(len=*),     intent(in)    :: hdf_name
+
+        var%hdf_name = trim(hdf_name)
+    end subroutine set_hdf_name
+
+    ! get_hdf_name
+    !  PARAMETERS


More information about the Dart-dev mailing list