from mysci.readdata import read_data from mysci.printing import print_comparison from mysci.computation import compute_windchill #column names and column indices to read columns = {'date': 0, 'time': 1, 'tempout': 2, 'windspeed': 7, 'windchill': 12} #data types for each column (only if non-string) types = {'tempout': float, 'windspeed': float, 'windchill': float} #initialize my data variable data = {} for column in columns: data[column] = [] #read the data file data = read_data(columns, types=types) #compute the wind chill temperature windchill = [] for temp, windspeed in zip(data['tempout'], data['windspeed']): windchill.append(compute_windchill(temp, windspeed)) #Output comparison print_comparison('WINDCHILL', data['date'], data['time'], data['windchill'], windchill)
from mysci.read_data import read_data from mysci.print import print_comparison from mysci.computation import compute_windchill # Column names and column indices to read columns = {"date": 0, "time": 1, "tempout": 2, "windspeed": 7, "windchill": 12} # Data types for each column (only if non-string) types = {"tempout": float, "windspeed": float, "windchill": float} # Read data from file data = read_data(columns, types=types) # compute wind chill index #windchill = [] #for temperature, windspeed in zip(data["tempout"], data["windspeed"]): # windchill.append(compute_windchill(temperature, windspeed)) # next line is previous three lines condensed windchill = [ compute_windchill(temperature, windspeed) for temperature, windspeed in zip(data["tempout"], data["windspeed"]) ] # Output comparison of data print_comparison("WINDCHILL", data["date"], data["time"], data["windchill"], windchill)
from mysci.readdata import read_data from mysci.printing import print_comparison from mysci.computation import compute_windchill # Column names and column indices to read columns = {'date':0, 'time':1, 'tempout':2, 'windspeed':7, 'windchill':12} # Data types for each column (only if non-string) types = {'tempout': float, 'windspeed': float, 'windchill': float} # Read data from file data = read_data(columns, types=types) # Running the function to compute wci windchill = [compute_windchill(t,w) for t, w in zip(data['tempout'], data['windspeed'])] # Output comparison of data print_comparison('WINDCHILL', data['date'], data['time'], data['windchill'], windchill)
from mysci.readdata import read_data from mysci.printing import print_comparison from mysci.computation import compute_windchill # Create a column dictionary (names and indices to read) columns = {'date': 0, 'time': 1, 'tempout': 2, 'windspeed': 7, 'windchill': 12} # Data types for each colun (only if not string) types = {'tempout': float, 'windspeed': float, 'windchill': float} # Read the data file data = read_data(columns, types=types) # Compute windchill index windchill = [ compute_windchill(t, w) for t, w in zip(data['tempout'], data[windspeed]) ] # Running the function to compute wci # Output comparison of data print_comparison('WINDCHILL', data['date'], data['time'], data['windchill'], windchill) #DEBUG