Skip to content

Commit

Permalink
Working on creating wind vel vector
Browse files Browse the repository at this point in the history
  • Loading branch information
TaekedeHaan committed Jun 15, 2018
1 parent 8a5b4b5 commit 25e30e8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
23 changes: 23 additions & 0 deletions downloadData/functions/update_wind_velocity.py
Original file line number Diff line number Diff line change
@@ -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
6 changes: 5 additions & 1 deletion downloadData/pre_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 25e30e8

Please sign in to comment.