climlab icon indicating copy to clipboard operation
climlab copied to clipboard

Hard-coded length of solar year

Open brian-rose opened this issue 2 years ago • 1 comments

There are several places in the codebase where the length of the solar year is hard-coded to the value given by

climlab.utils.constants.days_per_year

This creates challenges particularly for modeling planetary atmospheres.

Related to #120, it would be good to have the option to modify this.

I hacked up some fixes that seem to work (not currently in a PR):

  • provide an optional days_per_year argument to the climlab.solar.insolation.daily_insolation() function (and pass this in the internal call to climlab.solar.insolation.solar_longitude(), which already accepts this argument
  • Add a .days_per_year attribute to the TimeDependentProcess class (which defaults to the standard Earth value)
  • Use this value in the timestep.setter method
  • Modify the DailyInsolation class to use the stored days_per_year value

Maybe it would be best to continue to pursue a general solution to #120, which I started to hack up in #123

brian-rose avatar May 11 '22 18:05 brian-rose

#188 added the days_per_year argument to climlab.solar.insolation.daily_insolation() and the new climlab.solar.insolation.instant_insolation()

That takes care of the insolation code, but not the stuff related to TimeDependentProcess and time-stepping.

Leaving this issue open to track a more complete solution.

brian-rose avatar Jul 11 '23 02:07 brian-rose