Commit da9f116c authored by rink's avatar rink
Browse files

snapshot

parent 24fb6288
......@@ -21,7 +21,7 @@ public class XTrackScanLatLonSet extends GriddedLatLonSet {
super(type, samples, lengthX, lengthY, null, null, null, false, false);
this.linesPerScan = linesPerScan;
int numOfScans = lengthY/linesPerScan;
numOfScans = lengthY/linesPerScan;
scanSets = new GriddedLatLonSet[numOfScans];
int scanLen = linesPerScan*lengthX;
......@@ -29,8 +29,8 @@ public class XTrackScanLatLonSet extends GriddedLatLonSet {
float[] scanLatArray = new float[linesPerScan*lengthX];
for (int k=0; k<numOfScans; k++) {
System.arraycopy(lons[k*scanLen], 0, scanLonArray, 0, scanLen);
System.arraycopy(lats[k*scanLen], 0, scanLatArray, 0, scanLen);
System.arraycopy(lons, k*scanLen, scanLonArray, 0, scanLen);
System.arraycopy(lats, k*scanLen, scanLatArray, 0, scanLen);
scanSets[k] = new GriddedLatLonSet(RealTupleType.SpatialEarth2DTuple, new float[][] {scanLonArray, scanLatArray}, lengthX, linesPerScan);
}
......@@ -75,15 +75,11 @@ public class XTrackScanLatLonSet extends GriddedLatLonSet {
gx = lgxy[0];
gy = lgxy[1];
}
else {
// int[] gg = findValid(gx, gy);
// if (gg != null) {
// gx = gg[0];
// gy = gg[1];
// }
}
lastSetIdx = numOfScans/2;
int setIdx = gy/linesPerScan;
//int gy_set = gy % linesPerScan;
lastSetIdx = setIdx;
int idx = gy*LengthX+gx;
if (Float.isNaN(lons[idx]) || Float.isNaN(lats[idx]) || (Math.abs(lats[idx]) > 90)) {
......@@ -91,6 +87,7 @@ public class XTrackScanLatLonSet extends GriddedLatLonSet {
}
float[][] lonlat = new float[2][1];
int[] guess_set = new int[2];
for (int i=0; i<length; i++) {
......@@ -113,12 +110,6 @@ public class XTrackScanLatLonSet extends GriddedLatLonSet {
}
}
// int setIdx = gy/linesPerScan;
// int gy_set = gy % linesPerScan;
// if the loop doesn't find the answer, the result should be NaN
grid[0][i] = grid[1][i] = Float.NaN;
......@@ -129,17 +120,22 @@ public class XTrackScanLatLonSet extends GriddedLatLonSet {
float[][] gxgy;
while (lastSetIdx >= 0 && lastSetIdx < numOfScans) {
gxgy = scanSets[lastSetIdx].valueToGrid(lonlat, guess);
GriddedLatLonSet scanSet = scanSets[lastSetIdx];
gxgy = scanSet.valueToGrid(lonlat, guess_set);
if (gxgy[0][0] == Float.NaN || gxgy[1][0] == Float.NaN) {
int gy_set = guess[1];
int gx_set = guess[0];
int gx_set = scanSet.lgxy[0];
int gy_set = scanSet.lgxy[1];
if (gy_set == 0) {
lastSetIdx -= 1;
guess_set[0] = gx_set;
guess_set[1] = linesPerScan-1;
}
else if (gy_set == linesPerScan-1) {
lastSetIdx += 1;
guess_set[0] = gx_set;
guess_set[1] = 0;
}
else if (gx_set == 0 || gx_set == LengthX-1) {
break;
......@@ -147,7 +143,9 @@ public class XTrackScanLatLonSet extends GriddedLatLonSet {
}
else {
grid[0][i] = gxgy[0][0];
grid[1][i] = gxgy[1][0];
grid[1][i] = (lastSetIdx-1)*linesPerScan + gxgy[1][0];
lgxy[0] = scanSet.lgxy[0];
lgxy[1] = scanSet.lgxy[1] + (lastSetIdx-1)*linesPerScan;
break;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment