[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [marble/esasocis-2012-eclipse] src/plugins/render/eclipses/ecl: EclipsesPlugin: Update EclSolar
From:       Rene Kuettner <rene () bitkanal ! net>
Date:       2013-02-07 11:49:11
Message-ID: 20130207114911.2254CA6091 () git ! kde ! org
[Download RAW message or body]

Git commit 7d941af557062426ab263191fe288fadd2e9c888 by Rene Kuettner.
Committed on 07/02/2013 at 12:47.
Pushed by renek into branch 'esasocis-2012-eclipse'.

EclipsesPlugin: Update EclSolar

This update fixes some issues with very short eclipse events.

M  +13   -13   src/plugins/render/eclipses/ecl/astrolib.cpp
M  +15   -3    src/plugins/render/eclipses/ecl/eclsolar.cpp

http://commits.kde.org/marble/7d941af557062426ab263191fe288fadd2e9c888

diff --git a/src/plugins/render/eclipses/ecl/astrolib.cpp b/src/plugins/render/eclipses/ecl/astrolib.cpp
index dea1bf4..a90e2e7 100644
--- a/src/plugins/render/eclipses/ecl/astrolib.cpp
+++ b/src/plugins/render/eclipses/ecl/astrolib.cpp
@@ -16,9 +16,8 @@
   University Science Books, Mill Valley, California, 1992
   and modified correspondingly.
 
-  Linux C++ version
-  License: GNU GPL Version 2
-  Copyright : Gerhard HOLTKAMP          11-JAN-2012
+  License: GNU LGPL Version 2+
+  Copyright : Gerhard HOLTKAMP          28-JAN-2013
   ========================================================================= */
 
 #include <cmath>
@@ -234,12 +233,13 @@ double DefTdUt (int yi)
 
   if (yr > 1899)
    {
-    if (yr >= 2000)  // this corrects for observations until DEC 2006
+    if (yr >= 2000)  // this corrects for observations until 2013
      {
       if (yr > 2006) yr -= 1;
       if (yr > 2006) yr -= 1;  // no leap second at the end of 2007
       if (yr > 2007) yr -= 1;  // no leap second at the end of 2009
       if (yr > 2007) yr -= 1;  // no leap second at the end of 2010
+      if (yr > 2008) yr -= 1;  // no leap second at the end of 2012
       yr -= 6;
       if (yr < 1999) yr = 1999;
      };
@@ -1962,16 +1962,16 @@ int Eclipse::solar (double jd, double tdut, double& phi, double& lamda)
 	else
 	 {
 	  if (r0 < (1.0 + 0.5 * fabs(d_umbra)))
-		 {
-		  if (d_umbra > 0) phase = 2;  // non-central annular eclipse
-		  else phase = 3;     // non-central total eclipse
-		 }
+           {
+            if (d_umbra > 0) phase = 2;  // non-central annular eclipse
+            else phase = 3;     // non-central total eclipse
+           }
 	  else
-		 {
-		  if (r0 < (1.0 + 0.5*d_penumbra)) phase = 1;   // partial eclipse
-		  else phase = 0;   // no eclipse
-		 }
-	  }
+           {
+            if (r0 < (1.0 + 0.5*d_penumbra)) phase = 1;   // partial eclipse
+            else phase = 0;   // no eclipse
+           }
+	 }
 
 	rs[2]*=flat;  // restore from flatting of the Earth
 	rm[2]*=flat;
diff --git a/src/plugins/render/eclipses/ecl/eclsolar.cpp b/src/plugins/render/eclipses/ecl/eclsolar.cpp
index 2682c4c..e582537 100644
--- a/src/plugins/render/eclipses/ecl/eclsolar.cpp
+++ b/src/plugins/render/eclipses/ecl/eclsolar.cpp
@@ -27,7 +27,7 @@
 *                                                                          *
 * Open Source Code. License: GNU LGPL Version 2+                          *
 *                                                                          *
-* Author: Gerhard HOLTKAMP,        20-JAN-2012                              *
+* Author: Gerhard HOLTKAMP,        28-JAN-2013                              *
 ***************************************************************************/
 
 /*------------ include files and definitions -----------------------------*/
@@ -914,6 +914,7 @@ double EclSolar::phmjd (double yearf, double phase, double tdut,
  {
   double tt, jd, k, m, p, f;
   double s, c, gam, u;
+  int tst;
   Eclipse eclp;
 
   // preliminary (modified) Julian Date 
@@ -1003,10 +1004,21 @@ double EclSolar::phmjd (double yearf, double phase, double tdut,
               emag = 1.0;
              };
             if (eph == 1)     // get magnitude of partial eclipse
-            emag = (1.5432 + u - fabs(gam)) / (0.5460 + 2.0*u);
+                emag = (1.5432 + u - fabs(gam)) / (0.5460 + 2.0*u);
+            if (emag < 0.025) // check if low mag eclipse is OK
+             {
+              eph = 0;
+              u = 1.0 / 720; // 2 min steps
+              for (int j=0; j < 288; j++)
+               {
+                tt = ejd - 0.2 + double(j)*u;
+                tst = eclp.solar(tt,tdut,s,c);
+                if (tst > 0) eph = tst;
+               };
+             };
            }
          }
-       }
+       } // end of solar eclipse check
 
       if (phase == 0.5)        // check for lunar eclipse
        {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic