diff --git a/Src/cmor_axes.c b/Src/cmor_axes.c index 3a8955b7..01c33699 100644 --- a/Src/cmor_axes.c +++ b/Src/cmor_axes.c @@ -324,7 +324,11 @@ int cmor_check_monotonic(double *values,int length, char *name,int isbounds, int } else { snprintf(msg,CMOR_MAX_STRING,"axis %s (table: %s) has non monotonic bounds values : %lf, %lf, %lf",name,cmor_tables[cmor_axes[axis_id].ref_table_id].table_id,values[2*i],values[2*i+2],values[2*i+4]); - cmor_handle_error(msg,CMOR_CRITICAL); + if (refaxis->climatology==0) { + cmor_handle_error(msg,CMOR_CRITICAL); + } else { + cmor_handle_error(msg,CMOR_WARNING); + } } } } diff --git a/Test/test_non_monotonic_climo_bonds_ok.py b/Test/test_non_monotonic_climo_bonds_ok.py new file mode 100644 index 00000000..2cd0ad8f --- /dev/null +++ b/Test/test_non_monotonic_climo_bonds_ok.py @@ -0,0 +1,54 @@ +import cmor + +## Hypothetical data are going from march 2000 thru feb 2010 +times = [72,75,78] +times_bnds = [[11,134],[2,125],[5,128]] # first full djf one year later than first full mam + + +def path_test(): + cmor.setup(inpath='TestTables',netcdf_file_action=cmor.CMOR_REPLACE) + + cmor.dataset('historical', 'ukmo', 'HadCM3', '360_day',model_id='HadCM3',forcing='Nat', + contact="J.T. Snow", + institute_id="PCMDI", + parent_experiment_id="N/A", + parent_experiment_rip="N/A", + branch_time=0) + + table='CMIP5_Amon' + cmor.load_table(table) + axes = [ {'table_entry': 'time2', + 'units': 'months since 2000-01-01 00:00:00', + 'coord_vals': times, + 'cell_bounds': times_bnds, + }, + {'table_entry': 'plevs', + 'units': 'Pa', + 'coord_vals': [100000., 92500., 85000., 70000., 60000., 50000., + 40000., 30000., 25000., 20000., 15000., + 10000., 7000., 5000., 3000., 2000., 1000.]}, + {'table_entry': 'latitude', + 'units': 'degrees_north', + 'coord_vals': [0], + 'cell_bounds': [-1, 1]}, + {'table_entry': 'longitude', + 'units': 'degrees_east', + 'coord_vals': [90], + 'cell_bounds': [89, 91]}, + ] + + axis_ids = list() + for axis in axes: + axis_id = cmor.axis(**axis) + axis_ids.append(axis_id) + varid = cmor.variable('co2Clim', '1.e-6', axis_ids) + import numpy + data =numpy.array([3,4,5]) + data.resize((3,17,1,1)) + cmor.write(varid, data) + path=cmor.close(varid, file_name=True) + + print path + +if __name__ == '__main__': + path_test()