-
Notifications
You must be signed in to change notification settings - Fork 12
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
Enable starting driver from Fortran restart files for TC case #339
Conversation
*.png | ||
*.nc |
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.
Do we actually want to ignore all png and nc files?
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.
Technically no, I think we do have one of each committed into the repo that should be there. But adding to the gitignore doesn't prevent from adding files manually, and our scripts produce a fair bit of these that we don't want to commit. I could go either way but I'd lean towards having this in the gitignore, what do you think?
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.
I'm okay with leaving it like this, just wanted to be careful when we do actually want to commit a png/nc file.
"lat": grid_data.lat, | ||
"lon": grid_data.lon, |
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.
👏
@dataclasses.dataclass() | ||
class RestartConfig: |
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.
What's the reason behind this being inside driver.py
?
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.
It should probably go in another file, I only put it here because all its code/logic was previously contained in this file. I'll see about splitting it out.
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.
When I went to do this I remembered the reason is this is tightly coupled with DriverConfig, due to the fact that it writes an updated DriverConfig when writing the restart. Must be located in the same file.
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.
Fair enough.
def cleanup(self): | ||
logger.info("cleaning up driver") | ||
self.config.restart_config.write_final_if_enabled( | ||
state=self.state, | ||
comm=self.comm, | ||
restart_path=restart_path, | ||
) | ||
self.restart.write_restart_config( | ||
comm=self.comm, | ||
time=self.time, | ||
driver_config=self.config, | ||
restart_path=restart_path, | ||
restart_path="RESTART", | ||
) |
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.
It looks to me that some of these don't need to be part of dace call back, not sure if this changes the behavior of dace.
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.
There's a dace inhibitor only because if we do call this from dace it should be escaped in a callback, I don't think this is actually called from dace currently. Added it for safety. I can remove it if you would still prefer.
driver/pace/driver/grid.py
Outdated
@dataclasses.dataclass | ||
class GeneratedGridConfig(GridInitializer): | ||
""" | ||
Configuration for baroclinic initialization. |
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.
Configuration for baroclinic initialization. | |
Grid calculated using metric terms |
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.
Adding something slightly different.
driver/pace/driver/state.py
Outdated
is_fortran_restart = False | ||
restart_files = fs.ls(path) | ||
is_fortran_restart = any( |
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.
Do we need to default to False first?
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.
No. Updated.
# lon=self.bgrid1, | ||
# lat=self.bgrid2, | ||
# lon_agrid=self.agrid1, | ||
# lat_agrid=self.agrid2, | ||
# area=self.area, | ||
# area_64=self.area_64, | ||
# rarea=self.rarea, | ||
# rarea_c=self.rarea_c, | ||
# dx=self.dx, | ||
# dy=self.dy, | ||
# dxc=self.dxc, | ||
# dyc=self.dyc, | ||
# dxa=self.dxa, | ||
# dya=self.dya, | ||
# rdx=self.rdx, | ||
# rdy=self.rdy, | ||
# rdxc=self.rdxc, | ||
# rdyc=self.rdyc, | ||
# rdxa=self.rdxa, | ||
# rdya=self.rdya, | ||
# ee1=self.ee1, | ||
# ee2=self.ee2, | ||
# es1=self.es1, | ||
# ew2=self.ew2, | ||
# a11=self.a11, | ||
# a12=self.a12, | ||
# a21=self.a21, | ||
# a22=self.a22, | ||
# edge_w=self.edge_w, | ||
# edge_e=self.edge_e, | ||
# edge_s=self.edge_s, | ||
# edge_n=self.edge_n, |
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.
Delete this
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.
Deleted.
# self.cosa, | ||
# self.cosa_u, | ||
# self.cosa_v, | ||
# self.cosa_s, | ||
# self.sina_u, | ||
# self.sina_v, | ||
# self.rsina, | ||
# self.rsin_u, | ||
# self.rsin_v, | ||
# self.rsin2, |
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.
delete this
# self.sin_sg1, | ||
# self.sin_sg2, | ||
# self.sin_sg3, | ||
# self.sin_sg4, | ||
# self.cos_sg1, | ||
# self.cos_sg2, | ||
# self.cos_sg3, | ||
# self.cos_sg4, |
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.
delete this
) | ||
|
||
quantity_factory = QuantityFactory.from_backend(sizer=sizer, backend="numpy") | ||
restart_dir = os.path.join(DIR, "../../../util/tests/data/c12_restart") |
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.
Would it be better to define pace dir at the top and use that throughout this file?
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.
Updated.
Co-authored-by: Elynn Wu <[email protected]>
…feature/fortran_restart
Purpose
Allows a start from fortran restart files as needed to run the tropical cyclone initialization case.
Code changes:
Checklist
Before submitting this PR, please make sure:
pace-util
, HISTORY has been updatedAdditionally, if this PR contains code authored by new contributors: