pytroll / pyorbital

Orbital and astronomy computations in python
http://pyorbital.readthedocs.org/
GNU General Public License v3.0
224 stars 77 forks source link

Fixed comment in sun_earth_distance_correction #104

Closed depion closed 2 years ago

depion commented 2 years ago

This PR fixes an error in the comments of sun_earth_distance_correction in astronomy.py, see here and here. In the original comment, the semi-major axis was calculated as $a = 1.00000\mathbf{0}261 \text{ AU}$ and a there was a final zero too much in the actual figure of $a$. Now the comment represents the correct calculation $a = 1.00000261 \text{ AU}$.

djhoese commented 2 years ago

Hm I'm hoping this is just a random failure:

 ================================== FAILURES ===================================
________________________ TestSQLiteTLE.test_update_db _________________________
self = <pyorbital.tests.test_tlefile.TestSQLiteTLE testMethod=test_update_db>
    def test_update_db(self):
        """Test updating database with new data."""
        from pyorbital.tlefile import (table_exists, SATID_TABLE,
                                       ISO_TIME_FORMAT)
        # Get the column names
        columns = [col.strip() for col in
                   SATID_TABLE.replace("'{}' (", "").strip(')').split(',')]
        # Platform number
        satid = str(list(self.platforms.keys())[0])
        # Data from a platform that isn't configured
        self.db.platforms = {}
        self.db.update_db(self.tle, 'foo')
        self.assertFalse(table_exists(self.db.db, satid))
        self.assertFalse(self.db.updated)
        # Configured platform
        self.db.platforms = self.platforms
        self.db.update_db(self.tle, 'foo')
        self.assertTrue(table_exists(self.db.db, satid))
        self.assertTrue(self.db.updated)
        # Check that all the columns were added
        res = self.db.db.execute("select * from '%s'" % satid)
        names = [description[0] for description in res.description]
        for col in columns:
            self.assertTrue(col.split(' ')[0] in names)
        # Check the data
        data = res.fetchall()
        self.assertEqual(len(data), 1)
        # epoch
        self.assertEqual(data[0][0], '2008-09-20T12:25:40.104192')
        # TLE
        self.assertEqual(data[0][1], '\n'.join((line1, line2)))
        # Date when the data were added should be close to current time
        date_added = datetime.datetime.strptime(data[0][2], ISO_TIME_FORMAT)
        now = datetime.datetime.utcnow()
>       self.assertTrue((now - date_added).total_seconds() < 1.0)
E       AssertionError: False is not true
pyorbital\tests\test_tlefile.py:456: AssertionError

I'll restart the test.

codecov[bot] commented 2 years ago

Codecov Report

Merging #104 (231cd5b) into main (a6941d4) will decrease coverage by 0.03%. The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #104      +/-   ##
==========================================
- Coverage   87.03%   86.99%   -0.04%     
==========================================
  Files          13       12       -1     
  Lines        2052     2038      -14     
==========================================
- Hits         1786     1773      -13     
+ Misses        266      265       -1     
Flag Coverage Δ
unittests 86.99% <ø> (-0.04%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pyorbital/astronomy.py 92.75% <ø> (ø)
pyorbital/orbital.py 86.92% <0.00%> (-0.05%) :arrow_down:
pyorbital/tlefile.py 91.31% <0.00%> (-0.03%) :arrow_down:
pyorbital/__init__.py
pyorbital/geoloc.py 58.06% <0.00%> (+0.12%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a6941d4...231cd5b. Read the comment docs.

djhoese commented 2 years ago

Thank you!