ArrayFloat.D2[] dataArr=new ArrayFloat.D2[nparams*number_sweeps];
Index[] dataIndex=new Index[nparams*number_sweeps];
// Variable[][] vv=new Variable[nparams][number_sweeps];
Variable var=null;
String var_name="";
Ray[] rtemp=new Ray[(int)num_rays];
// NCdump.printArray(dataArr[0], "Total_Power", System.out, null);
Variable[] distanceR=new Variable[number_sweeps];
ArrayFloat.D1[] distArr=new ArrayFloat.D1[number_sweeps];
Index[] distIndex=new Index[number_sweeps];
String distName="distanceR";
for (int i=0; i<number_sweeps; i++) {
if (number_sweeps > 1) { distName="distanceR_sweep_"+(i+1); }
for (int ix=0; ix<sz; ix++) {
var=varList.get(ix);
if ((var.getShortName()).equals(distName.trim())) { distanceR[i]= var; break; }
}
distArr[i]=(ArrayFloat.D1) Array.factory(DataType.FLOAT, distanceR[i].getShape());
distIndex[i]=distArr[i].getIndex();
// for (int jj=0; jj<num_rays; jj++) { rtemp[jj]=ray[i][jj]; }
ngates=sweep_bins[i];
float stp=calcStep(range_first, range_last,(short)ngates);
for (int ii=0; ii<ngates; ii++) {
distArr[i].setFloat(distIndex[i].set(ii), (range_first+ii*stp));
}
}
// NCdump.printArray(distArr[0], "distanceR", System.out, null);
List rgp = volScan.getTotalPowerGroups();
if(rgp.size() == 0) rgp = volScan.getReflectivityGroups();
List [] sgp = new ArrayList[number_sweeps];
for (int i=0; i<number_sweeps; i++) {
sgp[i] = (List)rgp.get((short)i);
}
Variable[] time=new Variable[number_sweeps];
ArrayInt.D1[] timeArr=new ArrayInt.D1[number_sweeps];
Index[] timeIndex=new Index[number_sweeps];
String t_n="time";
for (int i=0; i<number_sweeps; i++) {
if (number_sweeps > 1) { t_n="time_sweep_"+(i+1); }
for (int ix=0; ix<sz; ix++) {
var=varList.get(ix);
if ((var.getShortName()).equals(t_n.trim())) { time[i]=var; break; }
}
// if (time[i].getShape().length == 0) {
// continue;
// }
timeArr[i]=(ArrayInt.D1) Array.factory(DataType.INT, time[i].getShape());
timeIndex[i]=timeArr[i].getIndex();
List rlist = sgp[i];
for (int jj=0; jj<num_rays; jj++) { rtemp[jj]=(Ray)rlist.get(jj); } //ray[i][jj]; }
for (int jj=0; jj<num_rays; jj++) {
timeArr[i].setInt(timeIndex[i].set(jj), rtemp[jj].getTime());
}
}
// NCdump.printArray(timeArr[0], "time", System.out, null);
Variable[] azimuthR=new Variable[number_sweeps];
ArrayFloat.D1[] azimArr=new ArrayFloat.D1[number_sweeps];
Index[] azimIndex=new Index[number_sweeps];
String azimName="azimuthR";
for (int i=0; i<number_sweeps; i++) {
if (number_sweeps > 1) { azimName="azimuthR_sweep_"+(i+1); }
for (int ix=0; ix<sz; ix++) {
var=varList.get(ix);
if ((var.getShortName()).equals(azimName.trim())) { azimuthR[i]=var; break; }
}
azimArr[i]=(ArrayFloat.D1) Array.factory(DataType.FLOAT, azimuthR[i].getShape());
azimIndex[i]=azimArr[i].getIndex();
List rlist = sgp[i];
for (int jj=0; jj<num_rays; jj++) { rtemp[jj]=(Ray)rlist.get(jj); } //ray[i][jj]; }
for (int jj=0; jj<num_rays; jj++) {
azimArr[i].setFloat(azimIndex[i].set(jj), rtemp[jj].getAz());
}
}
//NCdump.printArray(azimArr[0], "azimuthR", System.out, null);
Variable[] elevationR=new Variable[number_sweeps];
ArrayFloat.D1[] elevArr=new ArrayFloat.D1[number_sweeps];
Index[] elevIndex=new Index[number_sweeps];
String elevName="elevationR";
for (int i=0; i<number_sweeps; i++) {
if (number_sweeps > 1) { elevName="elevationR_sweep_"+(i+1); }
for (int ix=0; ix<sz; ix++) {
var=varList.get(ix);
if ((var.getShortName()).equals(elevName.trim())) { elevationR[i]=var; break; }
}
elevArr[i]=(ArrayFloat.D1) Array.factory(DataType.FLOAT, elevationR[i].getShape());
elevIndex[i]=elevArr[i].getIndex();
List rlist = sgp[i];
for (int jj=0; jj<num_rays; jj++) { rtemp[jj]=(Ray)rlist.get(jj); } //ray[i][jj]; }
for (int jj=0; jj<num_rays; jj++) {
elevArr[i].setFloat(elevIndex[i].set(jj), rtemp[jj].getElev());
}
}
// NCdump.printArray(elevArr[0], "elevationR", System.out, null);
Variable numGates=null;
for (int i=0; i<number_sweeps; i++) {
for (int ix=0; ix<sz; ix++) {
var=varList.get(ix);
if ((var.getShortName()).equals("numGates")) { numGates=var; break; }
}
}
ArrayInt.D1 gatesArr=(ArrayInt.D1) Array.factory(DataType.INT, numGates.getShape());
Index gatesIndex=gatesArr.getIndex();
for (int i=0; i<number_sweeps; i++) {
List rlist = sgp[i];
for (int jj=0; jj<num_rays; jj++) { rtemp[jj]=(Ray)rlist.get(jj); } //ray[i][jj]; }
ngates=rtemp[0].getBins();
gatesArr.setInt(gatesIndex.set(i), ngates);
}
for (int i=0; i<number_sweeps; i++) {
distanceR[i].setCachedData(distArr[i], false);
time[i].setCachedData(timeArr[i], false);
azimuthR[i].setCachedData(azimArr[i], false);
elevationR[i].setCachedData(elevArr[i], false);
}
numGates.setCachedData(gatesArr, false);
// startSweep.setCachedData(sweepArr, false);
// -------------------------------------------------
// int b=(int)ray[0][0].getBins();