R = N - len(runs_edges) # expected value of R e_R = ((2.0 * m * n) / N) + 1 # variance of R is _numer/_denom _numer = 2 * m * n * (2 * m * n - N) _denom = N ** 2 * (N - 1) # see Eq. 1 in Friedman 1979 # W approaches a standard normal distribution W = (R - e_R) / np.sqrt(_numer/_denom) return W, R data = read_prepare() limithour = 6.0 dataspin = data[data['runtime'] < 3600.0*limithour] datagood = data[data['runtime'] > 3600.0*limithour] #dataspin = data[(data['runtime'] < 3600.0*13)*(data['runtime'] > 3600.0*12)] #datagood = data[(data['runtime'] < 3600.0*14)*(data['runtime'] > 3600.0*13)] droplabels = ['runtime', 'Hgt', 'P', 'T', 'RH', 'DWRxk', 'DWRkw'] dataspin.drop(droplabels, axis=1, inplace=True) datagood.drop(droplabels, axis=1, inplace=True) Nsamples = 5000 X = dataspin.values[random.sample(range(len(dataspin)), Nsamples),:] Y = datagood.values[random.sample(range(len(datagood)), Nsamples),:]
@author: dori """ import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit from statistics import hist_and_plot from READ import read_prepare plt.close('all') addlabel = '' addlabel = 'run' #addlabel = 'spin' campaign = 'tripex' hydroset = campaign + '_all_hydro_' data = read_prepare(hydroset, maxhour=46.0, minhour=6.0) lognorm = True h, x, y = hist_and_plot(data, 'CFAD X-band SNR', 'Hgt', 'N10', 'SNR X-band [dBZ]', 'Height [m]', xlim=[-15, 70], ylim=[0, 10000], inverty=False, savename='CFAD/CFAD_snrX_Hgt' + campaign + addlabel + '.png', lognorm=lognorm)
Vr = V[2, 0, :, :, 0, 0] Vs = V[3, 0, :, :, 0, 0] Vg = V[4, 0, :, :, 0, 0] Vh = V[5, 0, :, :, 0, 0] Sc = S[0, 0, :, :, 0, 0] Si = S[1, 0, :, :, 0, 0] Sr = S[2, 0, :, :, 0, 0] Ss = S[3, 0, :, :, 0, 0] Sg = S[4, 0, :, :, 0, 0] Sh = S[5, 0, :, :, 0, 0] campaign = 'tripex' minhour = 6.0 pamtra = read_prepare(hydroset=campaign + '_all_hydro_', minhour=minhour) pamtraTl0 = slice_data(pamtra, 'T', maxvalue=0) lognormrule = True #%% CFAD Sensitivity xlim = [-60, 50] ylim = [0, 12000] h1, x1, y1 = hist_and_plot(pamtra, 'sensitivity cone X', yvar='Hgt', xvar='Z10', xlabel='Zx [dBZ]', ylabel='Hgt [m]', xlim=xlim, ylim=ylim, lognorm=lognormrule,
Sr = S[2, 0, :, :, 0, 0] Ss = S[3, 0, :, :, 0, 0] Sg = S[4, 0, :, :, 0, 0] Sh = S[5, 0, :, :, 0, 0] campaign = 'tripex' minhour = 6.0 hydroset = 'only_ice' #hydroset = 'only_snow' #hydroset = 'no_snow' #hydroset = 'only_graupel_hail' #hydroset = 'only_liquid' #hydroset = 'all_hydro' pamtra = read_prepare(hydroset=campaign + '_' + hydroset + '_', minhour=minhour) pamtraTl0 = slice_data(pamtra, 'T', maxvalue=0) #%% CFAD Sensitivity xlim = [-60, 50] ylim = [0, 12000] hist_and_plot(pamtra, 'sensitivity cone X', yvar='Hgt', xvar='Z10', xlabel='Zx [dBZ]', ylabel='Hgt [m]', xlim=xlim, ylim=ylim, lognorm=True, savename='tripex/' + hydroset + '/pamtraCFAD_Zx_Hgt.png',