diff --git a/earthdiagnostics/cmorizer.py b/earthdiagnostics/cmorizer.py index ae200776f18ad72fb66e5bd7576c77cc3bb8b200..cc254ead6a10a592d691db88ec1210d9d509f281 100644 --- a/earthdiagnostics/cmorizer.py +++ b/earthdiagnostics/cmorizer.py @@ -507,8 +507,6 @@ class Cmorizer(object): # remap on regular Gauss grid codes = self.cmor.get_requested_codes() - if 228 in codes: - codes.update((142, 143)) codes_str = ",".join([str(code) for code in codes]) try: if grid == "SH": @@ -526,15 +524,6 @@ class Cmorizer(object): output=gribfile + "_", options="-R -f nc4 -t ecmwf", ) - # total precipitation (remove negative values) - if 228 in codes: - Utils.cdo().setcode( - 228, - input="-chname,LSP,TP -setmisstoc,0 -setvrange,0,Inf " - "-add {0}_142.128.nc {0}_143.128.nc".format(gribfile), - output="{0}_228.128.nc".format(gribfile), - options="-f nc4", - ) return True except CDOException: Log.info("No requested codes found in {0} file".format(grid)) diff --git a/earthdiagnostics/cmormanager.py b/earthdiagnostics/cmormanager.py index 9e9acaa3e02d97e3058d22e144418c43304ad69e..e9a0fc90217aa0a90d54da6585f4dc1e67f4109b 100644 --- a/earthdiagnostics/cmormanager.py +++ b/earthdiagnostics/cmormanager.py @@ -511,7 +511,7 @@ class CMORManager(DataManager): else: raise ( Exception( - "Error appeared while cmorizing startdate {0}" + "Error appeared while cmorizing startdate {0} " "member {1}!".format(startdate, member_str) ) ) diff --git a/test/integration/test_cmorizer.py b/test/integration/test_cmorizer.py index 74a04024302a24754a76bdf600480bfe928b3ec8..14ee5db2b184f6566c831845a678eb86924ec22c 100644 --- a/test/integration/test_cmorizer.py +++ b/test/integration/test_cmorizer.py @@ -570,7 +570,7 @@ class TestCmorizer(TestCase): coord_data, folder_path, filename.replace("??", "GG"), - [142, 143, 129, 169, 180], + [142, 143, 129, 169, 180, 228], month, ) self._create_file_for_grib( @@ -682,17 +682,14 @@ class TestCmorizer(TestCase): daily_offsets[0] = 0.5 hourly_offsets = np.arange(0.25, 59, 0.25) - factor = 1.0 if code == 129: factor = 9.81 elif code in (180, 169): factor = 6 * 3600.0 - elif code == 228: - base_data = np.ones((2, 2, 2), np.float) * (142 + 143) - month_offsets *= 2 - daily_offsets *= 2 - hourly_offsets *= 2 - factor = 6 * 3600.0 / 1000 + elif code in (228, ): + factor = 6 * 3.6 + else: + factor = 1.0 base_data /= factor month_offsets /= factor @@ -719,7 +716,8 @@ class TestCmorizer(TestCase): for x, offset in enumerate(offsets): self.assertTrue( np.allclose(data.data[x, ...], base_data + offset), - "{} {} data wrong for {}: {}".format( - freq, x, var, data.data[x, ...] - base_data + "{} {} data wrong for {}: {} {} {}".format( + freq, x, var, data.data[x, ...] - base_data, + data.data[x, ...], base_data ), )