-
Notifications
You must be signed in to change notification settings - Fork 8
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
Dev #175
Merged
+31,502
−17,549
Merged
Dev #175
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
08d89d8
Update README.md
brey 2a6db66
Add hotstart option 1 in cast
brey 1fe314c
remove tg metadata from simulation station output
brey 1dd50cc
resolve #173
brey 730d342
add skiprows argument to reading station output
brey cf32241
Deal with schism bug in station output
brey b70acbf
Update mesh.py
brey 98120ed
towards adding a tiling feature
brey 4378335
black update
brey f07267e
ci: Relax black constraint
pmav99 a9633aa
ci: Run tests on 3.12 too
pmav99 6a840b7
schism: Add `parse_mirror_out()`
pmav99 e48e864
tests: Fix failings tests
pmav99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -279,6 +279,8 @@ def run(self, **kwargs): | |
|
||
copy = get_value(self, kwargs, "copy", False) | ||
|
||
ihot = get_value(self, kwargs, "ihot", 1) | ||
|
||
pwd = os.getcwd() | ||
|
||
self.origin = self.model.rpath | ||
|
@@ -336,7 +338,6 @@ def run(self, **kwargs): | |
info["config_file"] = os.path.join(ppath, "param.nml") | ||
|
||
# update the properties | ||
|
||
info["rdate"] = self.rdate | ||
info["start_date"] = self.sdate | ||
info["time_frame"] = self.time_frame | ||
|
@@ -362,7 +363,10 @@ def run(self, **kwargs): | |
logger.debug("create restart file") | ||
|
||
# check for combine hotstart | ||
hotout = int((self.sdate - self.rdate).total_seconds() / info["params"]["core"]["dt"]) | ||
if ihot == 2: | ||
hotout = int((self.sdate - self.rdate).total_seconds() / info["params"]["core"]["dt"]) | ||
elif ihot == 1: | ||
hotout = self.parameters["nhot_write"] | ||
logger.debug("hotout_it = {}".format(hotout)) | ||
|
||
# link restart file | ||
|
@@ -430,20 +434,32 @@ def run(self, **kwargs): | |
logger.warning("meteo files present\n") | ||
|
||
# modify param file | ||
rnday_new = (self.sdate - self.rdate).total_seconds() / (3600 * 24.0) + pd.to_timedelta( | ||
self.time_frame | ||
).total_seconds() / (3600 * 24.0) | ||
hotout_write = int(rnday_new * 24 * 3600 / info["params"]["core"]["dt"]) | ||
info["parameters"].update( | ||
{ | ||
"ihot": 2, | ||
"rnday": rnday_new, | ||
"start_hour": self.rdate.hour, | ||
"start_day": self.rdate.day, | ||
"start_month": self.rdate.month, | ||
"start_year": self.rdate.year, | ||
} | ||
) | ||
if ihot == 2: | ||
rnday_new = (self.sdate - self.rdate).total_seconds() / (3600 * 24.0) + pd.to_timedelta( | ||
self.time_frame | ||
).total_seconds() / (3600 * 24.0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The formatting is ugly here. Either introduce new variables or maybe try some variation of this (I didn't test it): rnday_new = (self.sdate - self.rdate) + pd.to_timedelta(self.time_frame)
rnday_new = rnday_new.total_seconds() / (3600 * 24.0)
... |
||
hotout_write = int(rnday_new * 24 * 3600 / info["params"]["core"]["dt"]) | ||
info["parameters"].update( | ||
{ | ||
"ihot": 2, | ||
"rnday": rnday_new, | ||
"start_hour": self.rdate.hour, | ||
"start_day": self.rdate.day, | ||
"start_month": self.rdate.month, | ||
"start_year": self.rdate.year, | ||
} | ||
) | ||
elif ihot == 1: | ||
info["parameters"].update( | ||
{ | ||
"ihot": 1, | ||
"start_hour": self.sdate.hour, | ||
"start_day": self.sdate.day, | ||
"start_month": self.sdate.month, | ||
"start_year": self.sdate.year, | ||
} | ||
) | ||
# else: | ||
|
||
m.config(output=True, **info) # save param.nml | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should (almost) always add an
else
clase to anif/elif
.What if the user adds an invalid
ihot
value? Thenhotout
will not be defined and you will get aNameError
which will confusing.if instead we have:
it will be immediately apparent what the issue is.
For the record, ideally, we should be validating the user input as soon as we get it, but to do that properly will require a major restructure so let's keep it simple for now.