Skip to content
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

WIP: Updating package structure: submodules, Julia-fied diagnostics, I/O capabilities #19

Merged
merged 16 commits into from
Jul 5, 2020

Conversation

hdrake
Copy link
Collaborator

@hdrake hdrake commented Jul 2, 2020

See comments in past commits for more info.

Tagging @fonsp

Still need to update T, D, B, C, etc. Still quite a bit of work to go.
Ideally, we would re-use the functions defined in the `Diagnostics` submodule. I need to test JuMP a bit more to figure out the best way to implement this. Can any of the functions be used right out of the box or do they need to be registered? Do they only need to be registered if they are a function of the control variable? Can they be a function of multiple parameters, including a combination of control variables and other (constant) parameters? Can functions w/ operations
like `cumsum` be registered and operate within JuMP?
Huge commit. Highlights are:
1. The source code has now been split up into various sub-modules (e.g. Models, Diagnostics, Plotting, IO, etc) which makes a lot of things easier, more efficient, more modular, and more extendable.

2. Each of the diagnostic functions now has *at least* two methods: the first method takes in the numerical values (integers, floats, arrays) that determine the function while the second method takes in a ClimateModel instance (and various boolean options for e.g. turning off individual controls or turning on/off discounting). This makes the code much easier to reach, more flexible, more modular, less prone to typos / bugs. Our hope is that in a future commit these diagnostics can
even be **JuMPified** so they can be used directly by the optimization functions. Additionally, some inconsistencies in the ClimateModel struct whereby some model parameters were computed upon instantiation– but were updated if the mutable struct is mutated- have been fixed by splitting parameters into independent parameters (e.g. the feedback parameter) and diagnostic parameters (e.g. the climate sensitivity).

3. Implementation of a straight-forward Input/Output process, where ClimateModel or ClimateModelParameters can be saved and loaded in a nested dictionary format to/from JSON files. This works really well using the JSON2.jl package since Julia's `struct` objects are easily translated into dictionaries, which can easily be written as strings.

All of these changes have so far been tested in the default tutorial only, which has also been slightly modified and lengthened (e.g. now includes a section on I/O).
@hdrake hdrake changed the title Updating package structure: submodules, Julia-fied diagnostics, I/O capabilities WIP: Updating package structure: submodules, Julia-fied diagnostics, I/O capabilities Jul 2, 2020
@hdrake
Copy link
Collaborator Author

hdrake commented Jul 2, 2020

To do list:

  • look into why CI build is failing
  • add a proper ClimateMARGO test (e.g. optimizing with default parameters) and checking it gives the correct output (within some tolerance)
  • update the Drake et al. 2020 figures
  • check that the binder works

Once I've done all of this, I'll probably release v0.1.0 and then starting ramping up the documentation and release v0.2.0 whenever the basics of documentation are finished.

@hdrake hdrake mentioned this pull request Jul 2, 2020
fonsp and others added 7 commits July 3, 2020 02:55
The changes to the source code are minor quality of life changes & a bug fix for the figure labels.
I've now recreated all of the Drake et al. 2020 figures w/ the new updates to the code base! Should be ready for a new release, assuming all tests pass!
@hdrake hdrake merged commit 102fdda into master Jul 5, 2020
@hdrake
Copy link
Collaborator Author

hdrake commented Jul 5, 2020

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Comments on pull requests will not trigger Registrator, as it is disabled. Please try commenting on a commit or issue.

@hdrake hdrake deleted the updating-structure branch July 15, 2020 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants