From 938cf5bb2e05365e4bd63d8f5a42c9d6ab1e579c Mon Sep 17 00:00:00 2001 From: Seth Underwood Date: Mon, 19 Dec 2016 08:19:27 -0500 Subject: [PATCH] Use fms_mod:do_cf_compliance to switch time_bnds axis units To follow CF compliance, the time_bnds axis units must be the same as the time axis. This modification uses the same time_axis units as the time axis if do_cf_compliance() is true. Fixes #27 --- diag_manager/diag_util.F90 | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/diag_manager/diag_util.F90 b/diag_manager/diag_util.F90 index 8ac8039353..fc07d7276e 100644 --- a/diag_manager/diag_util.F90 +++ b/diag_manager/diag_util.F90 @@ -43,7 +43,7 @@ MODULE diag_util_mod & write_field_meta_data, done_meta_data USE diag_grid_mod, ONLY: get_local_indexes USE fms_mod, ONLY: error_mesg, FATAL, WARNING, mpp_pe, mpp_root_pe, lowercase, fms_error_handler,& - & write_version_number + & write_version_number, do_cf_compliance USE fms_io_mod, ONLY: get_tile_string, return_domain, string, get_instance_filename USE mpp_domains_mod,ONLY: domain1d, domain2d, mpp_get_compute_domain, null_domain1d, null_domain2d,& & OPERATOR(.NE.), OPERATOR(.EQ.), mpp_modify_domain, mpp_get_domain_components,& @@ -1936,9 +1936,17 @@ SUBROUTINE opening_file(file, time) & cart_name, dir, edges, Domain, DATA) CALL get_diag_axis( time_bounds_id(1), timeb_name, timeb_units, timeb_longname,& & cart_name, dir, edges, Domain, DATA) - files(file)%f_bounds = write_field_meta_data(files(file)%file_unit,& - & TRIM(time_name)//'_bnds', (/time_bounds_id,time_axis_id/),& - & time_units, TRIM(time_name)//' axis boundaries', pack=pack_size) + IF ( do_cf_compliance() ) THEN + ! CF Compliance requires the unit on the _bnds axis is the same as 'time' + files(file)%f_bounds = write_field_meta_data(files(file)%file_unit,& + & TRIM(time_name)//'_bnds', (/time_bounds_id,time_axis_id/),& + & TRIM(time_unit_list(files(file)%time_units)),& + & TRIM(time_name)//' axis boundaries', pack=pack_size) + ELSE + files(file)%f_bounds = write_field_meta_data(files(file)%file_unit,& + & TRIM(time_name)//'_bnds', (/time_bounds_id,time_axis_id/),& + & time_units, TRIM(time_name)//' axis boundaries', pack=pack_size) + END IF END IF ! Let lower levels know that all meta data has been sent CALL done_meta_data(files(file)%file_unit)