Commit d152fbaa authored by Andrey Filippov's avatar Andrey Filippov

refactoring

parent 7506079e
...@@ -1512,7 +1512,7 @@ public class VegetationLMA { ...@@ -1512,7 +1512,7 @@ public class VegetationLMA {
for (int n = 0; n < 4; n++) { for (int n = 0; n < 4; n++) {
for (int i = 0; (i < indices[n].length) && (i < par_index[n].length); i++) { for (int i = 0; (i < indices[n].length) && (i < par_index[n].length); i++) {
int indx = i; int indx = i;
if (n < 3) { if (n < TVAO_SCENE_OFFSET) {
int w = i % woi.width; int w = i % woi.width;
int h = i / woi.width; int h = i / woi.width;
indx = (h + woi.y) * full.width + (w + woi.x); indx = (h + woi.y) * full.width + (w + woi.x);
...@@ -1520,7 +1520,11 @@ public class VegetationLMA { ...@@ -1520,7 +1520,11 @@ public class VegetationLMA {
int pindx = par_index[n][indx]; int pindx = par_index[n][indx];
indices[n][i] = pindx; indices[n][i] = pindx;
if (pindx < 0) { if (pindx < 0) {
if (n == TVAO_SCENE_OFFSET) {
data[n][i] = Double.NaN;
} else {
data[n][i] = tvao[n][indx]; data[n][i] = tvao[n][indx];
}
} else { } else {
data[n][i] = vector[pindx]; data[n][i] = vector[pindx];
} }
...@@ -1644,9 +1648,17 @@ public class VegetationLMA { ...@@ -1644,9 +1648,17 @@ public class VegetationLMA {
} }
} }
// Trim data to actiual // Trim data to actiual
int num_pars_scenes = Integer.parseInt((String) imp_pars.getProperty("NUM_PARS_SCENES")); // int num_pars_scenes = Integer.parseInt((String) imp_pars.getProperty("NUM_PARS_SCENES"));
double [] scene_offsets = new double [num_pars_scenes]; // double [] scene_offsets = new double [num_pars_scenes];
System.arraycopy(data[3], 0, scene_offsets, 0, num_pars_scenes); double [] scene_offsets = new double [num_scenes];
System.arraycopy(data[TVAO_SCENE_OFFSET], 0, scene_offsets, 0, scene_offsets.length);
// temporary patch, later they will be NaNs already - Already done !
for (int i = 0; i < scene_offsets.length; i++) {
if (indices[TVAO_SCENE_OFFSET][i] < 0) {
data[TVAO_SCENE_OFFSET][i] = Double.NaN;
}
}
for (int n = 0; n < 3; n++) { for (int n = 0; n < 3; n++) {
if (woi.width * woi.height < data[n].length ) { if (woi.width * woi.height < data[n].length ) {
double [] d = new double [woi.width * woi.height]; double [] d = new double [woi.width * woi.height];
...@@ -1655,8 +1667,6 @@ public class VegetationLMA { ...@@ -1655,8 +1667,6 @@ public class VegetationLMA {
} }
} }
data[3] = scene_offsets; data[3] = scene_offsets;
} else { } else {
this.woi = woi; this.woi = woi;
diff_offsets = Boolean.parseBoolean((String) imp_pars.getProperty("DIFF_OFFSETS")); diff_offsets = Boolean.parseBoolean((String) imp_pars.getProperty("DIFF_OFFSETS"));
...@@ -2030,7 +2040,7 @@ public class VegetationLMA { ...@@ -2030,7 +2040,7 @@ public class VegetationLMA {
woi); // Rectangle file_woi) woi); // Rectangle file_woi)
segments[n] = new VegetationSegment( segments[n] = new VegetationSegment(
woi, // Rectangle woi, woi, // Rectangle woi,
tvao[3], // datadouble [] scene_offsets, tvao[TVAO_SCENE_OFFSET], // datadouble [] scene_offsets,
new double [][] {tvao[0],tvao[1],tvao[2]}); // double [][] tva) {} {} new double [][] {tvao[0],tvao[1],tvao[2]}); // double [][] tva) {} {}
} }
// sort in line-scan order // sort in line-scan order
......
...@@ -8,7 +8,7 @@ public class VegetationSegment { ...@@ -8,7 +8,7 @@ public class VegetationSegment {
public double [][] tva; public double [][] tva;
public VegetationSegment( public VegetationSegment(
Rectangle woi, Rectangle woi,
double [] scene_offsets, double [] scene_offsets, // has NaNs
double [][] tva) { double [][] tva) {
this.woi = woi; this.woi = woi;
this.scene_offsets = scene_offsets; this.scene_offsets = scene_offsets;
......
Markdown is supported
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