Skip to content

Commit

Permalink
pandas
Browse files Browse the repository at this point in the history
  • Loading branch information
mullenkamp committed Nov 6, 2024
1 parent 8f2e64e commit 8df078d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion eto/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def tsreg(ts, freq=None, interp=False, maxgap=None):
-------
DataFrame
"""

if freq is None:
freq = pd.infer_freq(ts.index[:3])
ts1 = ts.resample(freq).mean()
Expand Down
8 changes: 4 additions & 4 deletions eto/param_est.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def param_est(self, df, freq='D', z_msl=None, lat=None, lon=None, TZ_lon=None, z

####################################
###### Check to make sure minimum requirements are met
if 'H' in freq:
if 'h' in freq.lower():
T_mean_bool = self.ts_param['T_mean'].isnull().any()
RH_mean_bool = self.ts_param['RH_mean'].isnull().any()
e_a_bool = self.ts_param['e_a'].isnull().any()
Expand Down Expand Up @@ -133,7 +133,7 @@ def param_est(self, df, freq='D', z_msl=None, lat=None, lon=None, TZ_lon=None, z
self.ts_param.loc[self.ts_param['T_mean'].isnull(), 'T_mean'] = (self.ts_param.loc[self.ts_param['T_mean'].isnull(), 'T_max'] + self.ts_param.loc[self.ts_param['T_mean'].isnull(), 'T_min'])/2

## Vapor pressures
if 'H' in freq:
if 'h' in freq.lower():
self.ts_param['e_mean'] = 0.6108*np.exp(17.27*self.ts_param['T_mean']/(self.ts_param['T_mean']+237.3))
self.ts_param.loc[self.ts_param['e_a'].isnull(), 'e_a'] = self.ts_param.loc[self.ts_param['e_a'].isnull(), 'e_mean']*self.ts_param.loc[self.ts_param['e_a'].isnull(), 'RH_mean']/100
else:
Expand Down Expand Up @@ -169,7 +169,7 @@ def param_est(self, df, freq='D', z_msl=None, lat=None, lon=None, TZ_lon=None, z
d_r = 1+0.033*np.cos(2*np.pi*Day/365)
w_s = np.arccos(-np.tan(phi)*np.tan(delta))

if 'H' in freq:
if 'h' in freq.lower():
hour_vec = df.index.hour
b = (2*np.pi*(Day - 81))/364
S_c = 0.1645*np.sin(2*b) - 0.1255*np.cos(b) - 0.025*np.sin(b)
Expand Down Expand Up @@ -199,7 +199,7 @@ def param_est(self, df, freq='D', z_msl=None, lat=None, lon=None, TZ_lon=None, z
R_ns = (1 - alb)*self.ts_param['R_s']

# R_nl
if 'H' in freq:
if 'h' in freq.lower():
R_nl = (2.043*10**(-10))*((self.ts_param['T_mean'] + 273.16)**4)*(0.34-0.14*(self.ts_param['e_a']) **0.5)*((1.35*self.ts_param['R_s']/R_so) - 0.35)
else:
R_nl = (4.903*10**(-9))*(((self.ts_param['T_max'] + 273.16)**4 + (self.ts_param['T_min'] + 273.16) **4)/2)*(0.34-0.14*(self.ts_param['e_a']) **0.5)*((1.35*self.ts_param['R_s']/R_so) - 0.35)
Expand Down

0 comments on commit 8df078d

Please sign in to comment.