From 5f107a1d5ed8b67485f4128849f8bfdba4ba9c5a Mon Sep 17 00:00:00 2001
From: Arthur Coolen <coolen@astron.nl>
Date: Mon, 24 Oct 2016 12:19:01 +0000
Subject: [PATCH] Task #6553: readStationConfigs need to handle new
 antennaConfig file layout

---
 MAC/Navigator2/scripts/readStationConfigs.ctl | 28 +++++++++++--------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/MAC/Navigator2/scripts/readStationConfigs.ctl b/MAC/Navigator2/scripts/readStationConfigs.ctl
index 5b11a8801c6..5cf1a84512c 100644
--- a/MAC/Navigator2/scripts/readStationConfigs.ctl
+++ b/MAC/Navigator2/scripts/readStationConfigs.ctl
@@ -105,8 +105,8 @@ main()
       continue;
     }
       
-    if (bDebug) DebugN("working on: ",dynStr_fileContent[index-1]);    
-    if (bDebug) DebugN("str1: ",str1," str2: ",str2);
+//    if (bDebug) DebugN("working on: ",dynStr_fileContent[index-1]);    
+//    if (bDebug) DebugN("str1: ",str1," str2: ",str2);
     
     if (strtoupper(str1) == "NORMAL_VECTOR" ) {
       if (strtoupper(str2) != "LBA" && strtoupper(str2) != "HBA0" && strtoupper(str2) != "HBA1" && strtoupper(str2) != "HBA") {
@@ -359,7 +359,9 @@ dyn_string lto_getFile_asDynStr(string aFileName) {
 
 void processNormalVector(string aS) {
   float fX=0,fY=0,fZ=0;
-  sscanf(dynStr_fileContent[index++],"%*d %*s %lf %lf %lf",fX,fY,fZ);
+  int dummy, lenx, leny;
+  
+  sscanf(dynStr_fileContent[index++],"(%d,%d) x (%d,%d) %*s %lf %lf %lf",dummy,lenx,dummy,leny,fX,fY,fZ);
   if (bDebug) DebugN("Reading NORMAL_VECTOR "+aS+" X,Y,Z :" + fX + " " + fY + " " + fZ);
   if (aS == "LBA" ) {
     norVecLBAFound=true;
@@ -386,9 +388,12 @@ void processNormalVector(string aS) {
 
 void processRotationMatrix(string aS) {
   dyn_float fX,fY,fZ;
-  int nr_rows=0;
+  int dummy,nr_rows=0;
+  
+ 
   // read nr of rows
-  sscanf(dynStr_fileContent[index++],"%d",nr_rows);
+  sscanf(dynStr_fileContent[index++],"(%d,%d)",dummy,nr_rows);
+  nr_rows+=1;
   if (bDebug) DebugN("index: "+(index-1)+" nr_rows: "+nr_rows);
   for (int i = 1; i <= nr_rows; i++) {
     sscanf(dynStr_fileContent[index++],"%lf %lf %lf",fX[i],fY[i],fZ[i]);
@@ -420,7 +425,8 @@ void processRotationMatrix(string aS) {
 
 void processFieldCenter(string aS) {
   float fX=0,fY=0,fZ=0;
-  sscanf(dynStr_fileContent[index++],"%*d %*s %lf %lf %lf",fX,fY,fZ);
+  int dummy;
+  sscanf(dynStr_fileContent[index++],"(%d,%d) %*s %f %f %f",dummy, dummy, fX, fY, fZ);
   if (bDebug) DebugN("Reading  fieldcenter "+aS+"X,Y,Z:" + fX + " " + fY + " " + fZ);
   if (aS== "LBA") {
     centerLBAFound=true;
@@ -453,11 +459,12 @@ void processFieldDeltas(string aS) {
   dyn_float antConfFileX;
   dyn_float antConfFileY;
   dyn_float antConfFileZ;
+  int dummy;
   
-
   // read nr of antennas
-  sscanf(dynStr_fileContent[index++],"%d",nr_ofAnt);
-
+  sscanf(dynStr_fileContent[index++],"(%d,%d)",dummy, nr_ofAnt);
+  nr_ofAnt+=1;
+  
   if (aS== "LBA") {
     deltasLBAFound=true;
     nr_LBA=nr_ofAnt;
@@ -515,8 +522,7 @@ void calcRotated(string aS) {
   float centerX,centerY,centerZ;
   float X,Y,Z;
   float x1=0,x2=0,y1=0,y2=0,x3=0,x4=0,y3=0,y4=0;
-
-  
+   
   if (aS=="LBA") {
     dpGet("LOFAR_PIC_StationInfo.LBA.RotationMatrix.X",rotX,"LOFAR_PIC_StationInfo.LBA.RotationMatrix.Y",rotY,"LOFAR_PIC_StationInfo.LBA.RotationMatrix.Z",rotZ,
           "LOFAR_PIC_StationInfo.LBA.centerX",centerX,"LOFAR_PIC_StationInfo.LBA.centerY",centerY,"LOFAR_PIC_StationInfo.LBA.centerZ",centerZ);
-- 
GitLab