Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor results writers to support dual access grids #954

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

trevorgerhardt
Copy link
Member

@trevorgerhardt trevorgerhardt commented Feb 17, 2025

Refactor the MultiGridResultWriter and GridResultWriter so they can be reused for dual access grids with minor additional changes.

Regular accessibility grids use time cutoffs, dual accessibility grids use thresholds. This change mainly moves up the channels parameter to support cutoffs and thresholds (channels, cutoffs, thresholds...naming here could be confusing).

This change additionally does some minor refactoring around passing the file name to BaseResultWriter's constructor so that metadata doesn't need to be passed and stored until finish().

The `MultiGridResultWriter` and `GridResultWriter` can be reused for dual access grids with minor changes.

Regular accessibility grids use time cutoffs, dual accessibility grids use thresholds. This change mainly moves up the `channels` parameter to support cutoffs and thresholds (channels, cutoffs, thresholds...naming here could be confusing).

This change additionally does some minor refactoring around passing the file name to `BaseResultWriter`'s constructor so that metadata doesn't need to be passed and stored until `finish()`.
@trevorgerhardt trevorgerhardt marked this pull request as ready for review February 17, 2025 15:58
@trevorgerhardt trevorgerhardt enabled auto-merge (rebase) February 18, 2025 14:00
Copy link
Member

@abyrd abyrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've read through all changes and looks good to me in principle (haven't tested yet). Just a couple of comments.

/**
* We create one GridResultWriter for each destination pointset and percentile.
* Each of those output files contains data for all travel time cutoffs at each origin.
* Each of those output files contains data for all channels at each origin.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The term "channels" is understandable by analogy with image files, but it threw me off at first. We are using "thresholds" and "travel time cutoffs" as mutually exclusive categories and introduce the word "channels" to refer to the slots for either of them in the file. But actually a time cutoff is a kind of threshold - I often use the expression "travel time threshold" interchangeably with "travel time cutoff". So, suggestion for simplifying terminology:

Suggested change
* Each of those output files contains data for all channels at each origin.
* Each of those output files contains data for all thresholds (time or cumulative access) at each origin.

I think this would get rid of the word channels entirely, and we could just call use thresholds and nThresholds everywhere. Then in specific places we could say "time threshold" or "(cumulative) access threshold".

@@ -39,7 +37,7 @@ public abstract class CsvResultWriter extends BaseResultWriter implements Region
* Override to return an Enum (usable as String) identifying the kind of results recorded by this CSV writer.
* This serves as a filename suffix to distinguish between different CSVs generated by a single regional analysis.
*/
public abstract CsvResultType resultType ();
public final CsvResultType resultType;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior and characteristics that are common to all instances of each subclass were being specified by overriding methods. This final field should work fine in place of the method, but I was wondering if there was some reason for the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants