GEUS-Glaciology-and-Climate / pypromice

Process AWS data from L0 (raw logger) through Lx (end user)
https://pypromice.readthedocs.io
GNU General Public License v2.0
12 stars 4 forks source link

L0tx cp850 decoding bug #132

Open PennyHow opened 1 year ago

PennyHow commented 1 year ago

There are instances where L0tx transmission messages require cp850 decoding. Usually, the first character is dropped from the transmission as this is the payload format indicator. However, in the instance of cp850 decoding, the first character is part of the transmission message. Therefore, this causes the first character to be dropped - this is always the "2" in the year part of the timestamp (i.e. returning "023" instead of "2023").

https://github.com/GEUS-Glaciology-and-Climate/pypromice/blob/c5613a942d7e79089865f4f5837313bf6abe3461/src/pypromice/tx/tx.py#L559

https://github.com/GEUS-Glaciology-and-Climate/pypromice/blob/c5613a942d7e79089865f4f5837313bf6abe3461/src/pypromice/tx/tx.py#L633

The current de-bug just adds the first "2" character onto the string, but really we should restructure this so that the first character is retained. This may be simple and only require L559 to be moved to after the if statement, it just hasn't been tested.

Recreating the current de-bug

Download and unzip this example transmission messages from KAN_B: SBD Msg From Unit: 300034012256830_1500013.zip

from pypromice.tx import L0tx, loadMsg

# Load transmission message
f = "SBD Msg From Unit: 300034012256830_1500013.msg"
msg = loadMsg(f)

# Extract L0tx data from message
tx = L0tx(msg)

# Print the original payload and the outputted L0tx data
print(tx.payload)
print(tx.msg)

The pypromice.tx.L0tx.getDataLine() is where the decoding occurs.

dataline = tx.getDataLine()