Exemple #1
0
def findMinMaxDate(tableName):
    cur_str = 'select min(time), max(time) FROM [Opedia].[dbo].[' + tableName + ']'
    df = dc.dbRead(cur_str)
    dates = df.iloc[0].values
    minDate = pd.to_datetime(str(dates[0])).strftime('%Y-%m-%d')
    maxDate = pd.to_datetime(str(dates[1])).strftime('%Y-%m-%d')
    return {'minDate': minDate, 'maxDate': maxDate}
def dayExists(tableName, day):
    query = "select [time] from %s where [time]='%s' " % (tableName, day)
    query += 'and lat between 20 and 40 '
    query += 'and lon between -160 and -140 '
    df = dc.dbRead(query, usr='', psw='', ip='', port='', db='')
    if len(df) > 100:
        return True
    else:
        return False
Exemple #3
0
def findSpatialBounds(tableName):
    cur_str = 'select min(lat), max(lat), min(lon), max(lon) FROM [Opedia].[dbo].[' + tableName + ']'
    df = dc.dbRead(cur_str)
    dates = df.iloc[0].values
    return {
        'minLat': dates[0],
        'maxLat': dates[1],
        'minLon': dates[2],
        'maxLon': dates[3]
    }