Index: trunk/BNC/src/bncephuser.cpp
===================================================================
--- trunk/BNC/src/bncephuser.cpp	(revision 11021)
+++ trunk/BNC/src/bncephuser.cpp	(revision 11047)
@@ -185,4 +185,22 @@
 //
 ////////////////////////////////////////////////////////////////////////////
+bool bncEphUser::radialDistanceOk(const t_eph* eph) {
+  ColumnVector xc(6);
+  ColumnVector vv(3);
+  if (eph->getCrd(eph->TOC(), xc, vv, false) != success) {
+    return false;
+  }
+  double rr = xc.Rows(1,3).NormFrobenius();
+
+  const double MINDIST = 2.e7;
+  const double MAXDIST = 6.e7;
+  if (rr < MINDIST || rr > MAXDIST || std::isnan(rr)) {
+    return false;
+  }
+  return true;
+}
+
+//
+////////////////////////////////////////////////////////////////////////////
 void bncEphUser::checkEphemeris(t_eph* eph, bool realTime) {
 
@@ -211,18 +229,11 @@
   // Simple Check - check satellite radial distance
   // ----------------------------------------------
+  if (!radialDistanceOk(eph)) {
+    eph->setCheckState(t_eph::bad);
+    return;
+  }
   ColumnVector xc(6);
   ColumnVector vv(3);
-  if (eph->getCrd(eph->TOC(), xc, vv, false) != success) {
-    eph->setCheckState(t_eph::bad);
-    return;
-  }
-  double rr = xc.Rows(1,3).NormFrobenius();
-
-  const double MINDIST = 2.e7;
-  const double MAXDIST = 6.e7;
-  if (rr < MINDIST || rr > MAXDIST || std::isnan(rr)) {
-    eph->setCheckState(t_eph::bad);
-    return;
-  }
+  eph->getCrd(eph->TOC(), xc, vv, false);
 
   // Check consistency with older ephemeris
