-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correct section 3 and 4 mappings + more #49
Conversation
…w csv2bufr/pymetdecoder versions
synop2bufr/__init__.py
Outdated
# Check if the beginning of the message, that we're about to throw | ||
# away (data[0]), also contains AAXX and thus there must be a | ||
# typo present at the AAXX YYGGiw part of the report | ||
if data[0].__contains__("AAXX"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"AAXX" in data[0]?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the message is split around AAXX YYGGiw (with an indefinite number of spaces between AAXX and YYGGiw as sometimes there is an extra space by accident), data[0] would be the part of the message before this section (e.g. ZCZC 123 SMCU20 MUHV 310000). This is normally discarded, but if it contains 'AAXX', then that means the splitting of the message has gone wrong due to a typo somewhere. There was a bad piece of data that motivated this change but it's been so long now I can't remember.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that, but why are we using __contains__
rather than in
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are equivalent but I will change it to in
, I can't remember why I put __contains__
.
synop2bufr/__init__.py
Outdated
@@ -1544,6 +1557,21 @@ def transform(data: str, metadata: str, year: int, | |||
# Now we need to 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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this embedded in the try block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No particular reason. It was an oversight to put that closure in the try block since the code immediately after must be, in case no station height is provided for the station in question.
Summary of changes made: