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

Bug fix/conditionally compute tau cirrus after met downselection #87

Merged
merged 5 commits into from
Aug 31, 2023

Conversation

tsankar
Copy link
Collaborator

@tsankar tsankar commented Aug 30, 2023

Changes

  • Adds "compute_tau_cirrus_in_model_init" parameter which determines when tau_cirrus is computed.
  • In "auto" mode, computes tau_cirrus in init iff met is dask-backed. Otherwise, computes it after downselection.

Breaking changes

None

Fixes

  • Memory explosion when using CoCiP on non-dask-backed weather data.

Tests

  • QC test passes locally (make test)
    -- GCP tests in test_cache.py fail locally, presumably because of auth issues?
  • CI tests pass
    -- Let me know the best way to run these if necessary!

Reviewer

@zebengberg

Copy link
Contributor

@zebengberg zebengberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Tharun, this is great!

I made some a commit straight to main while your PR was opened ... can you rebase off main then re-push?

pycontrails/core/models.py Outdated Show resolved Hide resolved
Comment on lines +1282 to 1283
compute_tau_cirrus: bool | str = "auto",
shift_radiation_time: np.timedelta64 | None = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to remove the default values for compute_tau_cirrus (and for shift_radiation_time)? If we only ever pass model parameters into this function, then we may be less likely to create future bugs if these parameters don't take defaults. But if we're calling process_met_datasets in places where we don't specify compute_tau_cirrus or shift_radiation_time, leave as is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only other place we call process_met_datasets is in tests/benchmark/north-atlantic-study/validate.py, is this benchmark test still used? I agree that it would be safer to not include defaults here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've been meaning to run the benchmark tests occasionally in the github CI. That hasn't happened yet, and so I think there are many slightly broken things in the benchmark directory at this point. No need to worry about that!

@zebengberg zebengberg merged commit 6f2f66b into contrailcirrus:main Aug 31, 2023
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.

2 participants