Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions python/extpar_era_to_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,13 @@
logging.info('')

# calculate weights
utils.launch_shell('cdo', '-f', 'nc4', lock, '-P', omp, f'genycon,{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,
Expand Down
6 changes: 6 additions & 0 deletions python/lib/grid_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down