-
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
Isolate config and argument parsing #1086
Conversation
53ef44c
to
728b0e2
Compare
@@ -1,7 +1,5 @@ | |||
FLOAT_TYPE: "Float32" | |||
apply_limiter: false | |||
dt: "400secs" |
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.
Removed because 400secs
is the default for dt
and dt_cpl
728b0e2
to
bac5919
Compare
31dbea9
to
c5ba1c7
Compare
c5ba1c7
to
3662d57
Compare
6c02f03
to
c6817f3
Compare
d01a9e8
to
54e6b6b
Compare
90d1c2a
to
1e40048
Compare
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.
This is a good step in the direction of isolating config/argument parsing. The next step would be to make sure that we don't use the parsed_args anywhere after the initial parsing. This would entail making everything types/symbols and ensuring that we are not matching strings after the initial parsing
If we did this, wouldn't we still use the args we've read in after the initial parsing? We would just use them for dispatch instead of matching strings |
1e40048
to
7cbcd3c
Compare
Yes, but this would allow users to run without any argument parsing at all, just setting up the correct types (and only the relevant types, as we might want to do in a CI context). It would also allow users to extend the behavior of functions with their custom types, whereas it is not possible to extend string-matching without changing the source code. |
I see! That would be nice for things like the turbulent flux partition, albedo to use, etc, but I think we'll still need to parse user inputs for things like dt, t_end, output directory, etc |
86d5031
to
aa188b2
Compare
73cccba
to
703bfab
Compare
This commit isolates the argument and configuration file parsing to functions. Since we have one configuration file each for the coupled simulation and for the atmosphere, we end up with the following functions, as well as smaller helper functions. These are located in the new `experiments/ClimaEarth/arg_parsing.jl file`. - `get_coupler_config`, `get_coupler_args`, `get_atmos_args` These functions are called from the driver `run_amip.jl`, where the returned arguments are unpacked. After that point, the config files are not accessed further down in the driver, so we have isolated the config file access to the initial step.
703bfab
to
5d1154c
Compare
Purpose
closes #678
This PR isolates the argument and configuration file parsing to functions. Since we have one configuration file each for the coupled simulation and for the atmosphere, we end up with the following functions, as well as smaller helper functions. These are located in the new
experiments/ClimaEarth/arg_parsing.jl file
.get_coupler_config
,get_coupler_args
,get_atmos_args
These functions are called from the driver
run_amip.jl
, where the returned arguments are unpacked. After that point, the config files are not accessed further down in the driver, so we have isolated the config file access to the initial step.Many files are changed in this PR because argument changes are propagated to many config files. The main files to look at for review are:
run_amip.jl
,arg_parsing.jl
,cli_options.jl
, andclimaatmos.jl
.Note that this PR introduces some very minor behavioral changes in buildkite runs because the atmos config is no longer added to the coupler config. This will allow us to have better separation of and control over the two in the future.
To-do
argparse
andget_args
functions - want same parameters available from command line and from config filesdt_cpl
to use same format as all other timesrestart_dir
default tonothing
Notes