import numpy as np
import matplotlib.pyplot as plt
import readall as read
import astroML as astr
import os
from astroML.stats import binned_statistic_2d

citylow = ['seattle','newyork','losangels']
cityhi = ['Seattle','New York City','Los Angeles']
for i in range(len(citylow)):
    print 'Starting %s' % cityhi[i]
    f1 = 'monthdata/%s/MonthlyHistory.html?format=1' % citylow[i]
    columns,header = read.withcsv(f1,',',header='True',cols='True')
    print header
    date,Tmax,Tmean,Tmin,DewMax = columns[0:5]
    DewMean,DewMin,HumidMax,HumidMean,HumidMin = columns[5:10]
    PressMax,PressMean,PressMin,VisMax,VisMean = columns[10:15]
    VisMin,WindMax,WindMean,GustMax,rain = columns[15:20]
    clouds,event,WindDir = columns[20:]

    nfiles = range(1,131)
    for n in nfiles:
        f2 = 'monthdata/%s/MonthlyHistory.html?format=1.%i' % (citylow[i],n)
        columns,header = read.withcsv(f2,',',header='True',showlines='False')
        j = len(columns[0])
        for k in range(j):
            date.append(columns[0][k]),Tmax.append(columns[1][k]),Tmean.append(columns[2][k]),Tmin.append(columns[3][k]),DewMax.append(columns[4][k])
            DewMean.append(columns[5][k]),DewMin.append(columns[6][k]),HumidMax.append(columns[7][k]),HumidMean.append(columns[8][k]),HumidMin.append(columns[9][k])
            PressMax.append(columns[10][k]),PressMean.append(columns[11][k]),PressMin.append(columns[12][k]),VisMax.append(columns[13][k]),VisMean.append(columns[14][k])
            VisMin.append(columns[15][k]),WindMax.append(columns[16][k]),WindMean.append(columns[17][k]),GustMax.append(columns[18][k]),rain.append(columns[19][k])
            clouds.append(columns[20][k]),event.append(columns[21][k]),WindDir.append(columns[22][k])
Exemple #2
0
]
filesblu = [
    "specfiles/hilt600_26b.txt",
    "specfiles/st1_28b.txt",
    "specfiles/st3_32b.txt",
    "specfiles/st6_29b.txt",
    "specfiles/st7_30b.txt",
    "specfiles/xxcam_25b.txt",
    "specfiles/xxcam_24b.txt",
]
plttit = ["HILT 600", "Unknwn 1", "Unknwn 3", "Unknwn 6", "Unknwn 7", "XX Cam"]
fnames = ["hilt600.pdf", "st1_28spec.pdf", "st3_32spec.pdf", "st6_29spec.pdf", "st7_30spec.pdf", "xxcam_24spec.pdf"]

i = 5
# for i in range(len(fnames)):
datared = r.withcsv(filesred[i])
wave_r = np.array(datared[0])
band_r = np.array(datared[2])
flux_r = np.array(datared[3])
wave_r = wave_r.astype(float)
flux_r = flux_r.astype(float)
spec1_r = np.where(band_r == "1.")
spec2_r = np.where(band_r == "2.")
wv_r = wave_r[spec1_r]
fl_r = flux_r[spec1_r]
badlo_r = np.where(wv_r > 6925)
badhi_r = np.where(wv_r < 6945)
bad_r = inters([badlo_r, badhi_r])
wv_r, fl_r = np.delete(wv_r, bad_r), np.delete(fl_r, bad_r)

datablue = r.withcsv(filesblu[i])