diff --git a/src/main/java/com/conveyal/analysis/results/TemporalDensityCsvResultWriter.java b/src/main/java/com/conveyal/analysis/results/TemporalDensityCsvResultWriter.java index 61279629c..02a6168ad 100644 --- a/src/main/java/com/conveyal/analysis/results/TemporalDensityCsvResultWriter.java +++ b/src/main/java/com/conveyal/analysis/results/TemporalDensityCsvResultWriter.java @@ -31,15 +31,15 @@ public CsvResultType resultType () { public String[] columnHeaders () { List headers = new ArrayList<>(); // The ids of the freeform origin point and destination set - headers.add("originId"); - headers.add("destId"); + headers.add("origin"); + headers.add("destinations"); headers.add("percentile"); + // The number of minutes needed to reach d destination opportunities + headers.add("dual"); + // The opportunity density during each of 120 minutes for (int m = 0; m < 120; m += 1) { - // The opportunity density over travel minute m headers.add(Integer.toString(m)); } - // The number of minutes needed to reach d destination opportunities - headers.add("D" + dualThreshold); return headers.toArray(new String[0]); } @@ -67,20 +67,24 @@ public Iterable rowValues (RegionalWorkResult workResult) { List row = new ArrayList<>(125); row.add(originId); row.add(task.destinationPointSetKeys[d]); - row.add(Integer.toString(p)); - // One density value for each of 120 minutes + row.add(Integer.toString(task.percentiles[p])); + // One column containing dual accessibility value double[] densitiesPerMinute = percentilesForDestPointset[p]; - for (int m = 0; m < 120; m++) { - row.add(Double.toString(densitiesPerMinute[m])); - } - // One dual accessibility value int m = 0; double sum = 0; + // Find smallest integer M such that we have already reached D destinations after M minutes of travel. while (sum < dualThreshold && m < 120) { sum += densitiesPerMinute[m]; m += 1; } + // -1 indicates the threshold number of opportunities had still not been reached after the highest + // travel time cutoff specified in the analysis. row.add(Integer.toString(m >= 120 ? -1 : m)); + // One density value for each of 120 one-minute bins. + // Column labeled 10 contains the number of opportunities reached after 10 to 11 minutes of travel. + for (m = 0; m < 120; m++) { + row.add(Double.toString(densitiesPerMinute[m])); + } rows.add(row.toArray(new String[row.size()])); } }