<jupyter_start><jupyter_text>Harvard GSD  J-Term 2022  Introduction to Data Science for Building Simulation and Architectural Design***Instructor: <NAME>, <EMAIL> Date/Time: Jan 3-7/ 10:00 - 11:30 a.m. ***Pease copy this colab notebook and rename it before you start! ---<jupyter_code>import numpy as np
import pandas as pd
import os<jupyter_output><empty_output><jupyter_text>Read and Manupulation: weather file<jupyter_code>from google.colab import drive
drive.mount('/content/drive')
# pandas data frame from csv
def getPandasFromFile(path, fileName, theSkipRow):
    path = os.path.join(path , fileName)
    return pd.read_csv(path, skiprows= theSkipRow , header=None, index_col = False)
def SavePandasToCSV(d, path):
    d.to_csv(path)
    return "done!!"

# modify the following file path for your GoogleDrive
FILEPATH = '/content/drive/My Drive/Colab Notebooks/J_Term/USA_MA_Boston-Logan.Intl.AP.725090_TMY3.epw'

df = getPandasFromFile("",FILEPATH,8)
df
# rename dataframe with known column names

theDf =df.rename(index=str, columns={0:"year", 1: "Month", 2: "Day", 3:"Hour",4:"Minute",6:"DB_temp",
                                     7:"Dew_Point",
                                     8:"RH",9:"P", 10:"Horiz_Rad",11:"Normal_Rad",12:"Sky_Rad",
                                     13:"G_Horiz_Rad",14:"Dir_Normal_Rad",15:"Diff_Horiz_Rad",
                                     16:"G_Horiz_Illu",17:"Dir_Normal_Illu",18:"Diff_Horiz_Illu",
                                     19:"Zenith_Illu",20:"Wind_Direction",21:"Wind_Speed",
                                     22:"Total_Sky_Cov",23:"Opaque_Sky_Cov",24:"Visibility",
                                     25:"field_Ceiling_H",26:"Whtr_Observ",27:"Whtr_Codes",
                                     28:"Pred_Water",29:"AeroesOptical_D",30:"Snow_Depth",
                                     31:"Days_Since_Snow"
                                    })
# your code here


# check the the column names

# your code here

# create subset dataframe of weather information
NewDf = theDf[['DB_temp',"Dew_Point",
               'RH','P','Normal_Rad', 'Sky_Rad','Wind_Direction', 'Wind_Speed'
              ]]
NewDf.tail()
# Create index with time series information

# your code here

NewDf.index = myTime
NewDf
NewDf.describe()
# Save the dataframe to the file 

# your code here<jupyter_output><empty_output><jupyter_text>Visualization: weather information<jupyter_code># Import libraries for the visualization
import matplotlib
import matplotlib.pyplot as plt<jupyter_output><empty_output><jupyter_text>Visualize dry bulb temperature with boundary condition<jupyter_code># your code here


plt.figure(figsize=(15,8))
plt.plot(x,temp)
plt.title('NV potential days')
plt.xlabel('Year')
plt.ylabel('Temperature (F)')
plt.legend(loc='best')

plt.show()
plt.figure(figsize=(15,8))
plt.plot(myTime,temp)
plt.title('NV potential days')
plt.xlabel('Year')
plt.ylabel('Temperature (F)')
plt.legend(loc='best')

# your code here



plt.show()<jupyter_output>No handles with labels found to put in legend.<jupyter_text>Visualize histogram of relative humidity data<jupyter_code># your code here


plt.figure(figsize=(15,8))
plt.hist(RH, bins =36, color ="grey", edgecolor='black', alpha = 0.5)
plt.show()<jupyter_output><empty_output><jupyter_text>epw file modification<jupyter_code># Read data
d = getPandasFromFile("",FILEPATH, 8)
d.head(3)
# select target values
df_wind = d.iloc[:,21]
print (df_wind)
# Create value list to replace target list
array = []
for i in range (0,len(df_wind)):
    array.append(float(0.1))

d.loc[:,21] = array
# replace target list to the new list
df_wind = d.iloc[:,21]
print (df_wind)
# Save data frame
d.to_csv("/content/drive/My Drive/Colab Notebooks/J_Term/my2.epw", index=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1284282700421941, 'fraction_numerical': 0.026371308016877638, 'mean_word_length': 3.6143552311435525, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '660245', 'license': 'CC0-1.0', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1273, 'n_words': 280, 'path': 'Day1_WeatherFile.ipynb', 'repo_name': 'suechengsd/buildingperformance', 'size': '3812'}