-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgather_data.py
27 lines (24 loc) · 917 Bytes
/
gather_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'''
Script to add NDVI and METEO information to original dataset
Since the dataset we use is ~1035000 records,
and the weather API has an HOURLY and DAILY limits
this script was run multiple times in batches in order to process the whole dataset
'''
import pandas as pd
import os
import warnings
from utils.utils import add_NDVI_feature, add_weather_info
warnings.filterwarnings('ignore')
#ADD NDVI
data = pd.read_csv(os.path.join('data', 'StorkMigration.csv'))
data['timestamp'] = pd.to_datetime(data['timestamp'])
data = data[data['timestamp'] >= '2013-03-01']
data = add_NDVI_feature(data)
#ADD METEO DATA
#data = pd.read_csv('StorkMigrationWithNDVI.csv')
data['timestamp'] = pd.to_datetime(data['timestamp'])
print(data.shape)
data = add_weather_info(data[875671:])
#data.to_csv(os.path.join("data","FILENAME.csv"))
data.to_csv(os.path.join("data","StorkMigrationWithNDVIWeather-52.csv"))
print('Data to csv')