-
Notifications
You must be signed in to change notification settings - Fork 238
Submodules for diagnostics and output writers #498
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
Conversation
Can we please merge abstract operations before this. There will be merge conflicts. |
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 love it.
Only comment is that maybe we should remove export statements from Oceananigans
associated with diagnostics and output writers.
Then a user can write using Oceananigans.Diagnostics
if they need diagnostic stuff, and using Oceananigans.OutputWriters
if they need to use output writers. Or they can write
using Oceananigans.OutputWriters: NetCDFOutputWriter
I personally like this semantics because 1) I think it's better to give users finer control over what's imported into the namespace and 2) it makes scripts clearer: script-readers know when diagnostics and output writers are used. Etc.
This also requires being a bit more selective about what is exported from the submodules.
|
||
export | ||
write_output, read_output, | ||
has_reference, has_array_refs, |
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.
Should we export has_reference
and has_array_refs
? Doesn't seem like part of API?
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.
Probably not. I removed them.
module Diagnostics | ||
|
||
export | ||
run_diagnostic, |
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.
Should we export run_diagnostic
?
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.
Probably not. Removed it.
|
||
using Oceananigans: AbstractDiagnostic | ||
|
||
include("kernels.jl") |
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.
may want to name this file diagnostics_kernels.jl
. We should also probably rename the similarly named file in the nascent TimeSteppers
submodule introduced in PR #505 timestepping_kernels.jl
.
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 like the idea of more verbose file names. Done!
using Oceananigans, | ||
Oceananigans.Operators | ||
|
||
using Oceananigans: AbstractDiagnostic |
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.
Should AbstractDiagnostic
be introduced within this submodule, rather than in Oceananigans
?
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.
Hmmm, I do it in this case because it's used by a shared utility defined in utils.jl
. Might make sense to move the shared util into the Diagnostics
or OutputWriters
module, whichever is defined first so it can be imported by the other.
Checkpointer, restore_from_checkpoint | ||
|
||
using Oceananigans | ||
using Oceananigans: AbstractOutputWriter |
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.
Should AbstractOutputWriter
be introduced in this submodule, rather than in Oceananigans
? I think concept encapsulation is good.
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.
See above comment.
This PR refactors
diagnostics.jl
andoutput_writers.jl
into their own submodules.We might want to discuss #497 as we refactor things into submodules as it increases the number of cross-module import statements.
Helps with #456 and #495