-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add capability for user-defined parameter sets, with an example (take 2) #210
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #210 +/- ##
=======================================
Coverage 90.93% 90.93%
=======================================
Files 10 10
Lines 1180 1180
=======================================
Hits 1073 1073
Misses 107 107 ☔ View full report in Codecov by Sentry. |
@navidcy @charleskawczynski @simone-silvestri this passes now. |
colorrange = Trange, | ||
colormap = Tmap, | ||
alpha = 0.1, | ||
) |
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.
@charleskawczynski can you please advise on how to make this more readable. It's better if all the arguments appear on one line.
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 need to enclose it within
#! format: off
#! format: on
Or just a #! format: off at the beginning of the .jl file to make the formatter ignore it altogether?
https://domluna.github.io/JuliaFormatter.jl/dev/#Turn-off/on-formatting
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.
Ok that's helpful. But why does the formatter want to do this in the first place?
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.
From my point of view, the formatter is mostly a glorified line-breaker. It's great 95% of the time, but every now and then it's nice to use custom formatting.
I don't think there's an optimal solution for this sort of thing. Maybe something that uses ChatGPT could be a few percent better.
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.
But when does it try to break a line?
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 think it's determined here: https://github.com/CliMA/Thermodynamics.jl/blob/main/.dev/clima_formatter_options.jl#L3
Can we please rebase and squash this PR? I like having a tidy and linear history. |
Why? |
It's good practice. I can do it. Just let me know when you're ready to merge, @glwagner. |
I disagree that it's good practice for us. The PR is ready. |
I added the examples in the Docs via Literate. |
5ef9645
to
808b6b6
Compare
Bump patch version to capture #210
This PR re-opens #172.
This PR tweaks the internal API for defining parameter sets to support user-defined parameters. This is important, because it will allow users to invoke functions in
Thermodynamics.jl
without requiring the full suite of parameters inThermodynamicsParameters
. For example, if one is only interested in computing density as a function of temperature, pressure, and (total) specific humidity, then they only require the universal gas constant and the molar masses of air and water.Next, this PR adds an example which illustrates such a parameter set, called
ConstitutiveParameters
. It culminates in this plot:which uses sea level data derived from the JRA55 reanalysis (subsampled to make the dataset smaller), showing the primary dependence of density on temperature, secondary dependence on pressure, and teritiary dependence on specific humidity for the typical conditions of the Earth's atmosphere at sea level.
Currently, there are no examples, so this PR introduces the first one. I'd be happy to turn the example into something that appears in the documentation via Literate (the example is very close to that form already).