Skip to content

Commit

Permalink
Moved closure out of unnecessary try block
Browse files Browse the repository at this point in the history
  • Loading branch information
RoryPTB committed Mar 6, 2024
1 parent 292ebdc commit 88acf25
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions synop2bufr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1554,22 +1554,23 @@ def transform(data: str, metadata: str, year: int,
# Stop duplicated warnings
can_var_warning_be_displayed = False

# Now we need to add the mappings for the cloud groups
# Define a new method which handles the updating of
# the mapping file with section 3 and 4 cloud data
def update_data_mapping(mapping: list, update: dict):
match = False
for idx in range(len(mapping)):
if mapping[idx]['eccodes_key'] == update['eccodes_key']: # noqa
match = True
break
if match:
mapping[idx] = update
else:
mapping.append(update)
return mapping

# Now we add the mappings for the cloud groups
# of section 3 and 4
try:
# Define a new method which handles the updating of
# the mapping file with section 3 and 4 cloud data
def update_data_mapping(mapping: list, update: dict):
match = False
for idx in range(len(mapping)):
if mapping[idx]['eccodes_key'] == update['eccodes_key']: # noqa
match = True
break
if match:
mapping[idx] = update
else:
mapping.append(update)
return mapping

# Now add the rest of the mappings for section 3 clouds
for idx in range(num_s3_clouds):
Expand Down

0 comments on commit 88acf25

Please sign in to comment.