<jupyter_start><jupyter_text>'T (degC)', 'p (mbar)', 'rho (g/m**3)'컬럼만 뽑아다가 시각화<jupyter_code>plot_cols = ['T (degC)', 'p (mbar)', 'rho (g/m**3)']
plot_features = df[plot_cols]
plot_features.index = date_time
_ = plot_features.plot(subplots=True)
plot_features = df[plot_cols][:480]
plot_features.index = date_time[:480]
_ = plot_features.plot(subplots=True)
df.describe()
df.describe().transpose() # 가로 세로 반전<jupyter_output><empty_output><jupyter_text>풍속 데이터에서 -9999 값이 있는 것으로 보아기본 데이터에 문제가 있음<jupyter_code>wv = df['wv (m/s)']
bad_wv = wv == -9999.0
wv[bad_wv] = 0.0

max_wv = df['max. wv (m/s)']
bad_max_wv = max_wv == -9999.0
max_wv[bad_max_wv] = 0.0
df.describe().transpose()
plt.hist2d(df['wd (deg)'], df['wv (m/s)'], bins=(50, 50), vmax=400)
plt.colorbar()
plt.xlabel('Wind Direction [deg]')
plt.ylabel('Wind Velocity [m/s]')<jupyter_output><empty_output><jupyter_text>풍속과 풍향을 조합하여 시각화<jupyter_code>wv = df.pop('wv (m/s)')
max_wv = df.pop('max. wv (m/s)')

# Convert to radians.
wd_rad = df.pop('wd (deg)')*np.pi / 180

# Calculate the wind x and y components.
df['Wx'] = wv*np.cos(wd_rad)
df['Wy'] = wv*np.sin(wd_rad)

# Calculate the max wind x and y components.
df['max Wx'] = max_wv*np.cos(wd_rad)
df['max Wy'] = max_wv*np.sin(wd_rad)<jupyter_output><empty_output><jupyter_text>풍속과 풍향을 이용하여 x, y 방향 벡터로 변환하면모델이 더 정확하게 예측이 가능하다고 함<jupyter_code>plt.hist2d(df['Wx'], df['Wy'], bins=(50, 50), vmax=400)
plt.colorbar()
plt.xlabel('Wind X [m/s]')
plt.ylabel('Wind Y [m/s]')
ax = plt.gca()
ax.axis('tight')
timestamp_s = date_time.map(datetime.datetime.timestamp)
timestamp_s<jupyter_output><empty_output><jupyter_text>datetime 문자열 보단 초가 더 연산에 유리<jupyter_code>day = 24*60*60
year = (365.2425)*day

df['Day sin'] = np.sin(timestamp_s * (2 * np.pi / day))
df['Day cos'] = np.cos(timestamp_s * (2 * np.pi / day))
df['Year sin'] = np.sin(timestamp_s * (2 * np.pi / year))
df['Year cos'] = np.cos(timestamp_s * (2 * np.pi / year))
plt.plot(np.array(df['Day sin'])[:25])
plt.plot(np.array(df['Day cos'])[:25])
plt.xlabel('Time [h]')
plt.title('Time of day signal')<jupyter_output><empty_output><jupyter_text>하루중 시간, 연중 시간 주기를 계산<jupyter_code>fft = tf.signal.rfft(df['T (degC)'])
f_per_dataset = np.arange(0, len(fft))

n_samples_h = len(df['T (degC)'])
hours_per_year = 24*365.2524
years_per_dataset = n_samples_h/(hours_per_year)

f_per_year = f_per_dataset/years_per_dataset
plt.step(f_per_year, np.abs(fft))
plt.xscale('log')
plt.ylim(0, 400000)
plt.xlim([0.1, max(plt.xlim())])
plt.xticks([1, 365.2524], labels=['1/Year', '1/day'])
_ = plt.xlabel('Frequency (log scale)')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20222991157247214, 'fraction_numerical': 0.03652441368704344, 'mean_word_length': 6.051490514905149, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '571097', 'license': 'MIT', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1369, 'n_words': 215, 'path': 'notebook/forcast weather.ipynb', 'repo_name': 'KangnamUnivShuttle/tensor_study', 'size': '2601'}