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

allow input checker aux files to be parquet #851

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions activitysim/abm/models/input_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@ def create_table_store(state, input_checker_settings):
break

else:
table = pd.read_csv(
state.filesystem.get_data_file_path(
table_name, alternative_suffixes=[".csv"]
)
table_file = state.filesystem.get_data_file_path(
table_name, alternative_suffixes=[".csv", ".csv.gz", ".parquet"]
)
if table_file.suffix == ".parquet":
table = pd.read_parquet(table_file)
else:
table = pd.read_csv(table_file)
if table is None:
raise FileNotFoundError(
f"Input table {table_name} could not be found" + f"\nPath: {path}"
Expand Down Expand Up @@ -405,11 +407,9 @@ def input_checker(state: workflow.State):
create_table_store(state, input_checker_settings)

# import the input checker code after the TABLE_STORE is initialized so functions have access to the variable
prior_dir = os.getcwd()
if state.filesystem.working_dir:
os.chdir(state.filesystem.working_dir)
sys.path.insert(0, os.path.dirname(input_checker_file_full))
input_checker = __import__(os.path.splitext(input_checker_file)[0])
os.chdir(prior_dir)
sys.path.pop(0)

# intializing data objects for errors, warnings, and pydantic data
v_errors = {}
Expand Down
Loading