Index: /trunk/new-htdocs/conequery-vo.php
===================================================================
--- /trunk/new-htdocs/conequery-vo.php	(revision 151)
+++ /trunk/new-htdocs/conequery-vo.php	(revision 152)
@@ -25,4 +25,5 @@
 include_once("../../utils.php");
 include_once("loadS70.php");
+include_once("loadNewTables.php");
 include_once("xmlFunctions.php");
 
@@ -103,5 +104,6 @@
 $link = db_connect();
 
-loadS70();
+//loadS70();
+loadNewTables();
 
 ///////////////////////////////////////////////////////////////////////////
@@ -139,11 +141,12 @@
 }
 
-
 // Remove any leading or trailing AND and OR
 $whereString = trim($whereString, " AND OR");
 
-$query = "SELECT *,$angsep_str as angsep FROM s70 WHERE $whereString ORDER by angsep";
+//$query = "SELECT *,$angsep_str as angsep FROM s70 WHERE $whereString ORDER by angsep";
 
-$result = mysql_query($query) or die('Query failed: ' . mysql_error());
+$query = "(SELECT *,angsep_str as angsep FROM s70 WHERE $whereString) UNION (SELECT *,angsep_str as angsep FROM obs WHERE $whereString) ORDER BY angsep";
+
+$result = mysql_query($query) or die('Conesearch Query failed: ' . mysql_error());
 
 $all_results = array();
Index: /trunk/new-htdocs/loadNewTables.php
===================================================================
--- /trunk/new-htdocs/loadNewTables.php	(revision 152)
+++ /trunk/new-htdocs/loadNewTables.php	(revision 152)
@@ -0,0 +1,119 @@
+<?php
+
+function loadNewTables() {
+
+  // LOADS THE S70 DATA INTO THE DATABASE, AND CREATES THE NEW OBS
+  // TABLE.
+
+  loadS70();
+
+  $createObs = "
+CREATE TEMPORARY TABLE obs (
+	filename VARCHAR(32),
+	data_loc VARCHAR(100),
+ 	file_size_bytes INT(32),
+	project_id VARCHAR(10),
+	hdrver VARCHAR(10),
+	survey VARCHAR(10),
+	telescope VARCHAR(16),
+ 	site VARCHAR(8),    
+	src_name VARCHAR(16),
+ 	date VARCHAR(16),   
+ 	ut VARCHAR(16),   
+ 	MJD DECIMAL(32,26),
+	raj VARCHAR(20),
+	decj VARCHAR(20),
+	rajd DOUBLE,
+	decjd DOUBLE,
+	gl DOUBLE,
+	gb DOUBLE,
+	bmaj FLOAT,
+	bmin FLOAT,
+	bpa FLOAT,
+	dm DECIMAL(16,10),
+	period DECIMAL(32,24),
+	cnfg VARCHAR(128),
+ 	inst VARCHAR(32),
+	data_type VARCHAR(128),
+ 	rcvr VARCHAR(16),   
+ 	obsrvr VARCHAR(32),   
+        obsfreq DECIMAL(32,16),
+	chanbw DECIMAL(16,6),
+ 	nchan INT(6),        
+	npol INT(6),
+ 	nbin INT(6),        
+ 	nsub INT(6),        
+ 	scanlen DECIMAL(32,20),
+ 	tsamp FLOAT,       
+	nbits tinyint(3) unsigned,  
+	nbeam tinyint(3) unsigned,
+	PRIMARY KEY (filename, data_loc)
+)
+ SELECT
+	o.filename, 
+	o.data_loc, 
+	o.file_size_bytes, 
+	NULL as project_id,
+	NULL as hdrver,
+	NULL as survey,
+	'PARKES' as telescope,
+	o.site as site,
+	o.pulsar_name as src_name,
+	o.date as date,
+	o.ut as ut,
+	o.MJD as MJD,
+	concat(raj_hour,':',raj_minute,':',raj_second) as raj,
+	case 
+	     when (o.pulsar_name like '%-%') 
+		then concat('-',abs(o.decj_degree),':',o.decj_minute,':',o.decj_second)
+	     when (o.decj_degree<0.) 
+		then concat('-',abs(o.decj_degree),':',o.decj_minute,':',o.decj_second)
+             else concat(abs(o.decj_degree),':',o.decj_minute,':',o.decj_second) 
+    	end as decj,
+        (o.raj_hour+o.raj_minute/60.+o.raj_second/3600.)*15. as rajd,
+        case when o.pulsar_name like '%-%'
+		then -1.*(abs(o.decj_degree)+o.decj_minute/60.+o.decj_second/3600.)
+             when (o.decj_degree<0.)
+		then -1.*(abs(o.decj_degree)+o.decj_minute/60.+o.decj_second/3600.)
+             else abs(o.decj_degree)+o.decj_minute/60.+o.decj_second/3600. 
+	end as decjd,
+	NULL as gl, 
+	NULL as gb,
+	(1.2*(299792458./(o.freq*1.e6))/64.) * 180./pi() as BMAJ,
+	(1.2*(299792458./(o.freq*1.e6))/64.) * 180./pi() as BMIN,
+	0. as BPA,
+	o.dm, 
+	o.period, 
+	o.cnfg,
+	o.inst,
+	o.data_type,
+	o.rcvr,
+	o.obsrvr,
+	o.freq as obsfreq,
+	o.bw as chanbw,
+	o.nchan,
+	o.npol,
+	o.nbin, 
+	o.nsub, 
+	o.length as scanlen, 
+	o.tsamp,
+	NULL as nbits,
+	o.nbeam	
+ FROM observations as o";
+
+  $result = mysql_query($createObs) or die('Query failed: ' . mysql_error());
+
+  $updateObs = "
+UPDATE obs
+  SET	gl = case 
+		when degrees( atan2( ( sin(radians(decjd))*cos(radians(@ngpdec)) - cos(radians(decjd))*sin(radians(@ngpdec))*cos(radians(rajd-@ngpra)) ) , ( cos(radians(decjd))*sin(radians(rajd-@ngpra)) ) ) ) + @ascnode > 0 
+	        then degrees( atan2( ( sin(radians(decjd))*cos(radians(@ngpdec)) - cos(radians(decjd))*sin(radians(@ngpdec))*cos(radians(rajd-@ngpra)) ) , ( cos(radians(decjd))*sin(radians(rajd-@ngpra)) ) ) ) + @ascnode
+       		else degrees( atan2( ( sin(radians(decjd))*cos(radians(@ngpdec)) - cos(radians(decjd))*sin(radians(@ngpdec))*cos(radians(rajd-@ngpra)) ) , ( cos(radians(decjd))*sin(radians(rajd-@ngpra)) ) ) ) + @ascnode + 360.
+	   end,
+	gb = (degrees( asin( cos(radians(decjd))*cos(radians(@ngpdec))*cos(radians(rajd-@ngpra)) + sin(radians(decjd))*sin(radians(@ngpdec)))))";
+
+  $result = mysql_query($updateObs) or die('Query failed: ' . mysql_error());
+
+  }
+
+?>
Index: /trunk/new-htdocs/loadS70.php
===================================================================
--- /trunk/new-htdocs/loadS70.php	(revision 151)
+++ /trunk/new-htdocs/loadS70.php	(revision 152)
@@ -13,4 +13,5 @@
 	data_loc VARCHAR(100),
  	file_size_bytes INT(32),
+	project_id VARCHAR(10),
 	hdrver VARCHAR(10),
 	survey VARCHAR(10),
@@ -58,5 +59,5 @@
 OPTIONALLY ENCLOSED BY \"\\\"\" 
 IGNORE 1 LINES 
-(filename,data_loc,file_size_bytes,hdrver,survey,telescope,site,src_name,date,ut,MJD,raj,decj,rajd,decjd,gl,gb,bmaj,bmin,bpa,dm,period,cnfg,inst,data_type,rcvr,obsrvr,obsfreq,chanbw,nchan,npol,nbin,nsub,scanlen,tsamp,nbits,nbeam)";
+(filename,data_loc,file_size_bytes,project_id,hdrver,survey,telescope,site,src_name,date,ut,MJD,raj,decj,rajd,decjd,gl,gb,bmaj,bmin,bpa,dm,period,cnfg,inst,data_type,rcvr,obsrvr,obsfreq,chanbw,nchan,npol,nbin,nsub,scanlen,tsamp,nbits,nbeam)";
 
   $result = mysql_query($loadTable) or die('Query failed: ' . mysql_error());
Index: /trunk/src/pvo-metadata.cc
===================================================================
--- /trunk/src/pvo-metadata.cc	(revision 151)
+++ /trunk/src/pvo-metadata.cc	(revision 152)
@@ -142,5 +142,5 @@
 
       std::stringstream sysmsg;
-      sysmsg << "du -b " << this->fileloc << " | awk '{print $1}' > /tmp/size";
+      sysmsg << "du -bL " << this->fileloc << " | awk '{print $1}' > /tmp/size";
       system(sysmsg.str().c_str());
       std::ifstream fin("/tmp/size");
@@ -216,5 +216,5 @@
       if(fitsfile.readColumnValue("CHAN_BW",1,&this->chanbw)!=0) 
 	this->chanbw = nullFloat;
-      if(!(this->chanbw>0.)) this->chanbw = nullFloat;
+      if(!(fabs(this->chanbw)>0.)) this->chanbw = nullFloat; // only set to null if it is zero.
 
       ////////////////////
