Skip to content

Commit

Permalink
defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
david-i-berry committed Feb 2, 2024
1 parent bdfb79d commit 386e088
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
10 changes: 3 additions & 7 deletions csv2bufr/templates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,9 @@

_SUCCESS_ = True


# check env variables set
ORIGINATING_CENTRE = None
ORIGINATING_SUBCENTRE = None

ORIGINATING_CENTRE = os.environ.get('BUFR_ORIGINATING_CENTRE')
ORIGINATING_SUBCENTRE = os.environ.get('BUFR_ORIGINATING_SUBCENTRE')
# check if originating centre and subcentre are set as env , default to 255
ORIGINATING_CENTRE = os.environ.get('BUFR_ORIGINATING_CENTRE', 65535)
ORIGINATING_SUBCENTRE = os.environ.get('BUFR_ORIGINATING_SUBCENTRE', 65535)

if ORIGINATING_CENTRE is None:
msg = "Invalid BUFR originating centre, please ensure the BUFR_ORIGINATING_CENTRE is set to a valid value" # noqa
Expand Down
6 changes: 3 additions & 3 deletions tests/test_csv2bufr.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,13 @@ def test_transform(data_dict, mapping_dict):


def test_templates():
assert c2bt.load_template('21327aac-46a6-437d-ae81-7a16a637dd2c') is not None # noqa
tmpl = c2bt.load_template('21327aac-46a6-437d-ae81-7a16a637dd2c')
assert tmpl is not None
# check header centre and sub centre set to env
ocset = False
ocenv = os.environ['BUFR_ORIGINATING_CENTRE']
ocenv = os.environ.get('BUFR_ORIGINATING_CENTRE', 65535)
oscset = False
oscenv = os.environ['BUFR_ORIGINATING_SUBCENTRE']
oscenv = os.environ.get('BUFR_ORIGINATING_SUBCENTRE', 65535)
LOGGER.warning((tmpl['header']))
for hidx in range(len(tmpl['header'])):
LOGGER.warning(tmpl['header'][hidx]['eccodes_key'])
Expand Down

0 comments on commit 386e088

Please sign in to comment.