Skip to content

Improve insolation handling#209

Merged
brian-rose merged 13 commits intoclimlab:mainfrom
brian-rose:coszen
Jan 16, 2025
Merged

Improve insolation handling#209
brian-rose merged 13 commits intoclimlab:mainfrom
brian-rose:coszen

Conversation

@brian-rose
Copy link
Copy Markdown
Collaborator

This PR closes #208 (eventually).

So far the PR just refactors the insolation calculator into more reusable functions. Working toward a better and more consistent treatment of insolation internally within climlab. coszen should be elevated as the primary input to radiation processes, with insolation being treated as a diagnostic.

@brian-rose
Copy link
Copy Markdown
Collaborator Author

A few new things:

  • I went through and replaced eccentricity_factor with irradiance_factor throughout the code. This is a breaking change, sort of, except that support for user specification of this parameter was never fully implemented, so I don't think it will break anything in practice. And it will avoid future confusion, because this factor is not the eccentricity, but rather the number multiplied by the solar constant to get the current solar irradiance (defaults to 1, but changes throughout the year due to the eccentric orbit).
  • Changed the defaults in the climlab.radiation._Radiation_SW parent class to set a default value for coszen and infer insolation from coszen, rather than the other way around. This doesn't seem to break anything.
  • Some more modular reorganization of the code in climlab.solar.insolation. Working toward having clean ways to call methods that return not just insolation, but the coszen and irradiance_factor values that are needed to drive radiation processes. Still a work in progress.

@brian-rose
Copy link
Copy Markdown
Collaborator Author

brian-rose commented Jan 16, 2025

Have now reorganized the code more and written documentation. There are new methods

climlab.solar.insolation.instant_insolation_factors()

and

climlab.solar.insolation.daily_insolation_factors()

that are called similarly to the existing climlab.solar.insolation.daily_insolation(), but return coszen and irradiance_factor.

So we preserve all existing functionality but make it simple to get the parameters we need to pass to radiation modules.

WIP: supporting multiple time-averaging methods for the daily zenith angle. The function climlab.solar.insolation.daily_insolation_factors() accepts an input flag weighting where we can specify which time averaging method to use.

Still to do:

  • Code to scale the irradiance_factor for cases where we use something other than simple time averaging for coszen
  • Tests for that functionality

Then in a further PR I will work on adapting the Insolation process objects to handle all this new functionality.

@brian-rose brian-rose marked this pull request as ready for review January 16, 2025 23:13
@brian-rose brian-rose merged commit d53ea47 into climlab:main Jan 16, 2025
@brian-rose brian-rose deleted the coszen branch January 16, 2025 23:16
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.

Can't independently specify insolation and solar zenith angle

1 participant