[Dart-dev] DART/branches Revision: 12647
dart at ucar.edu
dart at ucar.edu
Thu Jun 7 15:29:09 MDT 2018
nancy at ucar.edu
2018-06-07 15:29:09 -0600 (Thu, 07 Jun 2018)
494
add some routines needed to create wrf diagnostic files, including
4d arrays and being able to create r4 vs r8 attributes and variables
(since wrf users sometimes build dart with r8=r4).
also relax the requirement in the routine that returns a variable's
dimension sizes that the size of the output array matches exactly
the dimension of the variable. now as long as it's large enough
we don't complain. set unused entries to -1 just in case the
calling code references them accidently.
Modified: DART/branches/rma_trunk/assimilation_code/modules/utilities/netcdf_utilities_mod.f90
===================================================================
--- DART/branches/rma_trunk/assimilation_code/modules/utilities/netcdf_utilities_mod.f90 2018-06-07 20:52:08 UTC (rev 12646)
+++ DART/branches/rma_trunk/assimilation_code/modules/utilities/netcdf_utilities_mod.f90 2018-06-07 21:29:09 UTC (rev 12647)
@@ -68,11 +68,18 @@
nc_synchronize_file
+! note here that you only need to distinguish between
+! r4 (float) and r8 (double) when defining or adding
+! a new variable or attribute. the get and query routines
+! will coerce the values to the destination precision correctly.
+
interface nc_add_global_attribute
module procedure nc_add_global_char_att
module procedure nc_add_global_int_att
- module procedure nc_add_global_real_att
- module procedure nc_add_global_real_array_att
+ module procedure nc_add_global_float_att
+ module procedure nc_add_global_double_att
+ module procedure nc_add_global_float_array_att
+ module procedure nc_add_global_double_array_att
end interface
interface nc_get_global_attribute
@@ -86,8 +93,10 @@
module procedure nc_add_char_att_to_var
module procedure nc_add_int_array_att_to_var
module procedure nc_add_int_att_to_var
- module procedure nc_add_real_att_to_var
- module procedure nc_add_real_array_att_to_var
+ module procedure nc_add_float_att_to_var
+ module procedure nc_add_double_att_to_var
+ module procedure nc_add_float_array_att_to_var
+ module procedure nc_add_double_array_att_to_var
end interface
interface nc_get_attribute_from_variable
@@ -129,6 +138,8 @@
module procedure nc_put_real_2d
module procedure nc_put_int_3d
module procedure nc_put_real_3d
+ module procedure nc_put_int_4d
+ module procedure nc_put_real_4d
end interface
interface nc_get_variable
@@ -143,6 +154,8 @@
module procedure nc_get_short_3d
module procedure nc_get_int_3d
module procedure nc_get_real_3d
+ module procedure nc_get_int_4d
+ module procedure nc_get_real_4d
end interface
interface nc_get_variable_size
@@ -163,12 +176,9 @@
!> last N filenames - look them up on error and stop
!> having to keep the filename around.
-!> NOTE!!
-!> this assumes that you are doing the open/read/write/close
-!> operations on the same task. which i believe is true for all
-!> our current code.
-
-integer, parameter :: MAX_NCFILES = 20
+! NOTE this is the max number of concurrently
+! open netcdf files on a single task.
+integer, parameter :: MAX_NCFILES = 50
integer, parameter :: FH_EMPTY = -1
type ncinfo_type
@@ -268,40 +278,76 @@
!--------------------------------------------------------------------
-subroutine nc_add_global_real_att(ncid, attname, val, context, filename)
+subroutine nc_add_global_float_att(ncid, attname, val, context, filename)
integer, intent(in) :: ncid
character(len=*), intent(in) :: attname
-real(r8), intent(in) :: val
+real(r4), intent(in) :: val
character(len=*), intent(in), optional :: context
character(len=*), intent(in), optional :: filename
-character(len=*), parameter :: routine = 'nc_add_global_real_att'
+character(len=*), parameter :: routine = 'nc_add_global_float_att'
integer :: ret
ret = nf90_put_att(ncid, NF90_GLOBAL, attname, val)
call nc_check(ret, routine, 'adding the global attribute: '//trim(attname), context, filename, ncid)
-end subroutine nc_add_global_real_att
+end subroutine nc_add_global_float_att
!--------------------------------------------------------------------
-subroutine nc_add_global_real_array_att(ncid, attname, val, context, filename)
+subroutine nc_add_global_double_att(ncid, attname, val, context, filename)
More information about the Dart-dev
mailing list