Example #1
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()
Example #2
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()
Example #3
0
- longitude: 8.1125
- UTM_EAST: 130049
- UTM_NORTH: 6802130
- URL: ftp://ftp.met.no/users/dagrunvs/xgeo/    //Skal det enda kjøres fra Dagrunns konto?
- MOH:


__author__ = 'kmu'
'''

import openpyxl
from crocus_station_db import CrocusStationDB

ftp_url = r'''ftp://ftp.met.no/users/dagrunvs/xgeo/'''

db = CrocusStationDB('../Test/Data/stations.db')
all_stations = db.get_all_stations()


wb = openpyxl.Workbook()
ws = wb.get_active_sheet()
ws.title = 'crocus_stations'

title_row = 0

stnr_col = 0
name_short_col = 1
name_col = 2
lat_col = 3
lon_col = 4
utme_col = 5