diff --git a/downloadData/functions/update_wind_velocity.py b/downloadData/functions/update_wind_velocity.py new file mode 100644 index 0000000..489523a --- /dev/null +++ b/downloadData/functions/update_wind_velocity.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +""" +Created on Fri Jun 15 14:52:14 2018 + +@author: Taeke +""" +import numpy as np + +def update_wind_velocity(data, filterKeys, generalMissingValue,missingValueList): + + # The rate of horizontal travel of air past a fixed point in meters per second + windSpeed = np.array(data['wind_speed']) + + # The angle, measured in a clockwise direction, between true north and + # the direction from which the wind is blowing. + # MIN: 001 MAX: 360 UNITS: Angular Degrees + windDir = np.radians(np.array(data['wind_direction'])) + + + data['wind_north'] = (-np.cos(windDir) * windSpeed).tolist() + data['wind_east'] = (-np.sin(windDir) * windSpeed).tolist() + + return data \ No newline at end of file diff --git a/downloadData/pre_processing.py b/downloadData/pre_processing.py index 5a18fe7..c550aa2 100644 --- a/downloadData/pre_processing.py +++ b/downloadData/pre_processing.py @@ -18,7 +18,7 @@ def pre_processing(startYear, endYear, RADIUS, cut_off_percentage, maxDiff, gene from match_dates import match_dates from desired_date_list import desired_date_list from replace_missing_values import replace_missing_values - + from update_wind_velocity import update_wind_velocity #map location unprocessed data deepLearningPath, _ = os.path.split(os.getcwd()) @@ -61,6 +61,10 @@ def pre_processing(startYear, endYear, RADIUS, cut_off_percentage, maxDiff, gene data_processed[ID]= match_dates(dateList, data_year, currentKeys, ID, maxDiff, missingValueList) data_processed[ID] = replace_missing_values(data_processed[ID],filterKeys, generalMissingValue,missingValueList) + data_processed[ID] = update_wind_velocity(data_processed[ID], filterKeys, generalMissingValue,missingValueList) + + + #have to assign dummy value otherwise deleted key gets printed #SAVE DICTIONARIES if not os.path.exists(processedFilesLocation):