Ejemplo n.º 1
0
            df['dia_cm'] = df['Rgrid'] * 1e2 * 2  # particle radius in mm
            df['time'] = np.ones_like(df.radii_mm)
            df['sHeight'] = (heightvec_bound[i_height + 1] +
                             heightvec_bound[i_height + 1]) / 2
            df['mTot_g'] = dataTable['mTot'] * 1e3  # mass in grams
            #calculating density
            df = mcr.tableOperator.calcRho(df)
            df = df[(df['sPhi'] >=
                     0.015)]  #TODO: this kills everything larger than 3.8mm
            reducedDataTable = pd.concat([reducedDataTable, df])

    reducedDataTable = reducedDataTable[(reducedDataTable['sMult'] > 1.0)]
    print(reducedDataTable)
    print("?")
    #starting the simulation
    output = mcr.fullRadar(dicSettings, reducedDataTable)
    print(output)

elif PSD_method == "discrete_SP":
    #adding required variables
    dataTable[
        'radii_mm'] = dataTable['dia'] * 1e3 / 2.  # particle radius in mm
    dataTable['mTot_g'] = dataTable['mTot'] * 1e3  # mass in grams
    dataTable['dia_cm'] = dataTable['dia'] * 1e2  # diameter in centimeters
    dataTable['sPhi'] = sPhi
    dataTable = dataTable[(dataTable['sPhi'] >= 0.015)]
    # dataTable['sMult']=1 #(it deactivates the multiplicity)

    #calculating density
    dataTable = mcr.tableOperator.calcRho(dataTable)
# now generate a table from the McSnow output.
mcTable = mcr.getMcSnowTable(dicSettings['dataPath'])
print('selecting time step = 600 min  ')
#-- now select time step to use (600s is usually used)
selTime = 600.
times = mcTable['time']
mcTable = mcTable[times == selTime]
mcTable = mcTable.sort_values('sHeight')
#print(mcTable.sPhi)
print(
    'getting things done :) -> calculating radar variables for {0}GHz'.format(
        freq))
#-- now the full polarimetric output is generated (KDP, aswell as spec_H and spec_V, from which you can calculate ZeH, ZeV, ZDR, sZDR)
#mcr.fullRadar(dicSettings,mcTable)
#quit()
output = mcr.fullRadar(dicSettings, mcTable)
print(output)
for wl in dicSettings['wl']:
    wlStr = '{:.2e}'.format(wl)
    if (dicSettings['scatSet']['mode']
            == 'SSRGA') or (dicSettings['scatSet']['mode']
                            == 'Rayleigh') or (dicSettings['scatSet']['mode']
                                               == 'SSRGA-Rayleigh'):
        output['Ze_H_{0}'.format(wlStr)] = output['spec_H_{0}'.format(
            wlStr)].sum(dim='vel')
        output['MDV_H_{0}'.format(
            wlStr)] = (output['spec_H_{0}'.format(wlStr)] * output['vel']).sum(
                dim='vel') / output['Ze_H_{0}'.format(wlStr)]

    else:
        output['Ze_H_{0}'.format(wlStr)] = output['spec_H_{0}'.format(