[Dart-dev] DART/branches Revision: 12051
dart at ucar.edu
dart at ucar.edu
Mon Nov 6 11:18:34 MST 2017
hendric at ucar.edu
2017-11-06 11:18:33 -0700 (Mon, 06 Nov 2017)
47
adding scaler vector the the netcdf utilities
Modified: DART/branches/recam/assimilation_code/modules/utilities/netcdf_utilities_mod.f90
===================================================================
--- DART/branches/recam/assimilation_code/modules/utilities/netcdf_utilities_mod.f90 2017-11-06 16:39:55 UTC (rev 12050)
+++ DART/branches/recam/assimilation_code/modules/utilities/netcdf_utilities_mod.f90 2017-11-06 18:18:33 UTC (rev 12051)
@@ -69,6 +69,7 @@
end interface
interface nc_define_real_variable
+ module procedure nc_define_var_real_scalar
module procedure nc_define_var_real_1d
module procedure nc_define_var_real_Nd
end interface
@@ -424,6 +425,24 @@
!--------------------------------------------------------------------
+subroutine nc_define_var_real_scalar(ncid, varname, ndim, context, filename)
+
+integer, intent(in) :: ncid
+character(len=*), intent(in) :: varname
+integer, intent(in) :: ndim ! ignore for now
+character(len=*), intent(in), optional :: context
+character(len=*), intent(in), optional :: filename
+
+character(len=*), parameter :: routine = 'nc_define_var_real_scalar'
+integer :: ret, varid
+
+ret = nf90_def_var(ncid, varname, nf90_real, varid=varid)
+call nc_check(ret, routine, 'define real variable '//trim(varname), context, filename)
+
+end subroutine nc_define_var_real_scalar
+
+!--------------------------------------------------------------------
+
subroutine nc_define_var_real_1d(ncid, varname, dimname, context, filename)
integer, intent(in) :: ncid
Modified: DART/branches/recam/models/cam-fv/new_model_mod.f90
===================================================================
--- DART/branches/recam/models/cam-fv/new_model_mod.f90 2017-11-06 16:39:55 UTC (rev 12050)
+++ DART/branches/recam/models/cam-fv/new_model_mod.f90 2017-11-06 18:18:33 UTC (rev 12051)
@@ -516,7 +516,7 @@
call nc_define_real_variable( ncid, 'ilev', (/ 'ilev' /), routine)
-call nc_add_attribute_to_variable(ncid, 'ilev', 'long_name', 'hybrid level at interfaces (1000*(A+B))', routine)
+call nc_add_attribute_to_variable(ncid, 'ilev', 'long_name', 'hybrid level at interfaces (1000*(A+B))', routine)
call nc_add_attribute_to_variable(ncid, 'ilev', 'units', 'level', routine)
call nc_add_attribute_to_variable(ncid, 'ilev', 'positive', 'down', routine)
call nc_add_attribute_to_variable(ncid, 'ilev', 'standard_name', 'atmosphere_hybrid_sigma_pressure_coordinate', routine)
@@ -541,6 +541,10 @@
call nc_define_real_variable( ncid, 'gw', (/ 'lat' /), routine)
call nc_add_attribute_to_variable(ncid, 'gw', 'long_name', 'gauss weights', routine)
+call nc_define_real_variable(ncid, 'P0', 0, routine)
+call nc_add_attribute_to_variable(ncid, 'P0', 'long_name', 'reference pressure', routine)
+call nc_add_attribute_to_variable(ncid, 'P0', 'units', 'Pa', routine)
+
! Finished with dimension/variable definitions, must end 'define' mode to fill.
call nc_enddef(ncid)
@@ -560,6 +564,7 @@
call nc_put_variable(ncid, 'hybm', grid_data%hybm%vals, routine)
call nc_put_variable(ncid, 'hyai', grid_data%hyai%vals, routine)
call nc_put_variable(ncid, 'hybi', grid_data%hybi%vals, routine)
+call nc_put_variable(ncid, 'P0', grid_data%P0%vals, routine)
!-------------------------------------------------------------------------------
! Flush the buffer and leave netCDF file open
@@ -567,11 +572,6 @@
call nc_sync(ncid)
! Reference Pressure
-!#! !>@todo JPH what to do for scalar variables?
-!#! call nc_define_real_variable(ncid, 'P0', (/ 'lat' /), routine)
-!#!
-!#! call nc_add_attribute_to_variable(ncid, 'P0', 'long_name', 'reference pressure', routine)
-!#! call nc_add_attribute_to_variable(ncid, 'P0', 'units', 'Pa', routine)
end subroutine nc_write_model_atts
More information about the Dart-dev
mailing list