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

RCE class modifies input atmosphere #224

Open
olemke opened this issue May 22, 2024 · 1 comment
Open

RCE class modifies input atmosphere #224

olemke opened this issue May 22, 2024 · 1 comment

Comments

@olemke
Copy link
Member

olemke commented May 22, 2024

The RCE class changes the values of the input atmosphere:

self.atmosphere["T"] += self.radiation["net_htngrt"] * self.timestep_days

This can have unexpected side effects if a user wants to do several RCE runs (even with newly created RCE instances) consecutively with the same input atmosphere.

To prevent side effects, it would be preferable to make a deepcopy of the input atmosphere when initializing the RCE class:

self.atmosphere = atmosphere

If this is not desirable for other reasons, the documentation of the atmosphere parameter should at least contain a clear warning that this class will modify the input variable.

@lkluft
Copy link
Member

lkluft commented May 24, 2024

So far, the reasoning has simply been that it seems obvious that the model run will change the atmospheric state. However, I see that one might expect the initial state and the internal model state to be independent.

I think it is fine to just do a deep copy at initialization (this needs to be done for the surface as well). It might actually break scripts of users who have adapted to the current behavior, i.e. expecting the atmosphere to change. But the output files aren't affected, and the change from atmosphere to rce.atmosphere seems doable.

@lkluft lkluft mentioned this issue May 31, 2024
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

No branches or pull requests

2 participants