Skip to content

Commit

Permalink
Add tisr
Browse files Browse the repository at this point in the history
  • Loading branch information
b8raoult committed Aug 14, 2023
1 parent 5bb14f5 commit d96301c
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions climetlab/sources/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,33 @@ def sin_local_time(self, date):
def insolation(self, date):
from ecmwf_mlkit.variables.insolation import insolation

date = to_datetime(date)
result = insolation([date], self.latitude_(), self.longitude_())
return result.flatten()

def toa_incident_solar_radiation(self, date):
from earthkit.meteo.solar import toa_incident_solar_radiation

date = to_datetime(date)
result = toa_incident_solar_radiation(
date - datetime.timedelta(hours=1),
date,
self.latitude_(),
self.longitude_(),
)
return result.flatten()

def cos_solar_zenith_angle(self, date):
from earthkit.meteo.solar import cos_solar_zenith_angle

date = to_datetime(date)
result = cos_solar_zenith_angle(
date,
self.latitude_(),
self.longitude_(),
)
return result.flatten()


class ConstantField:
def __init__(self, date, param, proc, shape):
Expand Down

0 comments on commit d96301c

Please sign in to comment.