Skip to content

Commit 7d5cc8d

Browse files
committed
change CSV headers and column order, add comments
1 parent e857fcd commit 7d5cc8d

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/main/java/com/conveyal/analysis/results/TemporalDensityCsvResultWriter.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ public CsvResultType resultType () {
3131
public String[] columnHeaders () {
3232
List<String> headers = new ArrayList<>();
3333
// The ids of the freeform origin point and destination set
34-
headers.add("originId");
35-
headers.add("destId");
34+
headers.add("origin");
35+
headers.add("destinations");
3636
headers.add("percentile");
37+
// The number of minutes needed to reach d destination opportunities
38+
headers.add("D" + dualThreshold);
39+
// The opportunity density during each of 120 minutes
3740
for (int m = 0; m < 120; m += 1) {
38-
// The opportunity density over travel minute m
3941
headers.add(Integer.toString(m));
4042
}
41-
// The number of minutes needed to reach d destination opportunities
42-
headers.add("D" + dualThreshold);
4343
return headers.toArray(new String[0]);
4444
}
4545

@@ -67,20 +67,24 @@ public Iterable<String[]> rowValues (RegionalWorkResult workResult) {
6767
List<String> row = new ArrayList<>(125);
6868
row.add(originId);
6969
row.add(task.destinationPointSetKeys[d]);
70-
row.add(Integer.toString(p));
71-
// One density value for each of 120 minutes
70+
row.add(Integer.toString(task.percentiles[p]));
71+
// One column containing dual accessibility value
7272
double[] densitiesPerMinute = percentilesForDestPointset[p];
73-
for (int m = 0; m < 120; m++) {
74-
row.add(Double.toString(densitiesPerMinute[m]));
75-
}
76-
// One dual accessibility value
7773
int m = 0;
7874
double sum = 0;
75+
// Find smallest integer M such that we have already reached D destinations after M minutes of travel.
7976
while (sum < dualThreshold && m < 120) {
8077
sum += densitiesPerMinute[m];
8178
m += 1;
8279
}
80+
// -1 indicates the threshold number of opportunities had still not been reached after the highest
81+
// travel time cutoff specified in the analysis.
8382
row.add(Integer.toString(m >= 120 ? -1 : m));
83+
// One density value for each of 120 one-minute bins.
84+
// Column labeled 10 contains the number of opportunities reached after 10 to 11 minutes of travel.
85+
for (int m = 0; m < 120; m++) {
86+
row.add(Double.toString(densitiesPerMinute[m]));
87+
}
8488
rows.add(row.toArray(new String[row.size()]));
8589
}
8690
}

0 commit comments

Comments
 (0)