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

Reading parameters from toml in the yaml file assumes that the toml is in the working directory #2167

Open
Tracked by #1980
Sbozzolo opened this issue Sep 28, 2023 · 4 comments

Comments

@Sbozzolo
Copy link
Member

Steps to reproduce:

import ClimaAtmos as CA
cd("/tmp")
CA.AtmosConfig(; config_dict = CA.config_from_target_job("sphere_aquaplanet_rhoe_equilmoist_allsky_gw_raw_zonallyasymmetric"))

Returns this errror:

"toml/sphere_aquaplanet_rhoe_equilmoist_allsky_gw_raw_zonallyasymmetric.toml": No such file

As a result, it is not practical to run the various configurations from anywhere but the root of the ClimaAtmos project.

I am not sure what is the cleanest way to fix this. On one side, reading the toml distributed with ClimaAtmos defies the purpose of having them as a configuration. On the other hand, this makes impossible to run the configurations unless one clones the ClimaAtmos repo and runs the code from the root of the project.

@nefrathenrici
Copy link
Member

nefrathenrici commented Oct 3, 2023

The simplest fix I have come up with: if the TOML path is not a valid file, we can prepend the default toml location to the path, check if that is a file, and notify the user. This would support both:

  • users submitting their own parameter files that aren't in the default /toml/ location
  • users running the given model configurations outside of pkgdir(CA), who still want to access the default TOML files.

@Sbozzolo
Copy link
Member Author

Sbozzolo commented Oct 3, 2023

I think that this would cover most of the common use cases I can think of. (A case that would be not be covered if someone wants to run an example configuration but change one single parameter.)

@nefrathenrici
Copy link
Member

A case that would be not be covered if someone wants to run an example configuration but change one single parameter.

Yes, this would require a bigger change, and it is not too difficult in the current setup:

config_dict = CA.config_from_target_job("sphere_aquaplanet_rhoe_equilmoist_allsky_gw_raw_zonallyasymmetric")
config_dict["toml"]  = "path/to/toml"  
# Or config_dict["toml"] = Dict
CA.AtmosConfig(; config_dict)

@simonbyrne
Copy link
Member

First step is to document all the input files required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants