Skip to content

Commit

Permalink
Fixed datetime formatting bug
Browse files Browse the repository at this point in the history
Fixed bug where netCDF4 cftime in linux systems would result in error for not being compatible with %Y-%m-%d %H:%M.
  • Loading branch information
giovaniceotto committed Aug 1, 2020
1 parent 7cfd8ea commit b665ddd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions rocketpy/Environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -1559,20 +1559,20 @@ def processForecastReanalysis(self, file, dictionary):
# Check if time is inside range supplied by file
if timeIndex == 0 and inputTimeNum < fileTimeNum:
raise ValueError(
"Chosen launch time is not available in the provided file, which starts at {:%Y-%m-%d %H:%M}.".format(
"Chosen launch time is not available in the provided file, which starts at {:}.".format(
fileTimeDate
)
)
elif timeIndex == len(timeArray) - 1 and inputTimeNum > fileTimeNum:
raise ValueError(
"Chosen launch time is not available in the provided file, which ends at {:%Y-%m-%d %H:%M}.".format(
"Chosen launch time is not available in the provided file, which ends at {:}.".format(
fileTimeDate
)
)
# Check if time is exactly equal to one in the file
if inputTimeNum != fileTimeNum:
warnings.warn(
"Exact chosen launch time is not available in the provided file, using {:%Y-%m-%d %H:%M} UTC instead.".format(
"Exact chosen launch time is not available in the provided file, using {:} UTC instead.".format(
fileTimeDate
)
)
Expand Down Expand Up @@ -1942,20 +1942,20 @@ def processEnsemble(self, file, dictionary):
# Check if time is inside range supplied by file
if timeIndex == 0 and inputTimeNum < fileTimeNum:
raise ValueError(
"Chosen launch time is not available in the provided file, which starts at {:%Y-%m-%d %H:%M}.".format(
"Chosen launch time is not available in the provided file, which starts at {:}.".format(
fileTimeDate
)
)
elif timeIndex == len(timeArray) - 1 and inputTimeNum > fileTimeNum:
raise ValueError(
"Chosen launch time is not available in the provided file, which ends at {:%Y-%m-%d %H:%M}.".format(
"Chosen launch time is not available in the provided file, which ends at {:}.".format(
fileTimeDate
)
)
# Check if time is exactly equal to one in the file
if inputTimeNum != fileTimeNum:
warnings.warn(
"Exact chosen launch time is not available in the provided file, using {:%Y-%m-%d %H:%M} UTC instead.".format(
"Exact chosen launch time is not available in the provided file, using {:} UTC instead.".format(
fileTimeDate
)
)
Expand Down

0 comments on commit b665ddd

Please sign in to comment.