-
Notifications
You must be signed in to change notification settings - Fork 191
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
Put Diagnostics and OutputWriters into OrderedDicts, plus code f… #411
Merged
Conversation
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
…push! available for extension
…s of a tupled timeseries diagnostic
…nctions so ordered dicts can be treated as arrays, preserving existing behavior
Codecov Report
@@ Coverage Diff @@
## master #411 +/- ##
==========================================
+ Coverage 72.98% 73.31% +0.33%
==========================================
Files 25 25
Lines 1403 1428 +25
==========================================
+ Hits 1024 1047 +23
- Misses 379 381 +2
Continue to review full report at Codecov.
|
ali-ramadhan
approved these changes
Sep 16, 2019
arcavaliere
pushed a commit
to arcavaliere/Oceananigans.jl
that referenced
this pull request
Nov 6, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR makes
model.diagnostics
andmodel.output_writers
intoOrderedDict
s by default.In addition, we add functionality that preserves the existing behavior: when the user calls
push!(model.diagnostics, new_diagnostic)
, the diagnosticnew_diagnostic
is given a default name (something like:diag1
). In addition, the diagnostics can be accessed by index (an integer) or by name (assumed to be aSymbol
, though in principle anything except an integer might be used).Giving names to diagnostics should prove useful for saving
Timeseries
diagnostics, or accessing the value of a diagnostic for logging / other purposes.We use
OrderedDict
so that the diagnostics and output writers are executed in the order they were inserted, which is a potentially useful feature for interdependent diagnostics.We also add code that extends the functionality of
Timeseries
so that the user may pass aNamedTuple
of timeseries, eg:The sampled values would then be stored in
cfl_timeseries.data.adv
andcfl_timeseries.data.diff
. By extendinggetproperty
, we also provide syntax such thatcfl_timeseries.adv
returns the array
cfl_timeseries.data.adv
, for user convenience. As for "non-tupled" diagnostics, the samples incfl_timeseries.data.adv
can be plotted alongsidecfl_timeseries.time
.Resolves #362.
Resolves #361.