Skip to content

Commit

Permalink
Merge pull request #43 from axiom-data-science/log_and_parquet_suffix
Browse files Browse the repository at this point in the history
Changed parquet output suffix
  • Loading branch information
kthyng authored Feb 6, 2025
2 parents 1090c89 + 82b1809 commit b0fb888
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions docs/whats_new.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# What's New

## Unreleased

* Suffix for parquet file format is now ".parquet" instead of ".parq".

## v0.11.1 (February 4, 2025)

* Move known model hard-wired model times into the class so they are refreshed each time the library is read.
Expand Down
8 changes: 5 additions & 3 deletions particle_tracking_manager/the_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def __init__(
2021, 8, 31, 19, 0, 0
)
self.__dict__["ciofs_operational_end_time"] = (
pd.Timestamp.now() + pd.Timedelta("48H")
pd.Timestamp.now() + pd.Timedelta("48h")
).to_pydatetime()
self.__dict__["ciofs_end_time"] = datetime.datetime(2023, 1, 1, 0, 0, 0)
self.__dict__["nwgoa_end_time"] = datetime.datetime(2009, 1, 1, 0, 0, 0)
Expand Down Expand Up @@ -253,7 +253,9 @@ def __init__(
output_file = f"output-results_{datetime.datetime.now():%Y-%m-%dT%H%M:%SZ}"

# want output_file to not include any suffix
output_file = output_file.rstrip(".nc").rstrip(".parq")
output_file = (
output_file.replace(".nc", "").replace(".parquet", "").replace(".parq", "")
)

## set up log for this simulation
# Create a file handler
Expand Down Expand Up @@ -476,7 +478,7 @@ def __setattr__(self, name: str, value) -> None:
output_file = str(pathlib.Path(output_file).with_suffix(".nc"))
elif self.output_format == "parquet":
output_file = str(
pathlib.Path(output_file).with_suffix(".parq")
pathlib.Path(output_file).with_suffix(".parquet")
)
else:
raise ValueError(
Expand Down
3 changes: 3 additions & 0 deletions tests/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,9 @@ def test_log_name():
m = ptm.OpenDriftModel(output_file="newtest.parq")
assert m.logfile_name == "newtest.log"

m = ptm.OpenDriftModel(output_file="newtest.parquet")
assert m.logfile_name == "newtest.log"


if __name__ == "__main__":
unittest.main()
2 changes: 1 addition & 1 deletion tests/test_opendrift.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def test_output_file():
"""make sure output file is parquet if output_format is parquet"""

m = OpenDriftModel(output_format="parquet")
assert m.output_file.endswith(".parq")
assert m.output_file.endswith(".parquet")

m = OpenDriftModel(output_format="netcdf")
assert m.output_file.endswith(".nc")
Expand Down

0 comments on commit b0fb888

Please sign in to comment.