In [1]:
from preprocess import cwb_preproc
import potential_wind as pw
import pandas as pd
import numpy as np
In [2]:
# initialization
pws = pw.ws_array()
pws_orig = pw.ws()
cwb = cwb_preproc()
In [ ]:
%time dataf = cwb.fread('data/type_a/CWB_A1_C0A510.txt', ctype='a1'); pws.psatw(dataf, 'tx01')
In [ ]:
%time o = pws.psatw(dataf, 'tx01')
In [ ]:
idx_t = dataf[(dataf['tx01']+273.15 < 300.096)].index
len(idx_t)
#dataf['densold'] = pd.DataFrame([100.0]*len(idx_t), index=idx_t)
In [ ]:
def update_densold(i):
if i in list(idx_t):
return(100.0)
else:
return(600.0)
list_idx = (1,3,5,7,9)
In [ ]:
for i in list_idx:
dataf['densold'][i] = 100.0
In [ ]:
df = dataf[['psatw','tx01','wd01']][0:30]
In [ ]:
dataf1[ (dataf1<0) ].index
In [ ]:
df = pd.DataFrame(np.random.randn(20)*100, columns=['random'])
In [ ]:
df['random'] = pd.DataFrame(np.random.randn(20)*100, columns=['random'])
df['converg'] = np.nan
In [ ]:
for i in range(0,100):
df['random'] = pd.DataFrame(np.random.randn(20)*100, columns=['random'])
df['converg'][df['random'] == 15] = 1
idx = df['converg'][df['converg'] != 1].index
if len(idx) > 0:
df['random'] = pd.DataFrame(np.random.randn(len(idx)), index=idx.tolist())
else:
print(i)
In [ ]:
df['new'] = np.nan
In [ ]:
df['new'] = df['wd01'][(df['tx01'] > 15)]
In [ ]:
pws_orig.__densreg3__(628, 175.32)
In [ ]:
pws_orig.psatw(628)-1e-05
In [3]:
pws_orig.calc_pw(tx=283.15, ps=1000.6, rh=86, wd=2)
Out[3]:
In [ ]:
for i in df['tx01']+273.15:
print(pws_orig.dens_sat_vaptw(i))
In [ ]:
df['psatw']
In [5]:
pws_orig.psatw(283.15)
Out[5]:
In [ ]: