Index: /trunk/Ohana/src/gastro2/Makefile
===================================================================
--- /trunk/Ohana/src/gastro2/Makefile	(revision 6425)
+++ /trunk/Ohana/src/gastro2/Makefile	(revision 6426)
@@ -45,4 +45,5 @@
 $(SRC)/greference2.$(ARCH).o \
 $(SRC)/getusno.$(ARCH).o \
+$(SRC)/getusnob.$(ARCH).o \
 $(SRC)/gcatalog.$(ARCH).o \
 $(SRC)/remove_clumps.$(ARCH).o \
Index: /trunk/Ohana/src/gastro2/include/gastro2.h
===================================================================
--- /trunk/Ohana/src/gastro2/include/gastro2.h	(revision 6425)
+++ /trunk/Ohana/src/gastro2/include/gastro2.h	(revision 6426)
@@ -174,4 +174,5 @@
 int 	  getptolemy (CatStats *catstats, RefCatalog *Ref);
 int 	  getusno (CatStats *catstats, RefCatalog *Ref);
+int 	  getusnob (CatStats *catstats, RefCatalog *Ref, double epoch);
 int       get2mass (CatStats *catstats, RefCatalog *Ref);
 int       getgsc (CatStats *catstats, RefCatalog *Ref);
Index: /trunk/Ohana/src/gastro2/src/getusnob.c
===================================================================
--- /trunk/Ohana/src/gastro2/src/getusnob.c	(revision 6425)
+++ /trunk/Ohana/src/gastro2/src/getusnob.c	(revision 6426)
@@ -2,16 +2,18 @@
 # define NZONE 180
 
-int getusno (CatStats *catstats, RefCatalog *Ref, double epoch) {
+int getusnob (CatStats *catstats, RefCatalog *Ref, double epoch) {
 
   long int offset;
   int i, bin, first, last, nitems, Nitems, Nbins;
   float hours[100];
-  int start[100], number[100], *buffer, *ibuf;
-  char filename[128], c, *cbuf;
+  int start[100], number[100], *buffer, *buf;
+  char filename[128], c;
   FILE *f;
   double DEC1;
+  double uR, uD;
+  float mB1, mB2, mR1, mR2, mB, mR;
   int iDEC0, iDEC1, iRA0, iRA1;
   int spd, spd_start, spd_end, disk;
-  int NUSNO, Nusno;
+  int NUSNO, Nusno, Nstars;
   StarData *stars;
 
@@ -97,7 +99,7 @@
     }
 
-    ibuf = buffer;
+    buf = buffer;
     /* print out data from slice within RA and DEC range */
-    for (i = 0; i < Nstars; i++, buf+=80) {
+    for (i = 0; i < Nstars; i++, buf+=20) {
       if (buf[0] < iRA0) continue;
       if (buf[0] > iRA1) continue;
@@ -105,9 +107,12 @@
       if (buf[1] > iDEC1) continue;
       
+      bzero (&stars[Nusno], sizeof(StarData));
       stars[Nusno].R = buf[0]/360000.0;
       stars[Nusno].D = buf[1]/360000.0 - 90.0;
       
-      uR = (buf[2] % 10000) / 3600.0 * 0.002;
-      uD = ((buf[2] / 10000) % 10000) / 3600.0 * 0.002;
+      uR = (buf[2] % 10000);
+      uR = (uR - 5000.0) * 0.002 / 3600.0;
+      uD = ((buf[2] / 10000) % 10000);
+      uD = (uD - 5000.0) * 0.002 / 3600.0;
 
       /* 1st blue mag */
@@ -135,12 +140,8 @@
       stars[Nusno].R += uR*(epoch - 2000.0);
       stars[Nusno].D += uD*(epoch - 2000.0);
-
       Nusno ++;
-      if (Nusno == NUSNO) {
-	NUSNO += 5000;
-	REALLOCATE (stars, StarData, NUSNO);
-      }	  
-      free (buffer);
+      CHECK_REALLOCATE (stars, StarData, NUSNO, Nusno, 5000);
     }
+    free (buffer);
     fclose (f);
   }
Index: /trunk/Ohana/src/gastro2/src/greference2.c
===================================================================
--- /trunk/Ohana/src/gastro2/src/greference2.c	(revision 6425)
+++ /trunk/Ohana/src/gastro2/src/greference2.c	(revision 6426)
@@ -18,5 +18,5 @@
   /* get stars from the USNO B catalog for the given region */
   if (!strcmp (REFCAT, "USNOB")) {
-    getusnob (&catstats, Ref, EPOCH);
+    getusnob (&catstats, Ref, 2000.0);
     /* calculate Ref[0].Moff from Target & Ref dMdN, Mo */
   }
