Skip to content
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

Store MMSI identifier as strings with leading zeros (#6) #9

Merged
merged 1 commit into from
Jan 2, 2021

Conversation

M0r13n
Copy link
Owner

@M0r13n M0r13n commented Jan 2, 2021

As stated by @ajakz (#6 ), a MMSI identifier is a 9-digit number - which ALWAYS has 9 digits and therefore can not be stored as a native int.

I firstly thought about adding the option to enable/disable this feature in order to not break with the current API. But after a bit of research I decided make a break and store MMSI's as strings from now on. The reasons for that are:

  • it is common to do that (all other libs are doing it)
  • storing the mmsi as an int is False (123 != "00123")
  • leading zeros may have a meaning and should not be dropped

This means that you might need to update your code, if you want to use the lib from now on.

@M0r13n M0r13n linked an issue Jan 2, 2021 that may be closed by this pull request
@M0r13n M0r13n merged commit 93a67f9 into master Jan 2, 2021
@aspcanada
Copy link

@M0r13n when do you think this will be available on PyPi?

@M0r13n
Copy link
Owner Author

M0r13n commented Jan 5, 2021

@aspcanada It is with version 1.3.0 (which is the most recent one). You should be able to upgrade via pip.

@aspcanada
Copy link

I think you forgot to update mothership_mmsi in decode.py

@M0r13n
Copy link
Owner Author

M0r13n commented Jan 29, 2021

Yes. You are totally right. I will fix it over the weekend.

Thanks for the mention!

@M0r13n
Copy link
Owner Author

M0r13n commented Jan 30, 2021

Fixed the bug with Version 1.3.1 which is available in Pypi now.

jimbofreedman pushed a commit to Spot-Ship/pyais that referenced this pull request Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Decoding MMSI as int loses leading zeroes
2 participants