Beispiel #1
0
def eklima_station_list():
    """
    Currently I need to change this part in wsklima_parser.py

        def parse_get_stations_properties(xml_data):
        #TODO: need to fix the case when a file name is directly passed.


        if os.path.isfile(xml_data):
            root = etree.parse(xml_data)
        elif isinstance(xml_data, str):
            root = etree.fromstring(xml_data)



    :return:
    """
    sd = parse_get_stations_properties(
        r'./Test/Data/getStationsProperties.out.all.xml')
    db = CrocusStationDB('./Test/Data/all_eklima_stations.db')
    # db.create_station_db()
    for st in iter(sd.values()):  # sd.itervalues() in Python 2.7
        print(st)
        db.insert_station(st)
    db.close()
Beispiel #2
0
def crocus_station_list():
    stat = json.load(open('Test/Data/crocus_stations.json', 'r'))
    station_list = stat['crocus_stations_2016']

    wr = wsKlimaRequest('getStationsProperties', {'stations': station_list, 'username': ''})
    rsp = wr.get()
    print(type(rsp.content))
    sd = parse_get_stations_properties(rsp.content)

    # sd = crocus_station_list()
    db = CrocusStationDB('./Test/Data/stations.db')
    # db.create_station_db()
    for s in iter(sd.values()):
        print(s)
        db.insert_station(s)
    db.close()
Beispiel #3
0
def crocus_station_list():
    stat = json.load(open('Test/Data/crocus_stations.json', 'r'))
    station_list = stat['crocus_stations_2016']

    wr = wsKlimaRequest('getStationsProperties', {
        'stations': station_list,
        'username': ''
    })
    rsp = wr.get()
    print(type(rsp.content))
    sd = parse_get_stations_properties(rsp.content)

    # sd = crocus_station_list()
    db = CrocusStationDB('./Test/Data/stations.db')
    # db.create_station_db()
    for s in iter(sd.values()):
        print(s)
        db.insert_station(s)
    db.close()
Beispiel #4
0
def eklima_station_list():
    """
    Currently I need to change this part in wsklima_parser.py

        def parse_get_stations_properties(xml_data):
        #TODO: need to fix the case when a file name is directly passed.


        if os.path.isfile(xml_data):
            root = etree.parse(xml_data)
        elif isinstance(xml_data, str):
            root = etree.fromstring(xml_data)



    :return:
    """
    sd = parse_get_stations_properties(r'./Test/Data/getStationsProperties.out.all.xml')
    db = CrocusStationDB('./Test/Data/all_eklima_stations.db')
    # db.create_station_db()
    for st in iter(sd.values()): # sd.itervalues() in Python 2.7
        print(st)
        db.insert_station(st)
    db.close()
Beispiel #5
0
'''
stnr = 63705
stations = [stnr,]

t_from = '2015-12-04'
t_to = '2015-12-07'

tt_id = 2


'''
STEP 1
'''
rsp = wsKlimaRequest('getStationsProperties', {'stations': stations, 'username': ""}).get()

st_props = parse_get_stations_properties(rsp.content)

print(st_props[str(stations[0])])


rsp = wsKlimaRequest('getElementsFromTimeserieTypeStation', {'stations': stations, 'timeserietypeID': tt_id}).get()

st_elems = parse_get_elements_from_timeserie_type_station(rsp.content)

relevant_sensors = ['TA',
                    'RR_1', 'RR_6', 'RRINTENS', 'DAGRRRR00', 'DAGRRSS00',
                    'X1UU', 'X1UM', 'UU',
                    'FX_6', 'FX_12', 'X1FX_1', 'X1FF', 'DD', 'FF',
                    'SAM', 'SA', 'RTS_1', 'SS_1', 'SS_24',
                    'X1QO', 'QNET', 'QSI', 'QSO', 'QRA', 'QOB', 'QLI', 'QLO', 'QD', 'QR', 'QT']