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

ValueError: cannot convert float NaN to integer #110

Open
ctwillson opened this issue May 9, 2024 · 0 comments
Open

ValueError: cannot convert float NaN to integer #110

ctwillson opened this issue May 9, 2024 · 0 comments

Comments

@ctwillson
Copy link

I want to use keplerian2ecef to get satellite positions,however,it shows error" T0 = [datetime(1980, 1, 6) + timedelta(weeks=week) for week in weeks].
ValueError: cannot convert float NaN to intege"

import georinex as gr
import sys
import georinex.plots as grp
from matplotlib.pyplot import show
from georinex.keplerian import keplerian2ecef
try:
    import pymap3d as pm
except ImportError:
    pm = None
print(sys.version)
nav = gr.load("./data/BRDC00WRD_R_20221260000_01D_GN.rnx")

# grp.timeseries(nav)
# show()
svs = nav.sv.values
for sv in svs:
    if sv[0] == "S":
        lat, lon, alt = pm.ecef2geodetic(
            nav.sel(sv=sv)["X"].dropna(dim="time", how="all"),
            nav.sel(sv=sv)["Y"].dropna(dim="time", how="all"),
            nav.sel(sv=sv)["Z"].dropna(dim="time", how="all"),
        )

        if ((alt < 35.7e6) | (alt > 35.9e6)).any():
            logging.warning("unrealistic geostationary satellite altitudes")

        if ((lat < -1) | (lat > 1)).any():
            logging.warning("unrealistic geostationary satellite latitudes")

    elif sv[0] == "R":
        lat, lon, alt = pm.ecef2geodetic(
            nav.sel(sv=sv)["X"].dropna(dim="time", how="all"),
            nav.sel(sv=sv)["Y"].dropna(dim="time", how="all"),
            nav.sel(sv=sv)["Z"].dropna(dim="time", how="all"),
        )

        if ((alt < 19.0e6) | (alt > 19.4e6)).any():
            logging.warning("unrealistic GLONASS satellite altitudes")

        if ((lat < -67) | (lat > 67)).any():
            logging.warning("GLONASS inclination ~ 65 degrees")

    elif sv[0] == "G":
        ecef = keplerian2ecef(nav.sel(sv=sv))
        lat, lon, alt = pm.ecef2geodetic(*ecef)

        if ((alt < 19.4e6) | (alt > 21.0e6)).any():
            logging.warning("unrealistic GPS satellite altitudes")

        if ((lat < -57) | (lat > 57)).any():
            logging.warning("GPS inclination ~ 55 degrees")
    elif sv[0] == "E":
        ecef = keplerian2ecef(nav.sel(sv=sv))
        lat, lon, alt = pm.ecef2geodetic(*ecef)

        if ((alt < 23e6) | (alt > 24e6)).any():
            logging.warning("unrealistic Galileo satellite altitudes")

        if ((lat < -57) | (lat > 57)).any():
            logging.warning("Galileo inclination ~ 56 degrees")

    else:
        continue

Ephemeris like this

     3.05           N: GNSS NAV DATA    G: GPS              RINEX VERSION / TYPE
BNC 2.13.0          BKG Frankfurt       20220507 001902 UTC PGM / RUN BY / DATE
Concatenated RINEX files (9)                                COMMENT
                                                            END OF HEADER
G07 2022 05 06 00 00 00 3.217239864170e-04 5.684341886080e-13 0.000000000000e+00
     8.000000000000e+00 1.187500000000e+00 4.606620455660e-09-3.122333920780e+00
    -6.519258022310e-08 1.602555287540e-02 7.821246981620e-06 5.153665773390e+03
     4.320000000000e+05 2.421438694000e-08-1.557631989280e-01-2.104789018630e-07
     9.511318673290e-01 2.214687500000e+02-2.271997647470e+00-7.715678531840e-09
    -3.250135381180e-10 1.000000000000e+00 2.208000000000e+03 0.000000000000e+00
     2.000000000000e+00 0.000000000000e+00-1.117587089540e-08 8.000000000000e+00
     4.248180000000e+05 4.000000000000e+00                                      
G05 2022 05 06 00 00 00-8.079828694460e-05-1.364242052660e-12 0.000000000000e+00
     1.570000000000e+02-7.093750000000e+01 4.501258924070e-09 2.081511701720e-01
    -3.453344106670e-06 5.958021502010e-03 8.767470717430e-06 5.153718662260e+03
     4.320000000000e+05-2.048909664150e-08-2.297087023150e+00 2.048909664150e-08
     9.605837356880e-01 2.080625000000e+02 1.015547250280e+00-8.036049019410e-09
     1.235765760320e-10 1.000000000000e+00 2.208000000000e+03 0.000000000000e+00
     2.000000000000e+00 0.000000000000e+00-1.117587089540e-08 1.570000000000e+02
     4.295460000000e+05 4.000000000000e+00                                      
G06 2022 05 06 00 00 00 2.923775464300e-04 1.432454155290e-11 0.000000000000e+00
     7.600000000000e+01-7.490625000000e+01 4.070883854370e-09-2.213910507260e+00
    -3.771856427190e-06 2.603406319390e-03 4.682689905170e-06 5.153719142910e+03
     4.320000000000e+05-4.470348358150e-08 2.985543085520e+00 2.048909664150e-08
     9.872213746240e-01 3.044687500000e+02-8.647091098970e-01-7.836397846000e-09
    -4.464471677450e-11 1.000000000000e+00 2.208000000000e+03 0.000000000000e+00
     2.000000000000e+00 0.000000000000e+00 3.725290298460e-09 7.600000000000e+01
     4.248180000000e+05 4.000000000000e+00 
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

No branches or pull requests

1 participant