def brdfModel(s, vza, sza, raa): ''' Run the full BRDF model for parameters in s ''' try: brdf = [] for i in xrange(len(s['n'])): brdf.append(run_prosail(s['n'][i],s['cab'][i],s['car'][i],s['cbrown'][i],s['cw'][i],s['cm'][i],\ s['lai'][i],s['ala'][i],0.0,s['bsoil'][i],s['psoil'][i],s['hspot'][i],\ vza[i],sza[i],raa[i],2)) except: brdf = [] for i in xrange(len(s['n'])): brdf.append(run_prosail(s['n'][i],s['cab'][i],s['car'][i],s['cbrown'][i],s['cw'][i],s['cm'][i],\ s['lai'][i],s['ala'][i],0.0,s['bsoil'][i],s['psoil'][i],s['hspot'][i],\ vza,sza,raa,2)) return (vza, sza, raa), transform(s), fixnan(np.array(brdf))
def brdfModel(s,vza,sza,raa): ''' Run the full BRDF model for parameters in s ''' try: brdf = [] for i in xrange(len(s['n'])): brdf.append(run_prosail(s['n'][i],s['cab'][i],s['car'][i],s['cbrown'][i],s['cw'][i],s['cm'][i],\ s['lai'][i],s['ala'][i],0.0,s['bsoil'][i],s['psoil'][i],s['hspot'][i],\ vza[i],sza[i],raa[i],2)) except: brdf = [] for i in xrange(len(s['n'])): brdf.append(run_prosail(s['n'][i],s['cab'][i],s['car'][i],s['cbrown'][i],s['cw'][i],s['cm'][i],\ s['lai'][i],s['ala'][i],0.0,s['bsoil'][i],s['psoil'][i],s['hspot'][i],\ vza,sza,raa,2)) return (vza,sza,raa),transform(s),fixnan(np.array(brdf))
def brdfModel(s, vza, sza, raa, bandpass=None): ''' Run the full BRDF model for parameters in s Parameters: s : dictionary of model parameters (state) vza : view zenith angle (degrees) float or float array of the same size as the number of entries in each dictionary item sza : solar zenith angle (degrees) float or float array of the same size as the number of entries in each dictionary item raa : relative azimuth angle (degrees) float or float array of the same size as the number of entries in each dictionary item Options: bandpass : set of bandpass functions ''' from prosail_fortran import run_prosail brdf = [] wavelength = np.arange(400, 2501).astype(float) for i in xrange(len(s['n'])): try: brf = run_prosail(s['n'][i],s['cab'][i],s['car'][i],s['cbrown'][i],s['cw'][i],s['cm'][i],\ s['lai'][i],s['ala'][i],0.0,s['bsoil'][i],s['psoil'][i],s['hspot'][i],\ vza[i],sza[i],raa[i],2) except: brf = run_prosail(s['n'][i],s['cab'][i],s['car'][i],s['cbrown'][i],s['cw'][i],s['cm'][i],\ s['lai'][i],s['ala'][i],0.0,s['bsoil'][i],s['psoil'][i],s['hspot'][i],\ vza,sza,raa,2) if bandpass: brf = bandpass * brf brdf.append(brf) if bandpass: wavelength = bandpass * wavelength return (vza, sza, raa), transform(s), fixnan(np.array(brdf)), wavelength
def brdfModel(s,vza,sza,raa,bandpass=None): ''' Run the full BRDF model for parameters in s Parameters: s : dictionary of model parameters (state) vza : view zenith angle (degrees) float or float array of the same size as the number of entries in each dictionary item sza : solar zenith angle (degrees) float or float array of the same size as the number of entries in each dictionary item raa : relative azimuth angle (degrees) float or float array of the same size as the number of entries in each dictionary item Options: bandpass : set of bandpass functions ''' from prosail_fortran import run_prosail brdf = [] wavelength = np.arange(400,2501).astype(float) for i in xrange(len(s['n'])): try: brf = run_prosail(s['n'][i],s['cab'][i],s['car'][i],s['cbrown'][i],s['cw'][i],s['cm'][i],\ s['lai'][i],s['ala'][i],0.0,s['bsoil'][i],s['psoil'][i],s['hspot'][i],\ vza[i],sza[i],raa[i],2) except: brf = run_prosail(s['n'][i],s['cab'][i],s['car'][i],s['cbrown'][i],s['cw'][i],s['cm'][i],\ s['lai'][i],s['ala'][i],0.0,s['bsoil'][i],s['psoil'][i],s['hspot'][i],\ vza,sza,raa,2) if bandpass: brf = bandpass * brf brdf.append(brf) if bandpass: wavelength = bandpass * wavelength return (vza,sza,raa),transform(s),fixnan(np.array(brdf)),wavelength
def trans_prosail ( N, cab, car, cbrown, cw, cm, lai, lidfa, lidfb, rsoil, psoil, \ hspot, tts, tto, psi, typelidf): """A version of PROSAIL that uses transformed parameters to quasi-linearise the model. See http://dx.doi.org/10.1016/j.rse.2011.12.027""" # Define the constants slai = -2.0 skab = -100.0 skar = -100.0 skw = -1./50. skm = -1./100. # Transform the parameters to real units xlai = slai * np.log ( lai ) xkab = skab * np.log ( cab ) xkar = skar * np.log ( car ) xkw = skw * np.log ( cw ) xdm = skm * np.log ( cm ) # Run the PROSAIL model retval = run_prosail ( N, xkab, xkar, cbrown, xkw, xdm, xlai, \ lidfa, lidfb, rsoil, psoil, hspot, tts, tto, psi, typelidf ) return retval