sr.saveFig('NIRPathradiance.png') print( 'Note that multiple scatter contributes significantly to the total path radiance' ) #repeat the same calculation, but this time do in wavelength domain colSelect = ['FREQ', 'PTH_THRML', 'SOL_SCAT', 'SING_SCAT', 'TOTAL_RAD'] skyrad = loadtape7("data/NIRscat.fl7", colSelect) sr = ryplot.Plotter(1, 4, 1, "Path Radiance in NIR, Path to Space from 3 km", figsize=(12, 8)) # plot the components separately for i in [1, 2, 3, 4]: wl, Lpath = ryutils.convertSpectralDensity(skyrad[:, 0], skyrad[:, i], 'nl') Lpath *= 1.0e4 sr.plot( i, wl, Lpath, "", "Wavelength [$\mu$m]", "L [W/(m$^2$.sr.$\mu$m)]", label=[colSelect[i][:]], legendAlpha=0.5, #pltaxis=[0.4,1, 0, 1], maxNX=10, maxNY=4, powerLimits=[-4, 4, -5, 5]) totinband = -np.trapz(Lpath.reshape(-1, 1), wl, axis=0)[0] print('{0} integral is {1:.6e} [W/(m^2.sr)]'.format(
# convert from /cm^2 to /m2 and integrate using the wavenumber vector # normally you would multiply with a sensor spectral response before integration # this calculation is over the whole band, equally weighted. totinband = np.trapz(Lpath.reshape(-1, 1), skyrad[:, 0], axis=0)[0] print("{0} sum is {1} [W/(m^2.sr)]".format(colSelect[i][:], totinband)) sr.saveFig("NIRPathradiance.png") print("Note that multiple scatter contributes significantly to the total path radiance") # repeat the same calculation, but this time do in wavelength domain colSelect = ["FREQ", "PTH_THRML", "SOL_SCAT", "SING_SCAT", "TOTAL_RAD"] skyrad = loadtape7("data/NIRscat.fl7", colSelect) sr = ryplot.Plotter(1, 4, 1, "Path Radiance in NIR, Path to Space from 3 km", figsize=(12, 8)) # plot the components separately for i in [1, 2, 3, 4]: wl, Lpath = ryutils.convertSpectralDensity(skyrad[:, 0], skyrad[:, i], "nl") Lpath *= 1.0e4 sr.plot( i, wl, Lpath, "", "Wavelength [$\mu$m]", "L [W/(m$^2$.sr.$\mu$m)]", label=[colSelect[i][:]], legendAlpha=0.5, # pltaxis=[0.4,1, 0, 1], maxNX=10, maxNY=4, powerLimits=[-4, 4, -5, 5], ) totinband = -np.trapz(Lpath.reshape(-1, 1), wl, axis=0)[0]
# 5 cm-1 intervals, but we want to work in wavelength with 2.5 cm-1 waven = numpy.arange(2000.0, 3300.0, 2.5).reshape(-1, 1) wavel = ryutils.convertSpectralDomain(waven, type='nl') #remove comment lines, and scale path radiance from W/cm2.sr.cm-1 to W/m2.sr.cm-1 tauA = ryfiles.loadColumnTextFile('../data/path1kmflamesensor.txt', [1], abscissaOut=waven, comment='%') lpathwn = ryfiles.loadColumnTextFile('../data/pathspaceflamesensor.txt', [9], abscissaOut=waven, ordinateScale=1.0e4, comment='%') #convert path radiance spectral density from 1/cm^-1 to 1/um, at the sample #wavenumber points (dum, lpathwl) = ryutils.convertSpectralDensity(waven, lpathwn, type='nl') #load the detector file in wavelengths, and interpolate on required values detR = ryfiles.loadColumnTextFile('../data/detectorflamesensor.txt', [1], abscissaOut=wavel, comment='%') #construct the flame emissivity from parameters emis = ryutils.sfilter(wavel, center=4.33, width=0.45, exponent=6, taupass=0.8, taustop=0.1) #construct the sensor filter from parameters
wavenumRef = numpy.asarray([1.0e5, 1.0e4, 1.0e3, 1.0e2]) # in units of cm-1 frequenRef = numpy.asarray([ 2.99792458e+15, 2.99792458e+14, 2.99792458e+13, 2.99792458e+12]) print('Input spectral vectors:') print('{0} micrometers'.format(wavelenRef)) print('{0} wavenumber'.format(wavenumRef)) print('{0} frequency'.format(frequenRef)) # now test conversion of spectral density quantities #create planck spectral densities at the wavelength interval emittancewRef = planck(wavelenRef, 1000,'el') emittancefRef = planck(frequenRef, 1000,'ef') emittancenRef = planck(wavenumRef, 1000,'en') emittance = emittancewRef.copy() #convert to frequency density print('all following eight statements should print (close to) unity vectors:') (freq, emittance) = ryutils.convertSpectralDensity(wavelenRef, emittance, 'lf') print('emittance converted: wf against calculation') print(emittancefRef/emittance) #convert to wavenumber density (waven, emittance) = ryutils.convertSpectralDensity(freq, emittance, 'fn') print('emittance converted: wf->fn against calculation') print(emittancenRef/emittance) #convert to wavelength density (wavel, emittance) = ryutils.convertSpectralDensity(waven, emittance, 'nl') #now repeat in opposite sense print('emittance converted: wf->fn->nw against original') print(emittancewRef/emittance) print('spectral variable converted: wf->fn->nw against original') print(wavelenRef/wavel) #convert to wavenumber density emittance = emittancewRef.copy()
#load atmospheric transmittance from file created in Modtran in wavenumbers # the transmittance is specified in the wavenumber domain with # 5 cm-1 intervals, but we want to work in wavelength with 2.5 cm-1 waven = numpy.arange(2000.0, 3300.0, 2.5).reshape(-1, 1) wavel= ryutils.convertSpectralDomain(waven, type='nl') #remove comment lines, and scale path radiance from W/cm2.sr.cm-1 to W/m2.sr.cm-1 tauA = ryfiles.loadColumnTextFile('../data/path1kmflamesensor.txt', [1],abscissaOut=waven, comment='%') lpathwn = ryfiles.loadColumnTextFile('../data/pathspaceflamesensor.txt', [9],abscissaOut=waven, ordinateScale=1.0e4, comment='%') #convert path radiance spectral density from 1/cm^-1 to 1/um, at the sample #wavenumber points (dum, lpathwl) = ryutils.convertSpectralDensity(waven, lpathwn, type='nl') #load the detector file in wavelengths, and interpolate on required values detR = ryfiles.loadColumnTextFile('../data/detectorflamesensor.txt', [1],abscissaOut=wavel, comment='%') #construct the flame emissivity from parameters emis = ryutils.sfilter(wavel,center=4.33, width=0.45, exponent=6, taupass=0.8, taustop=0.1 ) #construct the sensor filter from parameters sfilter = ryutils.sfilter(wavel,center=4.3, width=0.8, exponent=12, taupass=0.9, taustop=0.0001) #plot the data plot1= ryplot.Plotter(1, 2, 2,'Flame sensor',figsize=(24,16))