From 83d6d767701b625e4f30e27ca7bc1ddbc2b73e4f Mon Sep 17 00:00:00 2001 From: Christian Steger Date: Tue, 27 Jan 2026 13:21:18 +0100 Subject: [PATCH 1/3] Interpolation algorithm for ERA5 data to ICON grid changed to bilinear --- python/extpar_era_to_buffer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/extpar_era_to_buffer.py b/python/extpar_era_to_buffer.py index dc5eb59a4..58419e9f8 100755 --- a/python/extpar_era_to_buffer.py +++ b/python/extpar_era_to_buffer.py @@ -144,7 +144,7 @@ logging.info('') # calculate weights -utils.launch_shell('cdo', '-f', 'nc4', lock, '-P', omp, f'genycon,{grid}', +utils.launch_shell('cdo', '-f', 'nc4', lock, '-P', omp, f'genbil,{grid}', tg.cdo_sellonlat(), raw_data_sst, weights) # regrid SST From 916bc3e87037848f3c1d701bec9378efdc65ab46 Mon Sep 17 00:00:00 2001 From: Christian Steger Date: Wed, 1 Apr 2026 18:09:12 +0200 Subject: [PATCH 2/3] Interpolation of ERA5 data to ICON/COSMO grid made resolution-dependent (target grid finer resolution: bilinear interpolation; target grid coarser resolution: conservative remapping) --- python/extpar_era_to_buffer.py | 9 +++++++-- python/lib/grid_def.py | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/python/extpar_era_to_buffer.py b/python/extpar_era_to_buffer.py index 58419e9f8..84f52b984 100755 --- a/python/extpar_era_to_buffer.py +++ b/python/extpar_era_to_buffer.py @@ -144,8 +144,13 @@ logging.info('') # calculate weights -utils.launch_shell('cdo', '-f', 'nc4', lock, '-P', omp, f'genbil,{grid}', - tg.cdo_sellonlat(), raw_data_sst, weights) +era_5_resolution = 31.0 # approximate ERA5 resolution [km] +if (tg.resolution < era_5_resolution): + utils.launch_shell('cdo', '-f', 'nc4', lock, '-P', omp, f'genbil,{grid}', + tg.cdo_sellonlat(), raw_data_sst, weights) +else: + utils.launch_shell('cdo', '-f', 'nc4', lock, '-P', omp, f'genycon,{grid}', + tg.cdo_sellonlat(), raw_data_sst, weights) # regrid SST utils.launch_shell('cdo', '-f', 'nc4', lock, '-P', omp, diff --git a/python/lib/grid_def.py b/python/lib/grid_def.py index a1c9aec4a..5d085b242 100644 --- a/python/lib/grid_def.py +++ b/python/lib/grid_def.py @@ -72,6 +72,9 @@ def __init__(self, namelist): self.lats, self.lons = self.latlon_cosmo_to_latlon_regular() + self.resolution = ((2.0 * np.pi * 6.371229 * 10 ** 3) + / 360.0 * self.dlon) # [km] + def create_grid_description(self, name): ''' write grid description required for cdo @@ -263,6 +266,9 @@ def __init__(self, gridfile): self.vlons = np.rad2deg(self.grid.variables["vlon"][:]) self.vlats = np.rad2deg(self.grid.variables["vlat"][:]) + self.resolution = (5050.0 / (self.grid.grid_root + * 2 ** self.grid.grid_level)) # [km] + def cdo_sellonlat(self, dlon=1.0, dlat=1.0): ''' create the string for the cdo option "-sellonlatbox" From 766928f8644c2079cb7a03c88b395429858413d6 Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 1 Apr 2026 16:09:42 +0000 Subject: [PATCH 3/3] GitHub Action: Apply Pep8-formatting --- python/extpar_era_to_buffer.py | 6 +++--- python/lib/grid_def.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/python/extpar_era_to_buffer.py b/python/extpar_era_to_buffer.py index 84f52b984..08c28a8ef 100755 --- a/python/extpar_era_to_buffer.py +++ b/python/extpar_era_to_buffer.py @@ -144,13 +144,13 @@ logging.info('') # calculate weights -era_5_resolution = 31.0 # approximate ERA5 resolution [km] +era_5_resolution = 31.0 # approximate ERA5 resolution [km] if (tg.resolution < era_5_resolution): utils.launch_shell('cdo', '-f', 'nc4', lock, '-P', omp, f'genbil,{grid}', - tg.cdo_sellonlat(), raw_data_sst, weights) + tg.cdo_sellonlat(), raw_data_sst, weights) else: utils.launch_shell('cdo', '-f', 'nc4', lock, '-P', omp, f'genycon,{grid}', - tg.cdo_sellonlat(), raw_data_sst, weights) + tg.cdo_sellonlat(), raw_data_sst, weights) # regrid SST utils.launch_shell('cdo', '-f', 'nc4', lock, '-P', omp, diff --git a/python/lib/grid_def.py b/python/lib/grid_def.py index 5d085b242..36d8b8db5 100644 --- a/python/lib/grid_def.py +++ b/python/lib/grid_def.py @@ -72,8 +72,8 @@ def __init__(self, namelist): self.lats, self.lons = self.latlon_cosmo_to_latlon_regular() - self.resolution = ((2.0 * np.pi * 6.371229 * 10 ** 3) - / 360.0 * self.dlon) # [km] + self.resolution = ( + (2.0 * np.pi * 6.371229 * 10**3) / 360.0 * self.dlon) # [km] def create_grid_description(self, name): ''' @@ -266,8 +266,8 @@ def __init__(self, gridfile): self.vlons = np.rad2deg(self.grid.variables["vlon"][:]) self.vlats = np.rad2deg(self.grid.variables["vlat"][:]) - self.resolution = (5050.0 / (self.grid.grid_root - * 2 ** self.grid.grid_level)) # [km] + self.resolution = ( + 5050.0 / (self.grid.grid_root * 2**self.grid.grid_level)) # [km] def cdo_sellonlat(self, dlon=1.0, dlat=1.0): '''