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

Encountering errors from test_czml_ground_station and test_czml_add_orbit #821

Closed
OrbitalMechanic opened this issue Aug 24, 2019 · 7 comments
Closed

Comments

@OrbitalMechanic
Copy link

@OrbitalMechanic OrbitalMechanic commented Aug 24, 2019

I'm running poliastro ver. 0.13.0 on an iMacPro running Mac OS X ver. 10.14.6 under Python 3.7.3. In running the test,

python -c "import poliastro.testing; poliastro.testing.test()

I get error messages concerning test_czml_add_orbit and test_ground_station. I'm testing poliastro with the setup.cfg file in the anaconda3 directory disabled (i.e., renamed so as not to be used). czml3 was installed.

The output from the test is contained in the attached file.

Please advise.

Sam Dupree.

poliastro_test_23-Aug-2019.txt

@Juanlu001

This comment has been minimized.

Copy link
Member

@Juanlu001 Juanlu001 commented Aug 24, 2019

@Juanlu001

This comment has been minimized.

Copy link
Member

@Juanlu001 Juanlu001 commented Sep 6, 2019

I was just bitten by this. To reproduce on poliastro:

$ TOXENV=py37 MPLBACKEND=Agg tox -- -k czml_groundtrack
GLOB sdist-make: /home/juanlu/Development/poliastro/poliastro/setup.py
py37 inst-nodeps: /home/juanlu/Development/poliastro/poliastro/.tox/.tmp/package/1/poliastro-0.13.post0.dev0.zip
py37 installed: alabaster==0.7.12,appdirs==1.4.3,asn1crypto==0.24.0,astropy==3.2.1,astroquery==0.3.9,atomicwrites==1.3.0,attrs==19.1.0,Babel==2.7.0,backcall==0.1.0,beautifulsoup4==4.8.0,black==19.3b0,bleach==3.1.0,certifi==2019.6.16,cffi==1.12.3,chardet==3.0.4,Click==7.0,coverage==4.5.4,cryptography==2.7,cycler==0.10.0,czml3==0.1.3,decorator==4.4.0,defusedxml==0.6.0,docutils==0.15.2,entrypoints==0.3,filelock==3.0.12,html5lib==1.0.1,idna==2.8,imagesize==1.1.0,importlib-metadata==0.20,ipykernel==5.1.2,ipython==7.8.0,ipython-genutils==0.2.0,isort==4.3.21,jedi==0.15.1,jeepney==0.4.1,Jinja2==2.10.1,jplephem==2.9,jsonschema==3.0.2,jupyter-client==5.3.1,jupyter-core==4.5.0,keyring==19.1.0,kiwisolver==1.1.0,llvmlite==0.29.0,MarkupSafe==1.1.1,matplotlib==3.1.1,mistune==0.8.4,more-itertools==7.2.0,mypy==0.720,mypy-extensions==0.4.1,nbconvert==5.6.0,nbformat==4.4.0,nbsphinx==0.4.2,nose==1.3.7,numba==0.45.1,numpy==1.17.1,packaging==19.1,pandas==0.25.1,pandocfilters==1.4.2,parso==0.5.1,pexpect==4.7.0,pickleshare==0.7.5,plotly==4.1.1,pluggy==0.12.0,poliastro==0.13.post0.dev0,prompt-toolkit==2.0.9,ptyprocess==0.6.0,py==1.8.0,pycodestyle==2.5.0,pycparser==2.19,Pygments==2.4.2,pyparsing==2.4.2,pyrsistent==0.15.4,pytest==5.1.2,pytest-cov==2.5.1,pytest-doctestplus==0.3.0,pytest-mpl==0.10,pytest-mypy==0.4.0,pytest-remotedata==0.3.2,python-dateutil==2.8.0,pytz==2019.2,pyzmq==18.1.0,requests==2.22.0,retrying==1.3.3,scipy==1.3.1,SecretStorage==3.1.1,six==1.12.0,snowballstemmer==1.2.1,soupsieve==1.9.3,Sphinx==2.2.0,sphinx-notfound-page==0.4,sphinx-rtd-theme==0.4.3+require.redef,sphinxcontrib-applehelp==1.0.1,sphinxcontrib-devhelp==1.0.1,sphinxcontrib-htmlhelp==1.0.2,sphinxcontrib-jsmath==1.0.1,sphinxcontrib-qthelp==1.0.2,sphinxcontrib-serializinghtml==1.1.3,testpath==0.4.2,toml==0.10.0,tornado==6.0.3,tox==3.14.0,traitlets==4.3.2,typed-ast==1.4.0,typing-extensions==3.7.4,urllib3==1.25.3,virtualenv==16.7.5,w3lib==1.21.0,wcwidth==0.1.7,webencodings==0.5.1,zipp==0.6.0
py37 run-test-pre: PYTHONHASHSEED='2024299889'
py37 run-test: commands[0] | pytest -m 'not mpl_image_compare' -k czml_groundtrack
============================================= test session starts ==============================================
platform linux -- Python 3.7.4, pytest-5.1.2, py-1.8.0, pluggy-0.12.0
cachedir: .tox/py37/.pytest_cache
Matplotlib: 3.1.1
Freetype: 2.6.1
rootdir: /home/juanlu/Development/poliastro/poliastro, inifile: setup.cfg
plugins: mypy-0.4.0, remotedata-0.3.2, mpl-0.10, doctestplus-0.3.0, cov-2.5.1
collected 898 items / 897 deselected / 1 selected                                                              

src/poliastro/tests/test_czml.py F                                                                       [100%]

=================================================== FAILURES ===================================================
____________________________________________ test_czml_groundtrack _____________________________________________

    @pytest.mark.skipif("czml3" not in sys.modules, reason="requires czml3")
    def test_czml_groundtrack():
    
        start_epoch = molniya.epoch
        end_epoch = molniya.epoch + molniya.period
    
        sample_points = 10
    
        expected_doc = """[{
        "id": "document",
        "version": "1.0",
        "name": "document_packet",
        "clock": {
            "interval": "2000-01-01T12:00:00.000/2000-01-01T23:59:35.108",
            "currentTime": "2000-01-01T12:00:00.000",
            "multiplier": 60,
            "range": "LOOP_STOP",
            "step": "SYSTEM_CLOCK_MULTIPLIER"
        }
    }, {
        "id": "custom_properties",
        "properties": {
            "custom_attractor": true,
            "ellipsoid": [
                {
                    "array": [
                        6378136.6,
                        6378136.6,
                        6356751.9
                    ]
                }
            ],
            "map_url": [
                "https://upload.wikimedia.org/wikipedia/commons/c/c4/Earthmap1000x500compac.jpg"
            ],
            "scene3D": true
        }
    }, {
        "id": 0,
        "availability": "2000-01-01T12:00:00Z/2000-01-01T23:59:35Z",
        "position": {
            "epoch": "2000-01-01T12:00:00.000",
            "interpolationAlgorithm": "LAGRANGE",
            "interpolationDegree": 5,
            "referenceFrame": "INERTIAL",
            "cartesian": [
                0.0,
                10140093.6393,
                -800580.7546,
                -1598722.8246,
                4317.5108,
                17593269.6479,
                8807305.9945,
                17587783.6632,
                8635.0217,
                15276972.8693,
                14840949.3322,
                29636690.9896,
                12952.5325,
                10390291.9946,
                18544487.5609,
                37032485.9349,
                17270.0433,
                4459288.7909,
                20454288.4376,
                40846270.159,
                21587.5541,
                -1827745.3661,
                20778744.495,
                41494193.9337,
                25905.065,
                -7974181.1167,
                19549661.224,
                39039771.3569,
                30222.5758,
                -13412369.429,
                16641263.6853,
                33231835.6785,
                34540.0866,
                -17116767.3657,
                11688710.5829,
                23341815.6655,
                38857.5975,
                -15852598.671,
                3766095.5927,
                7520719.1144,
                43175.1083,
                10140093.6393,
                -800580.7546,
                -1598722.8246,
                47492.6191,
                17593269.6479,
                8807305.9945,
                17587783.6632
            ]
        },
        "billboard": {
            "show": true,
            "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADJSURBVDhPnZHRDcMgEEMZjVEYpaNklIzSEfLfD4qNnXAJSFWfhO7w2Zc0Tf9QG2rXrEzSUeZLOGm47WoH95x3Hl3jEgilvDgsOQUTqsNl68ezEwn1vae6lceSEEYvvWNT/Rxc4CXQNGadho1NXoJ+9iaqc2xi2xbt23PJCDIB6TQjOC6Bho/sDy3fBQT8PrVhibU7yBFcEPaRxOoeTwbwByCOYf9VGp1BYI1BA+EeHhmfzKbBoJEQwn1yzUZtyspIQUha85MpkNIXB7GizqDEECsAAAAASUVORK5CYII="
        },
        "label": {
            "text": "Molniya",
            "font": "11pt Lucida Console",
            "style": "FILL",
            "fillColor": {
                "rgba": [
                    125,
                    80,
                    120,
                    255
                ]
            },
            "outlineColor": {
                "rgba": [
                    255,
                    255,
                    0,
                    255
                ]
            },
            "outlineWidth": 1.0
        },
        "path": {
            "resolution": 120,
            "material": {
                "solidColor": {
                    "color": {
                        "rgba": [
                            255,
                            255,
                            0,
                            255
                        ]
                    }
                }
            }
        }
    }, {
        "id": "groundtrack0",
        "availability": "2000-01-01T12:00:00Z/2000-01-01T23:59:35Z",
        "position": {
            "epoch": "2000-01-01T12:00:00.000",
            "interpolationAlgorithm": "LAGRANGE",
            "interpolationDegree": 5,
            "referenceFrame": "INERTIAL",
            "cartesian": [
                0.0,
                6280728.255788034,
                -495875.99989224557,
                -990241.5895687921,
                4317.5108,
                4245756.819479091,
                2125453.716924488,
                4244432.895224581,
                8635.0217,
                2663915.8656318397,
                2587884.4433988784,
                5167885.717379646,
                12952.5325,
                1548100.5195240811,
                2763033.9962378335,
                5517651.292250773,
                17270.0433,
                618022.3343837302,
                2834803.0552899935,
                5660970.791429868,
                21587.5541,
                -250341.43583128517,
                2846010.7675710567,
                5683352.0756686535,
                25905.065,
                -1142958.8118256037,
                2802100.92918071,
                5595666.1546065565,
                30222.5758,
                -2159933.044540537,
                2679915.6206089617,
                5351667.73157586,
                34540.0866,
                -3490752.3604656975,
                2383767.686202804,
                4760273.972119002,
                38857.5975,
                -5630876.894771479,
                1337725.3192625502,
                2671375.634339552,
                43175.1083,
                6280728.255788034,
                -495875.99989224557,
                -990241.5895687921,
                47492.6191,
                4245756.819479091,
                2125453.716924488,
                4244432.895224581
            ]
        },
        "path": {
            "show": true,
            "leadTime": 100,
            "trailTime": 100,
            "resolution": 60,
            "material": {
                "solidColor": {
                    "color": {
                        "rgba": [
                            255,
                            255,
                            0,
                            255
                        ]
                    }
                }
            }
        }
    }]"""
        extractor = CZMLExtractor(start_epoch, end_epoch, sample_points)
    
        extractor.add_orbit(
            molniya,
            rtol=1e-4,
            label_text="Molniya",
            groundtrack_show=True,
            label_fill_color=[125, 80, 120, 255],
        )
    
>       assert repr(extractor.packets) == expected_doc
E       assert '[{\n    "id"... }\n    }\n}]' == '[{\n    "id"... }\n    }\n}]'
E         Skipping 803 identical leading characters in diff, use -v to show
E         Skipping 2041 identical trailing characters in diff, use -v to show
E         - 00-01-01T11:00:00Z/2000-01-01T22:59:35Z",
E         ?           ^                    ^
E         + 00-01-01T12:00:00Z/2000-01-01T23:59:35Z",
E         ?           ^                    ^
E               "position": {...
E         
E         ...Full output truncated (103 lines hidden), use '-vv' to show

src/poliastro/tests/test_czml.py:534: AssertionError
=============================================== warnings summary ===============================================
.tox/py37/lib/python3.7/site-packages/nbformat/notebooknode.py:4
  /home/juanlu/Development/poliastro/poliastro/.tox/py37/lib/python3.7/site-packages/nbformat/notebooknode.py:4: DeprecationWarning:
  
  Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working

-- Docs: https://docs.pytest.org/en/latest/warnings.html
================================ 1 failed, 897 deselected, 1 warnings in 7.66s =================================
ERROR: InvocationError for command /home/juanlu/Development/poliastro/poliastro/.tox/py37/bin/pytest -m 'not mpl_image_compare' -k czml_groundtrack (exited with code 1)
___________________________________________________ summary ____________________________________________________
ERROR:   py37: commands failed

@Sedictious do you want to try and fix this one?

@Sedictious

This comment has been minimized.

Copy link
Member

@Sedictious Sedictious commented Sep 6, 2019

Oh no, time-zones again?
I'll check once I get back home, any idea what might be causing this @Juanlu001?

On a second thought, could we dynamically generate some tests on-spot (perhaps by regex matching and adding the system time to the date string)?

@Juanlu001

This comment has been minimized.

Copy link
Member

@Juanlu001 Juanlu001 commented Sep 7, 2019

@Juanlu001

This comment has been minimized.

Copy link
Member

@Juanlu001 Juanlu001 commented Oct 13, 2019

Culprit:

>>> from czml3.types import format_datetime_like
>>> from astropy import time
>>> t = time.Time("2013-03-18 12:00", scale="utc")
>>> t
<Time object: scale='utc' format='iso' value=2013-03-18 12:00:00.000>
>>> format_datetime_like(t)
'2013-03-18T12:00:00Z'
>>> format_datetime_like(t.datetime)
'2013-03-18T10:00:00Z'
@Juanlu001

This comment has been minimized.

Copy link
Member

@Juanlu001 Juanlu001 commented Oct 13, 2019

Therefore, it turns out this is a problem in poliastro and not in czml3. Fixing it in #783 and closing this.

@Juanlu001 Juanlu001 closed this Oct 13, 2019
@OrbitalMechanic

This comment has been minimized.

Copy link
Author

@OrbitalMechanic OrbitalMechanic commented Oct 14, 2019

@Juanlu001 Juanlu001 transferred this issue from poliastro/czml3 Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.