Skip to content

Commit

Permalink
bugfix: args parsing in main function
Browse files Browse the repository at this point in the history
  • Loading branch information
Naman Jain committed Aug 25, 2024
1 parent 05f2df1 commit b6eb9b7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ There is some scope of improvements to further enhance the performance

- __Tests and Coverage Report__: Add some more end to end tests (including for one when this is being used as a library) and add coverage report.

- __Logic of main() function__: The implementation of the `main()` function in `__main__.py` seems unnecessarily complex and convulated. This can be refactored and simplified.
### Fix:
There are some minor issues that need to be fixed:
Expand Down
11 changes: 7 additions & 4 deletions netcdf_to_parquet/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,15 @@ def main(
out_dir (str): Output directory for Parquet files. Defaults to "parquet_files".
args (argparse.Namespace, optional): Command-line arguments. Defaults to None.
"""
if args is None:
if args is None and (
start_date is None or end_date is None or out_dir is None
):
args = parse_arguments()

start_date = args.start_date or start_date
end_date = args.end_date or end_date
out_dir = args.out_dir or out_dir
if start_date is None:
start_date = args.start_date
if end_date is None:
end_date = args.end_date

if start_date is None or end_date is None:
raise ValueError("start_date and end_date must be provided.")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "netcdf-to-parquet"
version = "0.1.5"
version = "0.1.7"
description = "Transforms total precipitation NetCDF files into Parquet format."
authors = ["Naman Jain"]
license = "MIT"
Expand Down

0 comments on commit b6eb9b7

Please sign in to comment.