astro 0.4.1.3 → 0.4.2.0
raw patch · 7 files changed
+51/−7 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Astro.Moon: moonPosition2 :: MoonDetails -> MoonDistanceUnits -> GeographicCoordinates -> Double -> JulianDate -> EquatorialCoordinates1
+ Data.Astro.Types: auToKM :: AstronomicalUnits -> Double
+ Data.Astro.Types: kmToAU :: Double -> AstronomicalUnits
Files
- README.md +1/−1
- astro.cabal +1/−1
- src/Data/Astro/Moon.hs +17/−2
- src/Data/Astro/Planet/PlanetDetails.hs +3/−2
- src/Data/Astro/Types.hs +17/−0
- test/Data/Astro/MoonTest.hs +8/−1
- test/Data/Astro/TypesTest.hs +4/−0
README.md view
@@ -2,7 +2,7 @@ [](https://travis-ci.org/Alexander-Ignatyev/astro) [](https://coveralls.io/github/Alexander-Ignatyev/astro)-[](https://alexander-ignatyev.github.io/astro-docs/doc/index.html)+[](https://alexander-ignatyev.github.io/astro-docs/doc/index.html) [](https://hackage.haskell.org/package/astro)
astro.cabal view
@@ -1,5 +1,5 @@ name: astro-version: 0.4.1.3+version: 0.4.2.0 synopsis: Amateur astronomical computations description: Amateur astronomical computations: rise and set times and azimuths,
src/Data/Astro/Moon.hs view
@@ -79,6 +79,7 @@ module Data.Astro.Moon ( moonPosition1+ , moonPosition2 , moonDistance1 , moonAngularSize , moonHorizontalParallax@@ -89,12 +90,13 @@ where import qualified Data.Astro.Utils as U-import Data.Astro.Types (DecimalDegrees(..), toRadians, fromRadians)+import Data.Astro.Types (DecimalDegrees(..), GeographicCoordinates, toRadians, fromRadians, kmToAU) import Data.Astro.Time.JulianDate (JulianDate(..), numberOfDays) import Data.Astro.Coordinate (EquatorialCoordinates1(..), EclipticCoordinates(..), eclipticToEquatorial) import Data.Astro.Planet (planetBrightLimbPositionAngle) import Data.Astro.Sun (sunDetails, sunMeanAnomaly2, sunEclipticLongitude2)-import Data.Astro.Moon.MoonDetails (MoonDetails(..), MoonDistanceUnits(..), j2010MoonDetails)+import Data.Astro.Moon.MoonDetails (MoonDetails(..), MoonDistanceUnits(..), j2010MoonDetails, mduToKm)+import Data.Astro.Effects (parallax) -- | Reduce the value to the range [0, 360)@@ -119,6 +121,19 @@ lambdaM = at + nm' betaM = fromRadians $ asin $ (sin a) * (sin i) in eclipticToEquatorial (EcC betaM lambdaM) ut+++-- | Calculate Equatorial Coordinates of the Moon with the given MoonDetails,+-- distance to the Moon, geographic coordinates of the onserver,+-- height above sea-level of the observer measured in metres (20 is a good reasonable value for the height)+-- and at the given JulianDate.+-- It is recommended to use 'j2010MoonDetails' as a first parameter,+-- to obtain the distance to the Moon you can use `moonDistance1` function.+-- `moonPosition2` takes into account parallax effect.+moonPosition2 :: MoonDetails -> MoonDistanceUnits -> GeographicCoordinates -> Double -> JulianDate -> EquatorialCoordinates1+moonPosition2 md distance coords height jd =+ let p = moonPosition1 md jd+ in parallax coords height (kmToAU $ mduToKm distance) jd p -- | Calculates the Moon's Distance at the given julian date.
src/Data/Astro/Planet/PlanetDetails.hs view
@@ -1,7 +1,7 @@ {-| Module: Data.Astro.Planet.PlanetDetails Description: Planet Details-Copyright: Alexander Ignatyev, 2016+Copyright: Alexander Ignatyev, 2016-2017 Planet Details. -}@@ -58,13 +58,14 @@ -- | PlanetDetails at the reference Epoch J2010.0 j2010PlanetDetails :: Planet -> PlanetDetails+-- Epoch Tp Epsilon Omega Bar e alpha i Big Omega Big Theta j2010PlanetDetails Mercury = PlanetDetails Mercury j2010 0.24085 75.5671 77.612 0.205627 0.387098 7.0051 48.449 (arcsecs 6.74) j2010PlanetDetails Venus = PlanetDetails Venus j2010 0.615207 272.30044 131.54 0.006812 0.723329 3.3947 76.769 (arcsecs 16.92) j2010PlanetDetails Earth = PlanetDetails Earth j2010 0.999996 99.556772 103.2055 0.016671 0.999985 0 0 (arcsecs 0) j2010PlanetDetails Mars = PlanetDetails Mars j2010 1.880765 109.09646 336.217 0.093348 1.523689 1.8497 49.632 (arcsecs 9.36) j2010PlanetDetails Jupiter = PlanetDetails Jupiter j2010 11.857911 337.917132 14.6633 0.048907 5.20278 1.3035 100.595 (arcsecs 196.74) j2010PlanetDetails Saturn = PlanetDetails Saturn j2010 29.310579 172.398316 89.567 0.053853 9.51134 2.4873 113.752 (arcsecs 165.6)-j2010PlanetDetails Uranus = PlanetDetails Uranus j2010 84.039492 271.063148 172.884833 0.046321 19.21814 0.773059 73.926961 (arcsecs 65.8)+j2010PlanetDetails Uranus = PlanetDetails Uranus j2010 84.039492 356.135400 172.884833 0.046321 19.21814 0.773059 73.926961 (arcsecs 65.8) j2010PlanetDetails Neptune = PlanetDetails Neptune j2010 165.845392 326.895127 23.07 0.010483 30.1985 1.7673 131.879 (arcsecs 62.2) -- | arcseconds to DecimalHours
src/Data/Astro/Types.hs view
@@ -48,6 +48,8 @@ , GeographicCoordinates(..) , AstronomicalUnits(..) , lightTravelTime+ , kmToAU+ , auToKM , toDecimalHours , fromDecimalHours , toRadians@@ -164,6 +166,21 @@ -- | Light travel time of the distance in Astronomical Units lightTravelTime :: AstronomicalUnits -> DecimalHours lightTravelTime (AU ro) = DH $ 0.1386*ro+++kmInOneAU :: Double+kmInOneAU = 149597870.700+++-- | Convert from kilometers to Astronomical Units+kmToAU :: Double -> AstronomicalUnits+kmToAU km = AU (km / kmInOneAU)+++-- | Comvert from Astronomical Units to kilometers+auToKM :: AstronomicalUnits -> Double+auToKM (AU au) = au * kmInOneAU+ -- | Convert from DecimalDegrees to Radians toRadians (DD deg) = U.toRadians deg
test/Data/Astro/MoonTest.hs view
@@ -16,16 +16,23 @@ import Data.Astro.TypesTest (testDecimalDegrees) import Data.Astro.CoordinateTest (testEC1) +import Data.Astro.Types (GeographicCoordinates(..)) import Data.Astro.Time.JulianDate (fromYMD) import Data.Astro.Coordinate (EquatorialCoordinates1(..)) import Data.Astro.Moon.MoonDetails (MoonDetails(..), j2010MoonDetails, MoonDistanceUnits(..)) import Data.Astro.Moon -tests = [testGroup "moonPosition1"[+tests = [testGroup "moonPosition1" [ testEC1 "at 2003-09-01 00:00:00 UT" 0.000001 (EC1 (-11.525750) 14.211486) (moonPosition1 j2010MoonDetails (fromYMD 2003 9 1))+ ]+ , testGroup "moonPosition2" [+ testEC1 "at 2003-09-01 00:00:00 UT"+ 0.000001+ (EC1 (-12.174888) 14.178731)+ (moonPosition2 j2010MoonDetails (MDU 1) (GeoC 51 0) 20 (fromYMD 2003 9 1)) ] , testGroup "moonDistance" [ testMDU "at 2016-08-27 00:00:00"
test/Data/Astro/TypesTest.hs view
@@ -55,6 +55,10 @@ , testGroup "Light travel time" [ testDecimalHours "7.7 AU" 0.0000001 1.06722 (lightTravelTime 7.7) ]+ , testGroup "KM <-> AU" [+ testCase "KM -> AU" $ assertApproxEqual "" 1e-5 (AU 7.8) (kmToAU 1166863391.46)+ , testCase "AU -> KM" $ assertApproxEqual "" 1e-5 1166863391.46 (auToKM 7.8)+ ] , testGroup "DD: standard typeclasses" [ testCase "show" $ "DD 15.5" @=? show (DD 15.5) , testCase "showList" $ "[DD 15.3,DD 15.7]" @=? showList [DD 15.3, DD 15.7] ""