-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata_aggregation.py
More file actions
38 lines (32 loc) · 1.44 KB
/
data_aggregation.py
File metadata and controls
38 lines (32 loc) · 1.44 KB
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
28
29
30
31
32
33
34
35
36
37
38
import pandas as pd
from cssaw_central.Session import Session
import sys
sys.path.append('Getter Methods/')
# Enables importing files in getter methods
from dwa_getter import get_monthly_dwa_data
from grace_gracefo_getter import get_lwe_by_range
from saws_getter import get_monthly_saws_data
def get_all_data(startDate, endDate, sess, station):
""" Returns a pandas df with monthly data
args:
startDate ---- a string in the YYYYMMDD format for the start of the desired data
endDate ---- a string in the YYYYMMDD format for the end of the desired data
sess ---- a cssaw-central session used to query the database
station ---- a string representing the desired station. ex: 'A2H056'
"""
dwa_df = get_monthly_dwa_data(startDate,endDate,sess,station)
lat = dwa_df["lat"].iloc[0]
long = dwa_df["long"].iloc[0]
print(lat,long)
print(dwa_df.head())
lwe_df = get_lwe_by_range(startDate,endDate,sess, bbox=[str(lat-1),str(long-1),str(lat+1),str(long+1)] )
print(lwe_df.head())
return "Not implemented"
if __name__ == "__main__":
credentials = open('credentials.txt', 'r')
username = credentials.readline().replace('\n','')
password = credentials.readline().replace('\n','')
host = credentials.readline().replace('\n','')
credentials.close()
sess = Session(username,password, host, db='CENTRAL')
print(get_all_data("20030100","20040100",sess,"A9H029"))