Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ Thumbs.db
*.mov
*.wmv

.eggs
20 changes: 11 additions & 9 deletions climaccf/accf.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,20 +571,22 @@ def get_Fin(self):
:rtype: numpy.ndarray
"""
Fin = np.zeros (self.ds.t.values.shape)
for t in range(self.nt):
date = str(self.ds['time'].values[t])
month = date[5:7]
day = date[8:10]
N = (int(month) - 1) * 30 + int(day) # Day of year
delta = -23.44 * np.cos(np.deg2rad(360 / 365 * (N + 10)))
S = 1360 # W/m2, Solar constant
theta = np.sin(np.deg2rad(self.lat)) * np.sin(np.deg2rad(delta)) + np.cos(np.deg2rad(self.lat)) * np.cos(np.deg2rad(delta))
S = 1360 # W/m2, Solar constant

days_of_year = self.ds.time.dt.dayofyear.values # 1 to 365 for regular years, and 1 to 366 for leap years
deltas = -23.44 * np.cos(np.deg2rad(360 / 365 * (days_of_year + 10)))
thetas = [
np.sin(np.deg2rad(self.lat)) * np.sin(np.deg2rad(delta)) + np.cos(np.deg2rad(self.lat)) * np.cos(np.deg2rad(delta))
for delta in deltas
]

for t, theta in zip(range(self.nt), thetas):
for l in range(self.nl):
if self.member_bool:
for m in range(self.nm):
Fin[t,m,l,:,:] = S * theta
else:
Fin[t,l,:,:] = S * theta
Fin[t,l,:,:] = S * theta
return Fin

def get_encoding_dict(list_name, encoding):
Expand Down