示例#1
0
#converting to pandas dataframe
dataTable = data.to_dataframe()
dataTable = dataTable.rename(
    columns={
        'm_tot': 'mTot',
        'height': 'sHeight',
        'vt': 'vel',
        'diam': 'dia',
        'xi': 'sMult'
    })

#settings
dicSettings = mcr.loadSettings(dataPath='_',
                               freq=np.array([9.6e9]),
                               maxHeight=3000,
                               minHeight=2500,
                               heightRes=5)
#adding required variables
dataTable['radii'] = dataTable['dia'] / 2.  # particle radius in m
dataTable['time'] = time

PSD_method = "bin"  #"bin": count SP and their multiplicity in height and size bins; "1D_KDE": #DOES NOT WORK YET!! 1-dimensional kernel density estimate, "discrete_SP": calculate scattering properties of each SP individually
if PSD_method in ["bin", "1D_KDE"]:

    #some definitions
    nbins = 100  #number of used bins
    n_heights = 50
    model_top = 3850  #[m] #TODO: read this from output
    minR = -4  #minimum R considered  (log10-space)
    maxR = 0  #maximum R considered  (log10-space)
import matplotlib as mpl
import pandas as pd
import xarray as xr
import os

# defining the frequency and mode of scattering calculations to use
freq = np.array([95e9])
scatMode = 'Rayleigh'

print('loading the settings')
#-- load the settings of McSnow domain, as well as elevation you want to calculate the scattering for:
#In order to avoid volume sampling problems, you have to insert the gridBaseArea as it was defined in the McSnow simulation
dicSettings = mcr.loadSettings(dataPath='mass2fr.nc',
                               elv=90,
                               freq=freq,
                               gridBaseArea=5.0,
                               maxHeight=5000,
                               heightRes=36,
                               convolute=False,
                               scatSet={'mode': scatMode})

print('loading the McSnow output')
# 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(
示例#3
0
import numpy as np
import plotRoutines as plot
import os
freq = np.array([35.5e9])
experimentID = os.environ['experiment']
print(experimentID)
inputPath = os.environ['MCexp'] + 'experiments/' + experimentID + '/'
print('loading the settings')
#-- load the settings of McSnow domain, as well as elevation you want to plot:
#In order to avoid volume sampling problems, you have to insert the gridBaseArea as it was defined in the McSnow simulation
dicSettings = mcr.loadSettings(dataPath=inputPath + 'mass2fr.dat',
                               elv=30,
                               freq=freq,
                               gridBaseArea=5.0,
                               maxHeight=3850,
                               ndgsVal=50,
                               heightRes=50,
                               scatSet={
                                   'mode': 'full',
                                   'safeTmatrix': False
                               })

print('loading the McSnow output')
# now generate a table from the McSnow output. You can specify xi0, if it is not stored in the table (like in my cases)
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')
示例#4
0
#experimentID = '1d___binary_xi1000_nz200_lwc0_iwc7_ncl10_nclmass10_ssat30_dtc5_nrp5_rm10_rt0_vt3_at0_stick2_dt1_h0-0_ba500'
experimentID = os.environ['experiment']
print(experimentID)
#inputPath = '/work/lvonterz/McSnow_habit/experiments/'+experimentID+'/'
inputPath = os.environ['MCexp'] + 'experiments/' + experimentID + '/'
print('loading the settings')

#-- load the settings of McSnow domain, as well as elevation you want to plot:
#In order to avoid volume sampling problems, you have to insert the gridBaseArea as it was defined in the McSnow simulation
dicSettings = mcr.loadSettings(
    dataPath=inputPath + 'mass2fr.nc',
    #'../data/1d_habit_test_leonie.dat',#'../data/habit_1d_leonie.dat',#'../data/1d_habit_test_leonie.dat',#'../tests/data_test.dat',
    elv=30,
    freq=freq,
    gridBaseArea=5.0,
    maxHeight=3850,
    ndgsVal=50,
    heightRes=50,
    scatSet={
        'mode': 'full',
        'safeTmatrix': False
    })

print('loading the McSnow output')
# now generate a table from the McSnow output. You can specify xi0, if it is not stored in the table (like in my cases)
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]
示例#5
0
import numpy as np
import mcradar as mcr

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.style.use('seaborn')

print('-------------------------------')
print('Starting the installation tests')
print('-------------------------------')

print('loading the settings')
dicSettings = mcr.loadSettings(dataPath='data_test.dat',
                               elv=30,
                               freq=np.array([95e9]))

print('loading the McSnow output')
mcTable = mcr.getMcSnowTable(dicSettings['dataPath'])

print('selecting time step = 600 min  ')
selTime = 600.
times = mcTable['time']
mcTable = mcTable[times == selTime]
mcTable = mcTable.sort_values('sHeight')

print('getting things done :) -> testing the fullRadarOperator')
output = mcr.fullRadar(dicSettings, mcTable)

print('plotting the spetra')