From 87a47f0ed667a4096d79da101803d10bc1ba991e Mon Sep 17 00:00:00 2001 From: Seth Underwood Date: Mon, 3 Nov 2014 15:43:49 -0500 Subject: [PATCH 1/7] Updated AREA/VOLUME measures error message The new message indicates the user should contact the model liaison. --- diag_manager/diag_manager.F90 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/diag_manager/diag_manager.F90 b/diag_manager/diag_manager.F90 index ee6f1320f2..c9d2a0f5d3 100644 --- a/diag_manager/diag_manager.F90 +++ b/diag_manager/diag_manager.F90 @@ -564,14 +564,16 @@ INTEGER FUNCTION register_diag_field_array(module_name, field_name, axes, init_t IF ( PRESENT(area) ) THEN IF ( area < 0 ) THEN CALL error_mesg ('diag_manager_mod::register_diag_field', 'module/output_field '& - &//TRIM(module_name)//'/'// TRIM(field_name)//' AREA measures field NOT found in diag_table',& + &//TRIM(module_name)//'/'// TRIM(field_name)//' AREA measures field NOT found in diag_table.& + & Contact the model liaison.',& & FATAL) END IF END IF IF ( PRESENT(volume) ) THEN IF ( volume < 0 ) THEN CALL error_mesg ('diag_manager_mod::register_diag_field', 'module/output_field '& - &//TRIM(module_name)//'/'// TRIM(field_name)//' VOLUME measures field NOT found in diag_table',& + &//TRIM(module_name)//'/'// TRIM(field_name)//' VOLUME measures field NOT found in diag_table.& + & Contact the model liaison.',& & FATAL) END IF END IF @@ -794,14 +796,16 @@ INTEGER FUNCTION register_static_field(module_name, field_name, axes, long_name, IF ( PRESENT(area) ) THEN IF ( area < 0 ) THEN CALL error_mesg ('diag_manager_mod::register_static_field', 'module/output_field '& - &//TRIM(module_name)//'/'// TRIM(field_name)//' AREA measures field NOT found in diag_table',& + &//TRIM(module_name)//'/'// TRIM(field_name)//' AREA measures field NOT found in diag_table.& + & Contact the model liaison.n',& & FATAL) END IF END IF IF ( PRESENT(volume) ) THEN IF ( volume < 0 ) THEN CALL error_mesg ('diag_manager_mod::register_static_field', 'module/output_field '& - &//TRIM(module_name)//'/'// TRIM(field_name)//' VOLUME measures field NOT found in diag_table',& + &//TRIM(module_name)//'/'// TRIM(field_name)//' VOLUME measures field NOT found in diag_table& + & Contact the model liaison.',& & FATAL) END IF END IF From ea1652c17e77e983981bed30f012f85f5452a44d Mon Sep 17 00:00:00 2001 From: Seth Underwood Date: Thu, 6 Nov 2014 13:43:05 -0500 Subject: [PATCH 2/7] Relax requirement for area/volume find The requirements for the area/volume variable match now only require that the variable and the area/volume variable either both have a time operator (time_ops==.true.), both be instantaneous (time_ops==.false.), or the area/volume be a static field. --- diag_manager/diag_manager.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diag_manager/diag_manager.F90 b/diag_manager/diag_manager.F90 index ee6f1320f2..137b56dd15 100644 --- a/diag_manager/diag_manager.F90 +++ b/diag_manager/diag_manager.F90 @@ -1101,7 +1101,7 @@ LOGICAL FUNCTION get_related_field(field, rel_field, out_field_id, out_file_id) cm_file_num = output_fields(cm_ind)%output_file IF ( cm_file_num.EQ.rel_file.AND.& - & (( output_fields(cm_ind)%time_method.EQ.rel_field%time_method .AND.& + & (( output_fields(cm_ind)%time_ops.EQ.rel_field%time_ops .AND.& & output_fields(cm_ind)%next_output.EQ.rel_field%next_output .AND.& & output_fields(cm_ind)%last_output.EQ.rel_field%last_output ).OR.& & ( output_fields(cm_ind)%static.OR.rel_field%static )) ) THEN @@ -1122,7 +1122,7 @@ LOGICAL FUNCTION get_related_field(field, rel_field, out_field_id, out_file_id) ! the output_field is static then valid for cell_measures IF ( ( files(cm_file_num)%output_freq.EQ.files(rel_file)%output_freq .AND.& & files(cm_file_num)%output_units.EQ.files(cm_file_num)%output_units .AND.& - & output_fields(cm_ind)%time_method.EQ.rel_field%time_method .AND.& + & output_fields(cm_ind)%time_ops.EQ.rel_field%time_ops .AND.& & output_fields(cm_ind)%next_output.EQ.rel_field%next_output .AND.& & output_fields(cm_ind)%last_output.EQ.rel_field%last_output ).OR.& & output_fields(cm_ind)%static.OR.rel_field%static ) THEN From 37f0f683e037c3f87cd57a9f86583ffae5f7b689 Mon Sep 17 00:00:00 2001 From: Seth Underwood Date: Thu, 6 Nov 2014 13:45:08 -0500 Subject: [PATCH 3/7] Correct spelling and error message Corrected the spelling of a few comments, and removed a doubled word in an error message. --- diag_manager/diag_data.F90 | 4 ++-- diag_manager/diag_table.F90 | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/diag_manager/diag_data.F90 b/diag_manager/diag_data.F90 index 64d2849881..8a69044a3b 100644 --- a/diag_manager/diag_data.F90 +++ b/diag_manager/diag_data.F90 @@ -492,13 +492,13 @@ MODULE diag_data_mod INTEGER :: pack INTEGER :: pow_value !< Power value to use for mean_pow(n) calculations CHARACTER(len=50) :: time_method ! time method field from the input file - ! coordianes of the buffer and counter are (x, y, z, time-of-day) + ! coordinates of the buffer and counter are (x, y, z, time-of-day) REAL, _ALLOCATABLE, DIMENSION(:,:,:,:) :: buffer _NULL REAL, _ALLOCATABLE, DIMENSION(:,:,:,:) :: counter _NULL ! the following two counters are used in time-averaging for some ! combination of the field options. Their size is the length of the ! diurnal axis; the counters must be tracked separately for each of - ! the diurnal interval, becaus the number of time slices accumulated + ! the diurnal interval, because the number of time slices accumulated ! in each can be different, depending on time step and the number of ! diurnal samples. REAL, _ALLOCATABLE, DIMENSION(:) :: count_0d diff --git a/diag_manager/diag_table.F90 b/diag_manager/diag_table.F90 index 52a95d8ebd..e3f9bc5b46 100644 --- a/diag_manager/diag_table.F90 +++ b/diag_manager/diag_table.F90 @@ -797,37 +797,37 @@ TYPE(field_description_type) FUNCTION parse_field_line(line, istat, err_msg) IF ( SCAN(parse_field_line%module_name, UNALLOWED_ALL) > 0 ) THEN pstat = 1 IF ( fms_error_handler('diag_table_mod::parse_field_line',& - & 'Unallowed Unallowed character in module_name in the diag_table.', err_msg) ) RETURN + & 'Unallowed character in module_name in the diag_table.', err_msg) ) RETURN END IF IF ( SCAN(parse_field_line%field_name, UNALLOWED_ALL) > 0 ) THEN pstat = 1 IF ( fms_error_handler('diag_table_mod::parse_field_line',& - & 'Unallowed Unallowed character in field_name in the diag_table.', err_msg) ) RETURN + & 'Unallowed character in field_name in the diag_table.', err_msg) ) RETURN END IF IF ( SCAN(parse_field_line%output_name, UNALLOWED_ALL) > 0 ) THEN pstat = 1 IF ( fms_error_handler('diag_table_mod::parse_field_line',& - & 'Unallowed Unallowed character in output_name in the diag_table.', err_msg) ) RETURN + & 'Unallowed character in output_name in the diag_table.', err_msg) ) RETURN END IF IF ( SCAN(parse_field_line%file_name, UNALLOWED_ALL) > 0 ) THEN pstat = 1 IF ( fms_error_handler('diag_table_mod::parse_field_line',& - & 'Unallowed Unallowed character in file_name in the diag_table.', err_msg) ) RETURN + & 'Unallowed character in file_name in the diag_table.', err_msg) ) RETURN END IF IF ( SCAN(parse_field_line%time_sampling, UNALLOWED_ALL) > 0 ) THEN pstat = 1 IF ( fms_error_handler('diag_table_mod::parse_field_line',& - & 'Unallowed Unallowed character in time_sampling in the diag_table.', err_msg) ) RETURN + & 'Unallowed character in time_sampling in the diag_table.', err_msg) ) RETURN END IF IF ( SCAN(parse_field_line%time_method, UNALLOWED_ALL) > 0 ) THEN pstat = 1 IF ( fms_error_handler('diag_table_mod::parse_field_line',& - & 'Unallowed Unallowed character in time_method in the diag_table.', err_msg) ) RETURN + & 'Unallowed character in time_method in the diag_table.', err_msg) ) RETURN END IF IF ( SCAN(parse_field_line%spatial_ops, UNALLOWED_QTE) > 0 ) THEN pstat = 1 IF ( fms_error_handler('diag_table_mod::parse_field_line',& - & 'Unallowed Unallowed character in spatial_ops in the diag_table.', err_msg) ) RETURN + & 'Unallowed character in spatial_ops in the diag_table.', err_msg) ) RETURN END IF ! Fix the file name From c431623502dd12f37f9a7e78ffb87a6807fc3470 Mon Sep 17 00:00:00 2001 From: Seth Underwood Date: Thu, 6 Nov 2014 16:13:01 -0500 Subject: [PATCH 4/7] Changed .EQ. to .EQV. when comparing logicals --- diag_manager/diag_manager.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diag_manager/diag_manager.F90 b/diag_manager/diag_manager.F90 index 412ea16f72..87d540bb1e 100644 --- a/diag_manager/diag_manager.F90 +++ b/diag_manager/diag_manager.F90 @@ -1105,7 +1105,7 @@ LOGICAL FUNCTION get_related_field(field, rel_field, out_field_id, out_file_id) cm_file_num = output_fields(cm_ind)%output_file IF ( cm_file_num.EQ.rel_file.AND.& - & (( output_fields(cm_ind)%time_ops.EQ.rel_field%time_ops .AND.& + & (( output_fields(cm_ind)%time_ops.EQV.rel_field%time_ops .AND.& & output_fields(cm_ind)%next_output.EQ.rel_field%next_output .AND.& & output_fields(cm_ind)%last_output.EQ.rel_field%last_output ).OR.& & ( output_fields(cm_ind)%static.OR.rel_field%static )) ) THEN @@ -1126,7 +1126,7 @@ LOGICAL FUNCTION get_related_field(field, rel_field, out_field_id, out_file_id) ! the output_field is static then valid for cell_measures IF ( ( files(cm_file_num)%output_freq.EQ.files(rel_file)%output_freq .AND.& & files(cm_file_num)%output_units.EQ.files(cm_file_num)%output_units .AND.& - & output_fields(cm_ind)%time_ops.EQ.rel_field%time_ops .AND.& + & output_fields(cm_ind)%time_ops.EQV.rel_field%time_ops .AND.& & output_fields(cm_ind)%next_output.EQ.rel_field%next_output .AND.& & output_fields(cm_ind)%last_output.EQ.rel_field%last_output ).OR.& & output_fields(cm_ind)%static.OR.rel_field%static ) THEN From 2e5b330ead90b68840daf8f8467afa1657a6ee2b Mon Sep 17 00:00:00 2001 From: Seth Underwood Date: Fri, 7 Nov 2014 12:11:32 -0500 Subject: [PATCH 5/7] Placed more () in if block since The .eqv. has a lower priority than both .eq. and .and.. More parenthesis are needed to get the correct value in two if blocks Also moved the test to verify that area and volume are not the same value to better assist in debugging coding mistakes. --- diag_manager/diag_manager.F90 | 61 ++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/diag_manager/diag_manager.F90 b/diag_manager/diag_manager.F90 index 87d540bb1e..1f5780da42 100644 --- a/diag_manager/diag_manager.F90 +++ b/diag_manager/diag_manager.F90 @@ -560,6 +560,17 @@ INTEGER FUNCTION register_diag_field_array(module_name, field_name, axes, init_t input_fields(register_diag_field_array)%static = .FALSE. field = register_diag_field_array + + ! Verify that area and volume do not point to the same variable + IF ( PRESENT(volume).AND.PRESENT(area) ) THEN + IF ( area.EQ.volume ) THEN + CALL error_mesg ('diag_manager_mod::register_diag_field', 'module/output_field '& + &//TRIM(module_name)//'/'// TRIM(field_name)//' AREA and VOLUME CANNOT be the same variable.& + & Contact the developers.',& + & FATAL) + END IF + END IF + ! Check for the existence of the area/volume field(s) IF ( PRESENT(area) ) THEN IF ( area < 0 ) THEN @@ -578,16 +589,6 @@ INTEGER FUNCTION register_diag_field_array(module_name, field_name, axes, init_t END IF END IF - ! Verify that area and volume do not point to the same variable - IF ( PRESENT(volume).AND.PRESENT(area) ) THEN - IF ( area.EQ.volume ) THEN - CALL error_mesg ('diag_manager_mod::register_diag_field', 'module/output_field '& - &//TRIM(module_name)//'/'// TRIM(field_name)//' AREA and VOLUME CANNOT be the same variable.& - & Contact the developers.',& - & FATAL) - END IF - END IF - IF ( PRESENT(standard_name) ) input_fields(field)%standard_name = standard_name DO j = 1, input_fields(field)%num_output_fields @@ -792,6 +793,16 @@ INTEGER FUNCTION register_static_field(module_name, field_name, axes, long_name, & TRIM(field_name)//' ALREADY registered, should not register twice', FATAL) END IF + ! Verify that area and volume do not point to the same variable + IF ( PRESENT(volume).AND.PRESENT(area) ) THEN + IF ( area.EQ.volume ) THEN + CALL error_mesg ('diag_manager_mod::register_static_field', 'module/output_field '& + &//TRIM(module_name)//'/'// TRIM(field_name)//' AREA and VOLUME CANNOT be the same variable.& + & Contact the developers.',& + & FATAL) + END IF + END IF + ! Check for the existence of the area/volume field(s) IF ( PRESENT(area) ) THEN IF ( area < 0 ) THEN @@ -810,16 +821,6 @@ INTEGER FUNCTION register_static_field(module_name, field_name, axes, long_name, END IF END IF - ! Verify that area and volume do not point to the same variable - IF ( PRESENT(volume).AND.PRESENT(area) ) THEN - IF ( area.EQ.volume ) THEN - CALL error_mesg ('diag_manager_mod::register_static_field', 'module/output_field '& - &//TRIM(module_name)//'/'// TRIM(field_name)//' AREA and VOLUME CANNOT be the same variable.& - & Contact the developers.',& - & FATAL) - END IF - END IF - ! Set flag that this field was registered input_fields(field)%register = .TRUE. ! set flag for mask: does it change with time? @@ -1105,10 +1106,10 @@ LOGICAL FUNCTION get_related_field(field, rel_field, out_field_id, out_file_id) cm_file_num = output_fields(cm_ind)%output_file IF ( cm_file_num.EQ.rel_file.AND.& - & (( output_fields(cm_ind)%time_ops.EQV.rel_field%time_ops .AND.& - & output_fields(cm_ind)%next_output.EQ.rel_field%next_output .AND.& - & output_fields(cm_ind)%last_output.EQ.rel_field%last_output ).OR.& - & ( output_fields(cm_ind)%static.OR.rel_field%static )) ) THEN + & (( (output_fields(cm_ind)%time_ops.EQV.rel_field%time_ops) .AND.& + & (output_fields(cm_ind)%next_output.EQ.rel_field%next_output) .AND.& + & (output_fields(cm_ind)%last_output.EQ.rel_field%last_output) ).OR.& + & (output_fields(cm_ind)%static.OR.rel_field%static) ) ) THEN get_related_field = .TRUE. out_field_id = cm_ind out_file_id = cm_file_num @@ -1124,12 +1125,12 @@ LOGICAL FUNCTION get_related_field(field, rel_field, out_field_id, out_file_id) ! If time_method, freq, output_units, next_output, and last_output the same, or ! the output_field is static then valid for cell_measures - IF ( ( files(cm_file_num)%output_freq.EQ.files(rel_file)%output_freq .AND.& - & files(cm_file_num)%output_units.EQ.files(cm_file_num)%output_units .AND.& - & output_fields(cm_ind)%time_ops.EQV.rel_field%time_ops .AND.& - & output_fields(cm_ind)%next_output.EQ.rel_field%next_output .AND.& - & output_fields(cm_ind)%last_output.EQ.rel_field%last_output ).OR.& - & output_fields(cm_ind)%static.OR.rel_field%static ) THEN + IF ( ( (files(cm_file_num)%output_freq.EQ.files(rel_file)%output_freq) .AND.& + & (files(cm_file_num)%output_units.EQ.files(rel_file)%output_units) .AND.& + & (output_fields(cm_ind)%time_ops.EQV.rel_field%time_ops) .AND.& + & (output_fields(cm_ind)%next_output.EQ.rel_field%next_output) .AND.& + & (output_fields(cm_ind)%last_output.EQ.rel_field%last_output) ).OR.& + & ( output_fields(cm_ind)%static.OR.rel_field%static ) ) THEN get_related_field = .TRUE. out_field_id = cm_ind out_file_id = cm_file_num From 65f95c0290a74c2b40f7154c98bd294e952d9408 Mon Sep 17 00:00:00 2001 From: Seth Underwood Date: Fri, 7 Nov 2014 21:57:50 -0500 Subject: [PATCH 6/7] Fixed a small typo The if statement should have referenced dimJ. --- diag_manager/diag_grid.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diag_manager/diag_grid.F90 b/diag_manager/diag_grid.F90 index dd96291d6b..3eca554f50 100644 --- a/diag_manager/diag_grid.F90 +++ b/diag_manager/diag_grid.F90 @@ -547,7 +547,7 @@ SUBROUTINE get_local_indexes(latStart, latEnd, lonStart, lonEnd,& dists_lat(1) = ABS(diag_global_grid%glo_lat(i+1,j) - diag_global_grid%glo_lat(i,j)) count = count+1 END IF - IF ( j < dimI ) THEN + IF ( j < dimJ ) THEN dists_lon(2) = ABS(diag_global_grid%glo_lon(i,j+1) - diag_global_grid%glo_lon(i,j)) dists_lat(2) = ABS(diag_global_grid%glo_lat(i,j+1) - diag_global_grid%glo_lat(i,j)) count = count+1 From 34d1d644858f6b2288fe96d3f5fc042744f578c0 Mon Sep 17 00:00:00 2001 From: Seth Underwood Date: Thu, 13 Nov 2014 16:41:40 -0500 Subject: [PATCH 7/7] Added module/field names to error message All error messages now report the module/field name of the variable that will get the cell_measure, but area/volume is not in the diag_table. --- diag_manager/diag_manager.F90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/diag_manager/diag_manager.F90 b/diag_manager/diag_manager.F90 index 1f5780da42..e2b129dbb8 100644 --- a/diag_manager/diag_manager.F90 +++ b/diag_manager/diag_manager.F90 @@ -1172,14 +1172,16 @@ SUBROUTINE init_field_cell_measures(output_field, area, volume, err_msg) IF ( PRESENT(area) ) THEN IF ( area.LE.0 ) THEN IF ( fms_error_handler('diag_manager_mod::init_field_cell_measure',& - & 'AREA field not in diag_table', err_msg) ) RETURN + & 'AREA field not in diag_table for field '//TRIM(input_fields(output_field%input_field)%module_name)//& + & '/'//TRIM(input_fields(output_field%input_field)%field_name), err_msg) ) RETURN END IF END IF IF ( PRESENT(volume) ) THEN IF ( volume.LE.0 ) THEN IF ( fms_error_handler('diag_manager_mod::init_field_cell_measure',& - & 'VOLUME field not in diag_table', err_msg) ) RETURN + & 'VOLUME field not in diag_table for field '//TRIM(input_fields(output_field%input_field)%module_name)//& + & '/'//TRIM(input_fields(output_field%input_field)%field_name), err_msg) ) RETURN END IF END IF