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

Fix start time equal end time #39

Merged
merged 4 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions doc/source/release/0.5.0-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,10 @@ Correctly handle Nodata value during the spatial disaggregation of the rainfall
A crash occured during the disaggregation of the rainfall. The creation of a GDAL virtual-destination failed when the parent geotiff file has its Nodata value unset (None type). When this is the case, the Nodata value of the disaggregation rainfall is automatically set to -99.

See issue `#40 <https://github.com/DassHydro-dev/smash/issues/40>`__.

Stop the execution of smash when ``start_time`` is equal to ``end_time``
************************************************************************

When ``start_time`` is equal to ``end_time``, the code crashes during the data reading with no obvious reason. Now just stop the code execution and return an error when this case occurs.

See issue `#41 <https://github.com/DassHydro-dev/smash/issues/41>`__.
4 changes: 2 additions & 2 deletions smash/core/_build_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def _standardize_setup(setup: SetupDT):
except:
raise ValueError("argument end_time is not a valid date")

if (et - st).total_seconds() < 0:
if (et - st).total_seconds() <= 0:
raise ValueError(
"argument end_time corresponds to an earlier date than start_time"
"argument end_time is a date earlier to or equal to argument start_time"
)

if setup.read_qobs and setup.qobs_directory == "...":
Expand Down