-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add class that handles different input file formats
- Loading branch information
1 parent
641c814
commit 2824976
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# ___________________________________________________________________________ | ||
# | ||
# Prescient | ||
# Copyright 2020 National Technology & Engineering Solutions of Sandia, LLC | ||
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. | ||
# Government retains certain rights in this software. | ||
# This software is distributed under the Revised BSD License. | ||
# ___________________________________________________________________________ | ||
|
||
from __future__ import annotations | ||
from typing import TYPE_CHECKING | ||
if TYPE_CHECKING: | ||
from prescient.simulator.options import Options | ||
from .data_provider import DataProvider | ||
|
||
valid_input_formats = ('rts-gmlc', | ||
'dat') | ||
|
||
def get_data_provider(options:Options) -> DataProvider: | ||
if options.input_format == 'rts-gmlc': | ||
from .providers.gmlc_data_provider import GmlcDataProvider | ||
return GmlcDataProvider(options) | ||
|
||
elif options.input_format == 'dat': | ||
from .providers.dat_data_provider import DatDataProvider | ||
return DatDataProvider(options) | ||
|
||
else: | ||
raise ValueError(f"Invalid input format: {options.input_format}") | ||
return None |