Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
doc78 authored Apr 9, 2024
2 parents 7048871 + e82e448 commit 862730e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def _get_gdal_version():
packages=find_packages('src'),
keywords="NetCDF GRIB PCRaster Lisflood EFAS GLOFAS",
scripts=['bin/pyg2p'],
zip_safe=True,
zip_safe=False,
# setup.py publish to pypi.
cmdclass={
'upload': UploadCommand,
Expand Down
4 changes: 2 additions & 2 deletions src/pyg2p/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def __str__(self):

class Messages(Loggable):

def __init__(self, values, mv, unit, type_of_level, type_of_step, step_units, grid_details, val_2nd=None, data_date=None):
def __init__(self, values, mv, unit, type_of_level, type_of_step, step_units, grid_details, val_2nd=None, data_date=None, data_time='0'):
super().__init__()
self.values_first_or_single_res = values
self.values_second_res = val_2nd or {}
Expand All @@ -154,7 +154,7 @@ def __init__(self, values, mv, unit, type_of_level, type_of_step, step_units, gr
self.type_of_level = type_of_level
self.unit = unit
self.missing_value = mv
self.data_date = datetime.strptime(str(data_date), '%Y%m%d')
self.data_date = datetime.strptime(f'{data_date}{data_time}', '%Y%m%d%H')

self.grid_details = grid_details
# order key list to get first step
Expand Down
2 changes: 1 addition & 1 deletion src/pyg2p/main/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def add_args(parser):
type=int, metavar='tend')
parser.add_argument('-m', '--perturbationNumber', help='eps member number', type=int, metavar='eps_member')
parser.add_argument('-T', '--dataTime', help='To select messages by dataTime key value', type=int,
choices=['0', '1200'], metavar='data_time')
choices=[0, 1200], metavar='data_time')
parser.add_argument('-D', '--dataDate', help='<YYYYMMDD> to select messages by dataDate key value',
type=int, metavar='data_date')

Expand Down
3 changes: 2 additions & 1 deletion src/pyg2p/main/readers/grib.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def select_messages(self, **kwargs):

missing_value = codes_get(self._selected_grbs[0], 'missingValue')
data_date = codes_get(self._selected_grbs[0], 'dataDate')
data_time = codes_get(self._selected_grbs[0], 'dataTime')
all_values = {}
all_values_second_res = {}
grid2 = None
Expand Down Expand Up @@ -207,7 +208,7 @@ def select_messages(self, **kwargs):
if grid2:
key_2nd_spatial_res = min(all_values_second_res.keys())
grid.set_2nd_resolution(grid2, key_2nd_spatial_res)
return Messages(all_values, missing_value, unit, type_of_level, type_of_step, step_units, grid, all_values_second_res, data_date=data_date)
return Messages(all_values, missing_value, unit, type_of_level, type_of_step, step_units, grid, all_values_second_res, data_date=data_date, data_time=str(data_time)[:2])
# no messages found
else:
raise ApplicationException.get_exc(NO_MESSAGES, details=f'using {kwargs}')
Expand Down

0 comments on commit 862730e

Please sign in to comment.