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

BSTAR (drag) not being parsed correctly in some cases #66

Open
gabeblack opened this issue Feb 24, 2020 · 1 comment
Open

BSTAR (drag) not being parsed correctly in some cases #66

gabeblack opened this issue Feb 24, 2020 · 1 comment
Labels

Comments

@gabeblack
Copy link

if the drag term has a leading zero(s), the code converts it to an integer (parseInt), but then back in to a string later when it gives it to parseFloat. This causes the leading zero to be dropped and it erroneously calculates the drag term.

I'm guessing that the nddot parameter suffers from the same issue.

@thkruz thkruz added the bug label Jan 14, 2024
@thkruz
Copy link
Collaborator

thkruz commented Jan 14, 2024

No disagreements on this bug.

  satrec.nddot = parseFloat(
    `.${parseInt(longstr1.substring(44, 50), 10)}E${longstr1.substring(
      50,
      52,
    )}`,
  );
  satrec.bstar = parseFloat(
    `${longstr1.substring(53, 54)}.${parseInt(
      longstr1.substring(54, 59),
      10,
    )}E${longstr1.substring(59, 61)}`,
  );

Full code here

The solution is to skip the parseInt all together:

satrec.nddot = parseFloat(
      `${tleLine1.substring(44, 45)}.${tleLine1.substring(45, 50)}E${tleLine1.substring(50, 52)}`,
    );
    satrec.bstar = parseFloat(
      `${tleLine1.substring(53, 54)}.${tleLine1.substring(54, 59)}E${tleLine1.substring(59, 61)}`,
    );

Since this falls into the category of a fix vs an upgrade, I will try to get a PR in tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants