Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/ecmwf/climetlab into dev…
Browse files Browse the repository at this point in the history
…elop
  • Loading branch information
floriankrb committed Aug 14, 2023
2 parents 55b054f + d96301c commit 3fe69e9
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 3fe69e9

Please sign in to comment.