Skip to content

Commit

Permalink
Sets the json_map reader as the default for dataconverter
Browse files Browse the repository at this point in the history
  • Loading branch information
sherjeelshabih committed Nov 20, 2023
1 parent 097f223 commit adb3e44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 2 additions & 9 deletions pynxtools/dataconverter/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def parse_params_file(params_file):
)
@click.option(
'--reader',
default='example',
default='json_map',
type=click.Choice(get_names_of_all_readers(), case_sensitive=False),
help='The reader to use. default="example"'
)
Expand Down Expand Up @@ -194,12 +194,6 @@ def parse_params_file(params_file):
default=False,
help='Shows a log output for all undocumented fields'
)
@click.option(
'--merge-partial',
is_flag=True,
default=False,
help='Merges partial NeXus files provided as different --input-file to the converter.'
)
@click.option(
'--mapping',
help='Takes a <name>.mapping.json file and converts data from given input files.'
Expand All @@ -213,7 +207,6 @@ def convert_cli(input_file: Tuple[str, ...],
fair: bool,
params_file: str,
undocumented: bool,
merge_partial: bool,
mapping: str):
"""The CLI entrypoint for the convert function"""
if params_file:
Expand All @@ -230,7 +223,7 @@ def convert_cli(input_file: Tuple[str, ...],
sys.tracebacklimit = 0
raise IOError("\nError: Please supply an NXDL file with the option:"
" --nxdl <path to NXDL>")
if merge_partial or mapping:
if mapping:
reader = "json_map"
if mapping:
input_file = input_file + tuple([mapping])
Expand Down
2 changes: 2 additions & 0 deletions tests/dataconverter/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def restore_xarray_file_from_tmp(tmp_path):
])
def test_find_nxdl(cli_inputs):
"""Unit test to check if dataconverter can find NXDLs in contributed/applications folder."""
cli_inputs.extend(["--reader", "example"])

runner = CliRunner()
result = runner.invoke(dataconverter.convert_cli, cli_inputs)
if "NXdoesnotexist" in cli_inputs:
Expand Down

0 comments on commit adb3e44

Please sign in to comment.