diff --git a/esmvalcore/preprocessor/__init__.py b/esmvalcore/preprocessor/__init__.py index 39027da125..8cd0a8dda4 100644 --- a/esmvalcore/preprocessor/__init__.py +++ b/esmvalcore/preprocessor/__init__.py @@ -8,6 +8,8 @@ from .._provenance import TrackedFile from .._task import BaseTask +from ..cmor.check import cmor_check_data, cmor_check_metadata +from ..cmor.fix import fix_data, fix_file, fix_metadata from ._area import (area_statistics, extract_named_regions, extract_region, extract_shape, meridional_statistics, zonal_statistics) from ._cycles import amplitude @@ -21,8 +23,6 @@ mask_landsea, mask_landseaice, mask_outside_range) from ._multimodel import multi_model_statistics from ._other import clip -from ._reformat import (cmor_check_data, cmor_check_metadata, fix_data, - fix_file, fix_metadata) from ._regrid import extract_levels, extract_point, regrid from ._time import (annual_statistics, anomalies, climate_statistics, daily_statistics, decadal_statistics, extract_month, @@ -54,6 +54,7 @@ 'extract_month', # Data reformatting/CMORization 'fix_data', + 'cmor_check_data', # Level extraction 'extract_levels', # Weighting @@ -106,7 +107,6 @@ 'anomalies', 'regrid_time', 'timeseries_filter', - 'cmor_check_data', 'convert_units', # Save to file 'save', @@ -130,8 +130,8 @@ DEFAULT_ORDER = tuple(__all__) # The order of initial and final steps cannot be configured -INITIAL_STEPS = DEFAULT_ORDER[:DEFAULT_ORDER.index('fix_data') + 1] -FINAL_STEPS = DEFAULT_ORDER[DEFAULT_ORDER.index('cmor_check_data'):] +INITIAL_STEPS = DEFAULT_ORDER[:DEFAULT_ORDER.index('cmor_check_data') + 1] +FINAL_STEPS = DEFAULT_ORDER[DEFAULT_ORDER.index('save'):] MULTI_MODEL_FUNCTIONS = { 'multi_model_statistics', diff --git a/esmvalcore/preprocessor/_reformat.py b/esmvalcore/preprocessor/_reformat.py deleted file mode 100644 index c6ab17337b..0000000000 --- a/esmvalcore/preprocessor/_reformat.py +++ /dev/null @@ -1,13 +0,0 @@ -"""Simple interface to reformat and CMORize functions.""" -from ..cmor.check import cmor_check, cmor_check_data, cmor_check_metadata -from ..cmor.fix import fix_data, fix_file, fix_metadata - - -__all__ = [ - 'cmor_check', - 'cmor_check_metadata', - 'cmor_check_data', - 'fix_file', - 'fix_metadata', - 'fix_data', -] diff --git a/esmvalcore/preprocessor/_time.py b/esmvalcore/preprocessor/_time.py index 888266c578..acf17caa0c 100644 --- a/esmvalcore/preprocessor/_time.py +++ b/esmvalcore/preprocessor/_time.py @@ -471,6 +471,7 @@ def anomalies(cube, period, reference=None, standardize=False): cube_stddev = climate_statistics( cube, operator='std_dev', period=period) cube = cube / cube_stddev + cube.units = '1' return cube cube = _compute_anomalies(cube, reference, period) @@ -490,6 +491,7 @@ def anomalies(cube, period, reference=None, standardize=False): ) cube.data = cube.core_data() / da.concatenate( [cube_stddev.core_data() for _ in range(int(reps))], axis=tdim) + cube.units = '1' return cube diff --git a/tests/unit/preprocessor/_time/test_time.py b/tests/unit/preprocessor/_time/test_time.py index bffe806e9f..f6c4995492 100644 --- a/tests/unit/preprocessor/_time/test_time.py +++ b/tests/unit/preprocessor/_time/test_time.py @@ -1028,6 +1028,7 @@ def test_standardized_anomalies(period, standardize=True): result.data, expected ) + assert result.units == '1' else: expected = np.ma.masked_invalid(expected_anomalies) assert_array_equal(