예제 #1
0
def save_csv(urls,path,name):
    dcommons = datacommons.toolkit(username,password)
    data,ordercol,head = filezip.meso2json(urls)
    f1=open(os.path.join(path,name),'w')
    f1.write(filezip.csvfile_processor(data,cols=ordercol,header=head))
    f1.close()
    host=get_host(dcommons)
    return os.path.join(path.replace(host['base_directory'],host['url']),name)
예제 #2
0
def save_csv(urls, path, name):
    db = MongoClient(config.catalog_uri)
    #dcommons = datacommons.toolkit(username,password)
    data, ordercol, head = filezip.meso2json(urls)
    f1 = open(os.path.join(path, name), 'w')
    f1.write(filezip.csvfile_processor(data, cols=ordercol, header=head))
    f1.close()
    host = get_host(db)
    return os.path.join(path.replace(host['base_directory'], host['url']),
                        name)
예제 #3
0
파일: USGS.py 프로젝트: richasaraswat/owsq
def save_csv(url,path,query):
    if query['webservice_type']!='ad':
        dcommons = datacommons.toolkit(username,password)
        if query['webservice_type']!='qw':
            data,ordercol,head = filezip.rdb2json(url)
        else:
            data,ordercol,head = filezip.rdb2json(url,skip='no')
        fileName, fileExtension = os.path.splitext( url.split('/')[-1])
        fileExtension='.csv'
        filename= fileName + fileExtension
        f1=open(os.path.join(path,filename),'w')
        f1.write(filezip.csvfile_processor(data,cols=ordercol,header=head))
        f1.close()
        host=get_host(dcommons)
        return os.path.join(path.replace(host['base_directory'],host['url']),filename)
    return None
예제 #4
0
def save_csv(url,path,query):
    if query['webservice_type']!='ad':
        db = MongoClient(config.catalog_uri)
        #dcommons = datacommons.toolkit(username,password)
        if query['webservice_type']!='qw':
            data,ordercol,head = filezip.rdb2json(url)
        else:
            data,ordercol,head = filezip.rdb2json(url,skip='no')
        fileName, fileExtension = os.path.splitext( url.split('/')[-1])
        fileExtension='.csv'
        filename= fileName + fileExtension
        f1=open(os.path.join(path,filename),'w')
        f1.write(filezip.csvfile_processor(data,cols=ordercol,header=head))
        f1.close()
        host=get_host(db)#dcommons)
        return os.path.join(path.replace(host['base_directory'],host['url']),filename)
    return None