OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
interpolate_libraries.f90
Go to the documentation of this file.
2 
3  implicit none
4 
5  private
6 
7  public :: libraryinterpolate, scatangle, interpolate_wind_speed, lib_clean, lib_init ! GetReflForGivenWindSpeedIce, GetReflForGivenWindSpeedWater
8 
9 ! REAL*8 :: CONST_PI, RAD_PER_DEG , DEG_PER_RAD
10  real, parameter, dimension(3) :: wind_speed = (/3.0, 7.0, 15.0/)
11  integer :: NUM_OF_TAUS, NUM_OF_WAVELENGTHS_RFTF
12 
13  real :: RLphase
14  real, dimension(:), allocatable :: aeroPhase
15  real, dimension(:,:), allocatable :: fOmega_water, fOmega_ice
16  real, dimension(:,:,:), allocatable :: tauC_source_water, tauC_source_ice
17 
18  REAL,ALLOCATABLE::multiScatRefl_water_lamb(:,:,:)
19  REAL,ALLOCATABLE::multiScatRefl_ice_lamb(:,:,:)
20 
21  REAL,ALLOCATABLE::multiScatRefl_water_CM(:,:,:,:)
22  REAL,ALLOCATABLE::multiScatRefl_ice_CM(:,:,:,:)
23 
24 ! single-scattering arrays
25  real, allocatable :: fPhase_lamb(:,:), tauC(:,:)
26  REAL, ALLOCATABLE :: gsquare(:), aero_denom(:)
27 
28  integer :: lib_call_counter
29 
30  REAL,ALLOCATABLE::phaseFunVals_water(:,:), phaseFunVals_ice(:,:), ssRefl_water(:,:,:), ssRefl_ice(:,:,:)
31  real, dimension(:), allocatable :: LUT_TAU_VALUES
32 
33  real:: COS_SCAT, COS_VZA, COS_SZA
34 
35 
36 ! ** extra SS stuff
37 
38  real:: prev_ratio
39 
40  REAL, ALLOCATABLE :: fPhase_liq(:,:),tauLR_liq(:,:),EXP0_liq(:,:),EXP1_liq(:,:)
41  REAL, ALLOCATABLE :: fPhase_ice(:,:),tauLR_ice(:,:),EXP0_ice(:,:),EXP1_ice(:,:)
42  REAL, dimension(:), allocatable ::ocean_aero_Omega, ocean_aero_phase
43 
44 ! ** end extra SS stuff
45 
46 
47  contains
48 
49 
50  subroutine lib_init
51 
52  use libraryarrays
53 
54  integer :: nwl, iwl, itau, ntau, i
55  real, dimension(:,:), allocatable :: fqe_water, fqe_ice
56 
57  lib_call_counter = 0
58 
59  nwl = number_wavelengths
60  ntau = number_taus
61  allocate(aerophase(nwl))
62 
63  allocate(fqe_water(number_wavelengths, number_waterradii), fomega_water(number_wavelengths, number_waterradii))
65 
66 ! ** extra SS stuff
67 
68  ALLOCATE(fphase_liq(1:nwl,1:number_waterradii),taulr_liq(1:nwl,1:number_waterradii), &
69  exp0_liq(1:nwl,1:number_waterradii),exp1_liq(1:nwl,1:number_waterradii))
70  ALLOCATE(fphase_ice(1:nwl,1:number_iceradii),taulr_ice(1:nwl,1:number_iceradii), &
71  exp0_ice(1:nwl,1:number_iceradii),exp1_ice(1:nwl,1:number_iceradii))
72 
73  allocate(ocean_aero_omega(nwl), ocean_aero_phase(nwl))
74  ! WDR make re-entrant
75  if( .not. allocated(aero_denom) ) allocate(aero_denom(nwl))
76 
77  do i=1, nwl
78  if (aerosol_tau(i) > 0.) then
79  ocean_aero_omega(i) = ((aerosol_tau(i) -0.1) * 1.0 + 0.1 * aerosol_ssa(i))/aerosol_tau(i)
80  else
81  ocean_aero_omega(i) = 0.
82  endif
83  end do
84 
85  aero_denom = (aerosol_tau -0.1) + 0.1 * aerosol_ssa
86 
87  prev_ratio = -999.
88 
89 
90 ! ** end extra SS stuff
91 
92 
93 
94  fqe_water(1,:) = 1.0
95  do iwl = 2,nwl
96  fqe_water(iwl,:) = extinction_water(iwl,:)/extinction_water(1,:)
97  enddo
98 
99  fomega_water = truncation_factor_water * singlescattering_water !ssalbedo * ftrunc= (omega*f)
100 
101  fqe_ice(1,:) = 1.0
102  do iwl = 2,nwl
103  fqe_ice(iwl,:) = extinction_ice(iwl,:)/extinction_ice(1,:)
104  enddo
105 
106  fomega_ice = truncation_factor_ice * singlescattering_ice !ssalbedo * ftrunc= (omega*f)
107 
108  allocate(tauc_source_water(number_taus+1, number_wavelengths, number_waterradii))
109  allocate(tauc_source_ice(number_taus+1, number_wavelengths, number_iceradii))
110 
111  tauc_source_water(1,:,:) = 0.0
112  tauc_source_ice(1,:,:) = 0.0
113 
114  do itau = 2, number_taus+1
115  tauc_source_water(itau,:,:) = (library_taus(itau-1) * fqe_water) * (1.0 - fomega_water) !Qe sacling, tau scaling, phase func truncation
116  tauc_source_ice(itau,:,:) = (library_taus(itau-1) * fqe_ice) * (1.0 - fomega_ice) !Qe sacling, tau scaling, phase func truncation
117  end do
118 
119  deallocate(fqe_water, fqe_ice)
120 
121 ! ice_int(ntau+1,number_wavelengths,number_iceradii) )
122 
123  allocate( multiscatrefl_water_lamb(ntau+1,number_wavelengths,number_waterradii), &
124  multiscatrefl_ice_lamb(ntau+1,number_wavelengths,number_iceradii), &
125  multiscatrefl_water_cm(ntau+1,number_wavelengths,number_waterradii, 3), &
126  multiscatrefl_ice_cm(ntau+1,number_wavelengths,number_iceradii, 3) )
127 
128  allocate( fphase_lamb(nwl, number_waterradii))
129 
130  allocate( gsquare(nwl))
131 
132 
133 
134  gsquare = aerosol_asym*aerosol_asym
135  aerophase = 0.0
136 
137  num_of_taus = number_taus + 1
138  num_of_wavelengths_rftf = 2
139 
140 
141  allocate(lut_tau_values(num_of_taus))
142  lut_tau_values(1) = 0.
143  lut_tau_values(2:num_of_taus) = library_taus(1:number_taus)
144 
145  ALLOCATE(ssrefl_water(num_of_taus,number_wavelengths,number_waterradii), &
146  ssrefl_ice(num_of_taus,number_wavelengths,number_iceradii), &
147  phasefunvals_water(number_wavelengths,number_waterradii), &
148  phasefunvals_ice(number_wavelengths,number_iceradii))
149 
150 
151  end subroutine lib_init
152 
153 
154  subroutine lib_clean
155 
156  deallocate(aerophase)
157  deallocate(fomega_water, fomega_ice)
158 
159  deallocate(tauc_source_water, tauc_source_ice)
160 
161  deallocate(multiscatrefl_water_lamb, multiscatrefl_ice_lamb)
162  deallocate(multiscatrefl_water_cm, multiscatrefl_ice_cm)
163 
164  deallocate(fphase_lamb)
165  deallocate(gsquare)
166  deallocate(lut_tau_values)
167  DEALLOCATE(phasefunvals_water, phasefunvals_ice, ssrefl_water, ssrefl_ice)
168 
169 ! ** extra SS stuff
170  deallocate(fphase_liq, taulr_liq, exp0_liq, exp1_liq)
171  deallocate(fphase_ice, taulr_ice, exp0_ice, exp1_ice)
172  deallocate(ocean_aero_omega, ocean_aero_phase)
173 ! ** end extra SS stuff
174 
175 
176  end subroutine lib_clean
177 
178 
179 
180  subroutine libraryinterpolate(local_solarzenith, &
181  local_sensorzenith, &
182  local_relativeazimuth, &
183  local_scatangle, &
184  local_wind_speed, &
185  wind_speed_only, interp_MS, interp_SS, &
186  debug, &
187  status, i, j)
188  !
189  ! so, this interpolates library values to the current conditions of
190  ! 1st 5 inputs
191  ! What it interpolates?
192  use core_arrays
193  use generalauxtype
194  use libraryarrays
197 
198  implicit none
199 
200  real, intent(in) :: local_solarzenith, local_sensorzenith, local_relativeazimuth, local_wind_speed
201  real, intent(in) :: local_scatangle
202  logical,intent(in) :: debug
203  integer, intent(in) :: i, j
204  integer,intent(out) :: status
205  logical, intent(in) :: wind_speed_only, interp_ms, interp_ss
206 
207  real :: dtheta
208  integer :: ianghi, ianglow
209 
210  status = 0
211 
212 
213 ! CONST_PI = 4.d0 * ATAN(1.d0) !value of PI
214 ! RAD_PER_DEG = CONST_PI/180.d0 !radians per degree
215 ! DEG_PER_RAD = 180.d0/CONST_PI !degrees per radian
216 
217  cos_vza = cos(local_sensorzenith * d2r)
218  cos_sza = cos(local_solarzenith * d2r)
219  cos_scat = cos(local_scatangle * d2r)
220 ! NUM_OF_TAUS = number_taus + 1
221 ! NUM_OF_WAVELENGTHS_RFTF = 2
222 
223 ! For Lambertian libraries: land, also ocean when 0.86um saturates.
224  if (.not. cox_munk) then
225 
228 
229  call getrefl(cos_sza, cos_vza, local_relativeazimuth, local_scatangle, &
230  int_reflectance_water(:,:,:), int_reflectance_ice(:,:,:), interp_ms, interp_ss, status)
231  if( status == 5 ) return ! outside table
232 
233  if (interp_ms) then
234 
237 
238  call getsdevrefllamb(cos_sza, cos_vza, local_relativeazimuth,&
240  int_reflectance_ice_sdev(:,:,:), &
241  status)
242  if( status == 5 ) return ! out of table space
243  call setup_emissivity_flux(cos_sza, library_fluxsolarzenith, ianghi, ianglow, dtheta)
244 
246  ianghi, ianglow, dtheta, status)
248  ianghi, ianglow, dtheta, status)
249 
250  call setup_emissivity_flux(cos_vza, library_fluxsensorzenith, ianghi, ianglow, dtheta)
251 
253  ianghi, ianglow, dtheta, status)
255  ianghi, ianglow, dtheta, status)
256 
258  ianghi, ianglow, dtheta, status)
260  ianghi, ianglow, dtheta, status)
261 
262  endif
263 
264  else
265 
268 
269  call getreflforgivenwindspeed(cos_sza, cos_vza, local_relativeazimuth, &
270  local_scatangle, cos_scat, local_wind_speed, &
272  wind_speed_only, interp_ms, interp_ss, status)
273  if( status == 5 ) return
274 
275  if (interp_ms) then
276 
279 
280  call getsdevreflforgivenwindspeed(cos_sza, cos_vza, &
281  local_relativeazimuth, local_wind_speed, &
282  int_refl_water_sdev_wspeed(:,:,:,:), &
284  int_refl_ice_sdev_wspeed(:,:,:,:), &
285  int_reflectance_ice_sdev(:,:,:), &
286  wind_speed_only, status)
287  if( status == 5 ) return ! point beyond table range
288 
289  call setup_emissivity_flux(cos_vza, library_sensor_zenith, ianghi, ianglow, dtheta)
290 
291  call interpemissforagivenwspeed(cos_vza, local_wind_speed, surface_emissivity_water,&
293  wind_speed_only, ianghi, ianglow, dtheta, status)
294  call interpemissforagivenwspeed(cos_vza, local_wind_speed, surface_emissivity_ice, &
296  wind_speed_only, ianghi, ianglow, dtheta, status)
297  call interpemissforagivenwspeed(cos_vza, local_wind_speed, cloud_emissivity_water, &
299  wind_speed_only, ianghi, ianglow, dtheta, status)
300  call interpemissforagivenwspeed(cos_vza, local_wind_speed, cloud_emissivity_ice, &
302  wind_speed_only, ianghi, ianglow, dtheta, status)
303 
304 ! These quantities are not used for Collection 6 calculations
305  call interpemissforagivenwspeed(cos_vza, local_wind_speed, surface_emissivity_water_sdev,&
307  wind_speed_only, ianghi, ianglow, dtheta, status)
308  call interpemissforagivenwspeed(cos_vza, local_wind_speed, surface_emissivity_ice_sdev, &
310  wind_speed_only, ianghi, ianglow, dtheta, status)
311 
312  call interpemissforagivenwspeed(cos_vza, local_wind_speed, cloud_emissivity_water_sdev, &
314  wind_speed_only, ianghi, ianglow, dtheta, status)
315  call interpemissforagivenwspeed(cos_vza, local_wind_speed, cloud_emissivity_ice_sdev, &
317  wind_speed_only, ianghi, ianglow, dtheta, status)
318  endif
319 
320  endif
321 
322 
323 
324 
325 end subroutine libraryinterpolate
326 
327 REAL FUNCTION scatangle(solarAng,viewAng,relAzm)
328 !................................................................................
329 !
330 !................................................................................
331 ! !F90
332 !
333 ! !DESCRIPTION:
334 ! This function computes the scattering angle for a given sun-satellite geometry!
335 !
336 ! !INPUT PARAMETERS:
337 ! solarAng : solar angle in degrees (scalar)
338 ! viewAng : view angle in degrees (scalar)
339 ! relAzm : rel azimuth (from the principle plane of the SUN) (scalar)
340 !
341 !
342 ! !OUTPUT PARAMETERS:
343 ! scatAngle : scattering angle in degrees (scalar)
344 !
345 !................................................................................
346 ! !Revision History:
347 ! Revision 1.0 2009/06/03 GW
348 ! Initial integration of the standalone version. No changes from the standalone.
349 !
350 !................................................................................
351 ! !Team-unique Header:
352 ! Cloud Retrieval Group, NASA/GSFC
353 !
354 ! !PROGRAMMER:
355 !
356 ! Nandana Amarasinghe (SSAI)
357 ! Climate and Radiation Branch
358 ! NASA Goddard Space Flight Center
359 ! Greenbelt, Maryland 20771, U.S.A.
360 !
361 ! Gala Wind (SSAI)
362 ! Climate and Radiation Branch
363 ! NASA Goddard Space Flight Center
364 ! Greenbelt, Maryland 20771, U.S.A.
365 !
366 !*******************************************************************************
367 ! !END
368  use science_parameters, only:d2r
369 
370  IMPLICIT NONE
371  !CALLING ARGUMENTS
372  REAL, INTENT(IN):: solarang,viewang,relazm
373 
374  !LOCAL VARIABLES
375  REAL::solarmu,viewmu !,pi,torad,todeg
376 
377 ! pi = acos(-1.d0 )
378 ! torad = pi / 180.d0
379 ! todeg = 180.d0 / pi
380 
381  solarmu = cos(solarang * d2r)
382  viewmu = cos(viewang * d2r)
383 
384  scatangle= -solarmu*viewmu + sqrt( ( 1.- solarmu**2 )* &
385  ( 1.- viewmu**2 ) )*cos( relazm*d2r)
386 
387 
388  IF(scatangle < -1.0)scatangle = -1.0 !guard against round off error
389  IF(scatangle > 1.0)scatangle = 1.0
390 
391 
392  scatangle = acos(scatangle) / d2r !* todeg
393 
394 END FUNCTION scatangle
395 
396 
397 SUBROUTINE getphasefunctionvalues(scatAngle, scatAngleArray, num_angles, phaseFunArray, phaseNormConst, &
398  phaseFunVals, ierror)
399 !................................................................................
400 !
401 !................................................................................
402 ! !F90
403 !
404 ! !DESCRIPTION:
405 ! This program interpolates the phase fun value array for a given scattering angle an returns
406 ! the corresponding values for particular lambda and re (see the inputs and outputs)!
407 ! !INPUT PARAMETERS:
408  ! scatAngle : scattering angle in degrees (scalar)
409  ! scatAngleArray : 1-D array of sacattering angles for which phase fun vals are precomputed
410  ! phaseFunArray : 3-D array of phase fun vals: 1st DIM = num of angles,
411  ! 2nd DIM = num of wavelengths, 3rd DIM = num of REs
412  ! phaseNormConst : Normalization factor for the phase function. If it is normalized to 1
413  ! then it is OK. But, this number (= pmom(0)) from the dfit routines has
414  ! been saved and included in the library file in adition to d_fit coeffs.
415 !
416 !
417 ! !OUTPUT PARAMETERS:
418  ! phaseFunVals : 2-D array of interpolated phase fun values at scatAngle
419  ! 1st dim = num of wavelengths, 2nd dim = num of rE's
420  ! ierror : integer value
421  ! ierror = 0 success,
422  ! = 3 invalid data
423 !................................................................................
424 ! !Revision History:
425 ! Revision 1.0 2009/06/03 GW
426 ! Initial integration of the standalone version. No changes from the standalone.
427 !
428 !................................................................................
429 ! !Team-unique Header:
430 ! Cloud Retrieval Group, NASA/GSFC
431 !
432 ! !PROGRAMMER:
433 !
434 ! Nandana Amarasinghe (SSAI)
435 ! Climate and Radiation Branch
436 ! NASA Goddard Space Flight Center
437 ! Greenbelt, Maryland 20771, U.S.A.
438 !
439 ! Gala Wind (SSAI)
440 ! Climate and Radiation Branch
441 ! NASA Goddard Space Flight Center
442 ! Greenbelt, Maryland 20771, U.S.A.
443 !
444 !*******************************************************************************
445 ! !END
446 
448  use core_arrays, only: platform_name
449  IMPLICIT NONE
450  !Arguments
451  REAL,INTENT(IN)::scatAngle, scatAngleArray(:),phaseFunArray(:,:,:),phaseNormConst(:,:)
452  REAL,INTENT(OUT)::phaseFunVals(:,:)
453  integer, intent(in):: num_angles
454  INTEGER,INTENT(OUT)::ierror
455 
456  !local variables
457  INTEGER:: iAng, iAngLow, iAngHi, nwl
458  REAL::dtheta
459  CHARACTER(150)::tempstr
460 
461  !start execution
462 
463  if (platform_name == "AVIRIS" .or. platform_name == "RSP" .or. platform_name == "AHI" .or. platform_name == "EPIC" .or. &
464  platform_name == "SSFR") then
465  nwl = number_wavelengths
466  else
467  nwl = number_wavelengths-1
468  endif
469 
470 
471  ierror = 0 !start with no error
472  ianglow = 1
473  ianghi = num_angles
474  IF(scatangle > scatanglearray(ianghi))THEN
475  ianglow = ianghi-1 !no need to do the search; do extrapolation
476 
477  ELSEIF(scatangle < scatanglearray(ianglow))THEN
478  ianghi = ianglow+1
479  ELSE
480  DO !do a bisection search
481  IF((ianghi - ianglow) == 1)EXIT
482  iang = (ianghi + ianglow)/2
483  IF(scatanglearray(iang) < scatangle)THEN
484  ianglow = iang
485  ELSE
486  ianghi = iang
487  ENDIF
488  ENDDO
489  ENDIF
490 
491 
492  dtheta = scatanglearray(ianghi) - scatanglearray(ianglow)
493  !print*,iAngHi,iAngLow,dtheta,scatAngleArray(iAngHi)-scatAngle,scatAngle - scatAngleArray(iAngLow)
494 ! IF(dtheta ==0)THEN
495 ! ierror = 3 !invalid data read
496 ! RETURN
497 ! ENDIF
498 
499  phasefunvals(1:nwl,:) = ( phasefunarray(ianglow,1:nwl,:) * (scatanglearray(ianghi)-scatangle) + &
500  phasefunarray(ianghi,1:nwl,:) * (scatangle - scatanglearray(ianglow) ))/dtheta
501 
502 
503  phasefunvals(1:nwl,:) = phasefunvals(1:nwl,:)/phasenormconst(1:nwl,:)
504 
505  RETURN
506 
507 END SUBROUTINE getphasefunctionvalues
508 
509 
510 subroutine get_aero_params(cos_scatAngle, aeroG)
512  use core_arrays, only: platform_name
513 
514  real, intent(in) :: aeroG(:), cos_scatAngle
515 
516  INTEGER:: nwl
517 
518  if (platform_name == "AVIRIS" .or. platform_name == "RSP" .or. platform_name == "AHI" .or. platform_name == "EPIC" .or. &
519  platform_name == "SSFR" ) then
520  nwl = number_wavelengths
521  else
522  nwl = number_wavelengths-2
523  endif
524 
525  rlphase = 0.75 * (1 + cos_scatangle*cos_scatangle)
526 
527 ! it is generally advisable to avoid a real power whenever possible in order to make the code run faster
528 ! GW: 10.25.13
529  aerophase(1:nwl) = (1.0 - gsquare(1:nwl))/ &
530  (sqrt(1 + gsquare(1:nwl) &
531  - 2.0 * aerog(1:nwl) * cos_scatangle)**3)
532 
533 end subroutine get_aero_params
534 
535 
536 SUBROUTINE interpolatefluxes(solarOrViewAng, solarAngMuArray, inFluxArray, outFluxArray, iAngHi, iAngLow, dtheta, ierror)
537 !................................................................................
538 ! !F90
539 !
540 ! !DESCRIPTION:
541  !This program interpolates(linear) the RF or TF array for a given solar/oview angle and returns
542  !the corresponding values for particular tau, lambda and re (see the inputs and outputs)
543 ! !INPUT PARAMETERS:
544  ! solarOrViewAng : input angle in degrees (scalar)
545  ! solarAngleMuArray : 1-D array of solar angles for which RF/TF vals are precomputed
546  ! inFluxArray : 4-D array of flux vals: 1st DIM = num of angles, 2nd DIM = ntaus
547  ! 3rdd DIM = num of wavelengths, 4th DIM = num of REs
548 !
549 !
550 ! !OUTPUT PARAMETERS:
551  ! outFluxArray : 3-D array of interpolated RF or TF values at the input angle
552  ! 1st dim = ntaus, 2nd dim = num of wavelengths, 3rdd dim = num of rE's
553  ! ierror : integer value
554  ! ierror = 0 success,
555  ! = 3 invalid data
556 !................................................................................
557 ! !Revision History:
558 ! Revision 1.0 2009/06/03 GW
559 ! Initial integration of the standalone version. No changes from the standalone.
560 !
561 !................................................................................
562 ! !Team-unique Header:
563 ! Cloud Retrieval Group, NASA/GSFC
564 !
565 ! !PROGRAMMER:
566 !
567 ! Nandana Amarasinghe (SSAI)
568 ! Climate and Radiation Branch
569 ! NASA Goddard Space Flight Center
570 ! Greenbelt, Maryland 20771, U.S.A.
571 !
572 ! Gala Wind (SSAI)
573 ! Climate and Radiation Branch
574 ! NASA Goddard Space Flight Center
575 ! Greenbelt, Maryland 20771, U.S.A.
576 !
577 !*******************************************************************************
578 ! !END
579  IMPLICIT NONE
580  !Arguments
581  REAL,INTENT(IN):: solarOrViewAng, solarAngMuArray(:),inFluxArray(:,:,:,:)
582  REAL,INTENT(OUT)::outFluxArray(:,:,:)
583  INTEGER,INTENT(OUT)::ierror
584  integer, intent(in) :: iAngLow, iAngHi
585  real, intent(in) :: dtheta
586 
587  !local variables
588  real*8::umu
589 
590  real :: diff_one_way, diff_other_way
591 
592  !start esecution
593  ierror = 0
594 
595  umu = solarorviewang
596 
597  diff_one_way = solarangmuarray(ianghi)- umu
598  diff_other_way = umu - solarangmuarray(ianglow)
599 
600  outfluxarray(:,:,:) = 0.
601  outfluxarray(:,:,:) = ( influxarray(ianglow,:,:,:) * diff_one_way + &
602  influxarray(ianghi,:,:,:) * diff_other_way ) / dtheta
603 
604  RETURN
605 
606 END SUBROUTINE interpolatefluxes
607 
608  SUBROUTINE calcsingscatpartofreflectance(phaseFunVals_water, phaseFunVals_ice, &
609  theta, theta0, ssRefl_water, ssRefl_ice, ierror)
610 
611 !................................................................................
612 ! !F90
613 !
614 ! !DESCRIPTION:
615  !Calculates the single scattering part of the reflectance according to Nakajima/Tanaka method
616  !implemented in DISORT Version2. We had to implement this way, because of the way single
617  !scattering part is takent out in DISORT. Please refer to the DISORT2 documentation
618  !Formula Used here: refl = omega * PC * {1.0 - EXP[-tauc *(1/mu + 1/mu0)]}
619  ! refl = refl/(4.0 * (mu + mu0))
620  ! where tauc = tau * [Qe(lambda,re)/Qe(CH1,re)] * (1.0 - ftrunc * omega)
621  ! PC = Ptrue / (1 - ftrunc * omega)
622  ! also remember refl_lUT = (I_disort) * pi/( mu0* solarflux)
623  ! so that multiplication is already taken care of here, no need to do it
624  ! outside of this routine
625 ! !INPUT PARAMETERS:
626  ! PhaseFunVals : phase function calculated for all the wavelengths and effective radii
627  ! DIMS[1:nlambda,1:nradii] (look at the program getPhaseFunValues.f90)
628  ! ssAlbedo : single scattering albedo DIMS[1:nlambda,1:nradii]
629  ! extCoeff : extinction coefficient DIMS[1:nlambda,1:nradii]
630  ! dfitF : phase function truncation factor in dfit method, DIMS[1:nlambda,1:nradii]
631  ! tauVals : opticat thickness values in the LUT, DIMS[1:ntau]
632  ! theta : view angle in degrees
633  ! theta0 : solar angle in degrees
634 !
635 !
636 ! !OUTPUT PARAMETERS:
637  ! ssRefl : single scattering part of the reflectance , here no need to input the beam
638  ! strength, since we calculate the reflectance.
639  ! ierror : integer value
640  ! ierror = 0 success,
641  ! = 2 memory allocation error
642  ! = 3 invalid data
643 !................................................................................
644 ! !Revision History:
645 ! Revision 1.0 2009/06/03 GW
646 ! Initial integration of the standalone version. No changes from the standalone.
647 !
648 !................................................................................
649 ! !Team-unique Header:
650 ! Cloud Retrieval Group, NASA/GSFC
651 !
652 ! !PROGRAMMER:
653 !
654 ! Nandana Amarasinghe (SSAI)
655 ! Climate and Radiation Branch
656 ! NASA Goddard Space Flight Center
657 ! Greenbelt, Maryland 20771, U.S.A.
658 !
659 ! Gala Wind (SSAI)
660 ! Climate and Radiation Branch
661 ! NASA Goddard Space Flight Center
662 ! Greenbelt, Maryland 20771, U.S.A.
663 !
664 !*******************************************************************************
665 ! !END
666  use libraryarrays
667  use core_arrays, only: platform_name
668 
669  REAL, INTENT(IN) :: phaseFunVals_water(:,:), phaseFunVals_ice(:,:)
670  REAL, INTENT(IN) :: theta, theta0
671  REAL, INTENT(OUT) :: ssRefl_water(:,:,:), ssRefl_ice(:,:,:)
672  INtEGER,INTENT(OUT)::ierror
673 
674 
675  INTEGER:: ntau, nwl, nre, itau,iwl, allocateStatus, ii,jj
676  REAL :: MUPLUSMU0,ratio, mytau
677 
678  ntau = number_taus !size(tauVals)
679 
680  if( platform_name == "AVIRIS" .or. platform_name == "RSP" .or. platform_name == "AHI" .or. platform_name == "EPIC" .or. &
681  platform_name == "SSFR" ) then
682  nwl = number_wavelengths + 1 ! we have to make sure not to skip the last channel
683  else
684  nwl = number_wavelengths
685  endif
686 
687 
688  muplusmu0 = theta + theta0
689  ratio = muplusmu0/(theta * theta0)
690 
691 
692  fphase_lamb = phasefunvals_water/ (1.0 - fomega_water) !add something here to safeguard div by zero
693 
694  ssrefl_water = 0.0
695  ssrefl_ice = 0.0
696 
697  do itau = 1, ntau
698 
699  do ii=1, nwl-1
700  do jj=1, number_waterradii
701 
702  mytau = tauc_source_water(itau+1,ii,jj)*ratio
703 
704  if (mytau == 0) then
705  exp1_liq(ii,jj) = 1.
706  else if (mytau > 10.) then
707  exp1_liq(ii,jj) = 0.
708  else
709  exp1_liq(ii,jj) = exp(-mytau)
710 
711 ! EXP1_liq(ii,jj) = 1. + (mytau ) + (mytau )**2/2. + (mytau )**3/6. + &
712 ! (mytau )**4/24. + (mytau )**5/120. + mytau**6/720.
713 ! EXP1_liq(ii,jj) = 1. / EXP1_liq(ii,jj)
714  endif
715 
716  ssrefl_water(itau,ii,jj) = (singlescattering_water(ii,jj)* fphase_lamb(ii,jj) * (1 - exp1_liq(ii,jj))) / (4.0*muplusmu0)
717 
718  end do
719  end do
720 
721 
722  enddo
723 
724  fphase_lamb(:, 1:number_iceradii) = phasefunvals_ice/ (1.0 - fomega_ice) !add something here to safeguard div by zero
725 
726  do itau = 1, ntau
727 
728 
729  do ii=1, nwl-1
730  do jj=1, number_iceradii
731 
732 
733  mytau = tauc_source_ice(itau+1,ii,jj)*ratio
734 
735  if (mytau == 0) then
736  exp1_ice(ii,jj) = 1.
737  else if (mytau > 10.) then
738  exp1_ice(ii,jj) = 0.
739  else
740  exp1_ice(ii,jj) = exp(-mytau)
741  endif
742 
743  ssrefl_ice(itau,ii,jj) = (singlescattering_ice(ii,jj)* fphase_lamb(ii,jj) * (1 - exp1_ice(ii,jj))) / (4.0*muplusmu0)
744 
745  end do
746  end do
747 
748 
749  enddo
750 
751  END SUBROUTINE calcsingscatpartofreflectance
752 
753 
754  SUBROUTINE single_scattering_calcs_ocean(phaseFunVals_liq, phaseFunVals_ice, ssAlbedo_liq, ssAlbedo_ice, &
755  RLphase, aeroPhase, RLTau,aeroTau, aeroOmega,&
756  theta, theta0,ssRefl_liq, ssRefl_ice)
757 
759  use core_arrays, only: platform_name
760 
761  REAL, INTENT(IN) :: phaseFunVals_liq(:,:), ssAlbedo_liq(:,:), &
762  phaseFunVals_ice(:,:), ssAlbedo_ice(:,:), &
763  RLTau(:), aeroTau(:), &
764  aeroOmega(:), RLphase, aeroPhase(:)
765  REAL, INTENT(IN) :: theta, theta0
766  REAL, INTENT(OUT) :: ssRefl_liq(:,:,:), ssRefl_ice(:,:,:)
767 
768 
769  INTEGER:: ntau, nwl, itau, iwl
770  REAL :: MUPLUSMU0,ratio
771 
772  real :: ocean_mul(20)
773  logical:: changed_ratio
774  integer :: ii, jj
775 
776  ntau = num_of_taus
777 
778  if (platform_name == "AVIRIS" .or. platform_name == "RSP" .or. platform_name == "AHI" .or. platform_name == "EPIC" .or. &
779  platform_name == "SSFR") then
780  nwl = number_wavelengths+1 ! capture the last channel, it is not to be skipped
781  else
782  nwl = number_wavelengths
783  endif
784 
785  muplusmu0 = theta + theta0
786  ratio = muplusmu0/(theta * theta0)
787 
788  fphase_liq = phasefunvals_liq/ (1.0 - fomega_water) !add something here to safeguard div by zero
789  fphase_ice = phasefunvals_ice/ (1.0 - fomega_ice)
790 
791 
792 #if AVIRIS_INST | RSP_INST | AHI_INST | EPIC_INST | SSFR_INST
793  do iwl = 1, number_wavelengths
794 #else
795  do iwl = 1, number_wavelengths-2
796 #endif
797  ocean_aero_phase(iwl) = ( (aerotau(iwl) -0.1) * rlphase + 0.1 * aeroomega(iwl) * aerophase(iwl) ) / aero_denom(iwl)
798  ocean_mul(iwl) = ocean_aero_phase(iwl) * ocean_aero_omega(iwl)
799  end do
800 
801  exp1_liq = 0.
802  exp1_ice = 0.
803 
804  DO itau = 1, ntau
805 
806  taulr_liq = tauc_source_water(itau,:,:) * ratio
807  taulr_ice = tauc_source_ice(itau,:,:) * ratio
808 
809 
810  do ii=1, nwl-1
811  do jj=1, number_waterradii
812 
813  if (taulr_liq(ii,jj) == 0) then
814  exp1_liq(ii,jj) = 1.
815  else if (taulr_liq(ii,jj) > 10.) then
816  exp1_liq(ii,jj) = 0.
817  else
818  exp1_liq(ii,jj) = exp(-taulr_liq(ii,jj))
819  endif
820 
821  end do
822  end do
823 
824  do ii=1, nwl-1
825  do jj=1, number_iceradii
826 
827  if (taulr_ice(ii,jj) == 0) then
828  exp1_ice(ii,jj) = 1.
829  else if (taulr_ice(ii,jj) > 10.) then
830  exp1_ice(ii,jj) = 0.
831  else
832  exp1_ice(ii,jj) = exp(-taulr_ice(ii,jj))
833  endif
834 
835  end do
836  end do
837 
838 
839  ssrefl_liq(itau,:,:) = ssalbedo_liq * fphase_liq * (1. - exp1_liq)
840  ssrefl_ice(itau,:,:) = ssalbedo_ice * fphase_ice * (1. - exp1_ice)
841 
842  exp0_liq = exp1_liq
843  exp0_ice = exp1_ice
844 
845 #if AVIRIS_INST | RSP_INST | AHI_INST | EPIC_INST | SSFR_INST
846  DO iwl =1, number_wavelengths
847 #else
848  DO iwl = 1, number_wavelengths-2
849 #endif
850  taulr_liq(iwl,:) = (tauc_source_water(itau,iwl,:) + rltau(iwl))*ratio
851  taulr_ice(iwl,:) = (tauc_source_ice(itau,iwl,:) + rltau(iwl))*ratio
852 
853  ii = iwl
854  do jj=1, number_waterradii
855 
856  if (taulr_liq(ii,jj) == 0) then
857  exp1_liq(ii,jj) = 1.
858  else if (taulr_liq(ii,jj) > 10.) then
859  exp1_liq(ii,jj) = 0.
860  else
861  exp1_liq(ii,jj) = exp(-taulr_liq(ii,jj))
862  endif
863 
864  end do
865 
866  ii = iwl
867  do jj=1, number_iceradii
868 
869  if (taulr_ice(ii,jj) == 0) then
870  exp1_ice(ii,jj) = 1.
871  else if (taulr_ice(ii,jj) > 10.) then
872  exp1_ice(ii,jj) = 0.
873  else
874  exp1_ice(ii,jj) = exp(-taulr_ice(ii,jj))
875  endif
876 
877  end do
878 
879 
880  ssrefl_liq(itau,iwl,:) = ssrefl_liq(itau,iwl,:) + &
881  rlphase * 1.0 * (exp0_liq(iwl,:) - exp1_liq(iwl,:))
882  ssrefl_ice(itau,iwl,:) = ssrefl_ice(itau,iwl,:) + &
883  rlphase * 1.0 * (exp0_ice(iwl,:) - exp1_ice(iwl,:))
884 
885  exp0_liq(iwl,:) = exp1_liq(iwl,:)
886  exp0_ice(iwl,:) = exp1_ice(iwl,:)
887 
888  taulr_liq(iwl,:) = (tauc_source_water(itau,iwl,:) + rltau(iwl) + aerotau(iwl)) * ratio
889  taulr_ice(iwl,:) = (tauc_source_ice(itau,iwl,:) + rltau(iwl) + aerotau(iwl)) * ratio
890 
891  !coming in aeroTau is the (rayleightau + 0.1) from DISORT run
892 
893  ii = iwl
894  do jj=1, number_waterradii
895 
896  if (taulr_liq(ii,jj) == 0) then
897  exp1_liq(ii,jj) = 1.
898  else if (taulr_liq(ii,jj) > 10.) then
899  exp1_liq(ii,jj) = 0.
900  else
901  exp1_liq(ii,jj) = exp(-taulr_liq(ii,jj))
902  endif
903 
904  end do
905 
906  ii = iwl
907  do jj=1, number_iceradii
908 
909  if (taulr_ice(ii,jj) == 0) then
910  exp1_ice(ii,jj) = 1.
911  else if (taulr_ice(ii,jj) > 10.) then
912  exp1_ice(ii,jj) = 0.
913  else
914  exp1_ice(ii,jj) = exp(-taulr_ice(ii,jj))
915  endif
916 
917  end do
918 
919 
920 
921  ssrefl_liq(itau,iwl,:) = ssrefl_liq(itau,iwl,:) + ocean_mul(iwl) * &
922  (exp0_liq(iwl,:) - exp1_liq(iwl,:))
923  ssrefl_ice(itau,iwl,:) = ssrefl_ice(itau,iwl,:) + ocean_mul(iwl) * &
924  (exp0_ice(iwl,:) - exp1_ice(iwl,:))
925  ENDDO
926 
927  ENDDO
928 
929 
930  ssrefl_liq = ssrefl_liq/(4.0 * muplusmu0)
931  ssrefl_ice = ssrefl_ice/(4.0 * muplusmu0)
932 
933 
934 
935  END SUBROUTINE single_scattering_calcs_ocean
936 
937 
938 
939 
940 
941  !----------------------SUBROUTINE CalcSingScatPartOfOceanReflectance---------------------------------
942  !Calculates the single scattering part of the reflectance according to Nakajima/Tanaka method
943  !implemented in DISORT Version2. We had to implement this way, because of the way single
944  !scattering part is takent out in DISORT. Please refer to the DISORT2 documentation
945  !Formula Used here: refl = omega * PC * {1.0 - EXP[-tauc *(1/mu + 1/mu0)]}
946  ! refl = refl/(4.0 * (mu + mu0))
947  ! where tauc = tau * [Qe(lambda,re)/Qe(CH1,re)] * (1.0 - ftrunc * omega)
948  ! PC = Ptrue / (1 - ftrunc * omega)
949  ! also remember refl_lUT = (I_disort) * pi/( mu0* solarflux)
950  ! so that multiplication is already taken care of here, no need to do it
951  ! outside of this routine
952  !INPUTS:
953  ! PhaseFunVals : phase function calculated for all the wavelengths and effective radii
954  ! DIMS[1:nlambda,1:nradii] (look at the program getPhaseFunValues.f90)
955  ! RLphase : Rayleigh phase func value (fn of the scattering angle)
956  ! aeroPhse : mixed phase function of rayleigh layer and the aerosol layer
957  ! ssAlbedo : single scattering albedo DIMS[1:nlambda,1:nradii]
958  ! extCoeff : extinction coefficient DIMS[1:nlambda,1:nradii]
959  ! dfitF : phase function truncation factor in dfit method, DIMS[1:nlambda,1:nradii]
960  ! tauVals : opticat thickness values in the LUT, DIMS[1:ntau]
961  ! RLTau : Rayleigh optical thickness (combined several layers upto 8km)
962  ! aeroTau : aerosol optical thickness(0.1) + rayleigh layer(lowest)
963  ! aeroOmega : ss albedo of aerosol (not the mixed, mixing will be done in SS calc routine)
964  ! theta : view angle in degrees
965  ! theta0 : solar angle in degrees
966  !OUTPUTS:
967  ! ssRefl : single scattering part of the reflectance , here no need to input the beam
968  ! strength, since we calculate the reflectance.
969  ! ierror : integer value
970  ! ierror = 0 success,
971  ! = 2 memory allocation error
972  ! = 3 invalid data
973  !-----------------------------------------------------------------------------------------------
974 
975  subroutine setup_emissivity_flux(angle, angle_array, idx_hi, idx_lo, dtheta)
976 
977  real, intent(in) :: angle, angle_array(:)
978  real, intent(out) :: dtheta
979  integer, intent(out) :: idx_hi, idx_lo
980 
981 
982  real :: UMU
983  integer :: iAng
984 
985  umu = angle !COS(solarOrViewAng * RAD_PER_DEG)
986  idx_lo = 1
987  idx_hi = size(angle_array)
988  IF(umu < angle_array(idx_lo))THEN
989  idx_hi = idx_lo+1 !no need to do the search; do extrapolation
990  if (idx_hi > size(angle_array)) idx_hi = idx_lo ! we don't have enough points
991  ELSE
992  DO !do a bisection search
993  IF((idx_hi - idx_lo) == 1)EXIT
994  iang = (idx_hi + idx_lo)/2
995  IF(angle_array(iang) < umu)THEN
996  idx_lo = iang
997  ELSE
998  idx_hi = iang
999  ENDIF
1000  ENDDO
1001  ENDIF
1002 
1003 
1004  dtheta = angle_array(idx_hi) - angle_array(idx_lo)
1005 
1006  end subroutine setup_emissivity_flux
1007 
1008 
1009  !--------------------SUBROUTINE InterpCloudEmissForAGivenWSpeed ---------------------------------
1010  !This program interpolates(linear) the cloud emissivity arrays for a given wind speed and
1011  !returns the corresponding values for particular tau, lambda and re(see the inputs and outputs)
1012  !INPUTS:
1013  ! iphase : integer 1 =Water Cloud, 2 =Ice Cloud
1014  ! solarOrViewAng : input angle in degrees (scalar)
1015  ! wspeed : real scalar, wind speed in m/s
1016  !OUTPUTS:
1017  ! outFluxArray : 3-D array ofinterpolated cloud emissivity values at the input ang
1018  ! 1st dim = ntaus, 2nd dim = num of wavelengths, 3rdd dim = num of rE's
1019  ! ierror : integer value
1020  ! ierror = 0 success,
1021  ! = 3 invalid data
1022  !-----------------------------------------------------------------------------------------------
1023  !
1024  SUBROUTINE interpemissforagivenwspeed(solarOrViewAng,wspeed, inEmissArray, outEmissArray_ws, outEmissArray, &
1025  wspeed_only, iAngHi, iAngLow, dtheta,ierror)
1026 
1027  use libraryarrays
1028 
1029  IMPLICIT NONE
1030  !Arguments
1031  REAL,INTENT(IN):: solarOrViewAng,wspeed, dtheta
1032  real, intent(in) :: inEmissArray(:,:,:,:,:)
1033  REAL,INTENT(OUT)::outEmissArray(:,:,:)
1034  real, intent(inout) :: outEmissArray_ws(:,:,:,:)
1035  INTEGER,INTENT(OUT)::ierror
1036  logical, intent(in) :: wspeed_only
1037  integer, intent(in) :: iAngHi, iAngLow
1038 
1039 
1040  real :: diff_one_way, diff_other_way
1041 
1042 
1043  diff_one_way = library_sensor_zenith(ianghi)- solarorviewang
1044  diff_other_way = solarorviewang - library_sensor_zenith(ianglow)
1045 
1046  outemissarray_ws(:,:,:,1) = (inemissarray(ianglow,:,:,:,1) * diff_one_way + &
1047  inemissarray(ianghi,:,:,:,1) * diff_other_way ) / dtheta
1048  outemissarray_ws(:,:,:,2) = (inemissarray(ianglow,:,:,:,2) * diff_one_way + &
1049  inemissarray(ianghi,:,:,:,2) * diff_other_way) / dtheta
1050  outemissarray_ws(:,:,:,3) = (inemissarray(ianglow,:,:,:,3) * diff_one_way + &
1051  inemissarray(ianghi,:,:,:,3) * diff_other_way) / dtheta
1052 
1053  outemissarray = 0.
1054  call interpolate_wind_speed(wspeed, outemissarray_ws, outemissarray)
1055 
1056  RETURN
1057 
1058  END SUBROUTINE interpemissforagivenwspeed
1059 
1060 
1061 ! SUBROUTINE TriLinearInterpolationRefl(solarAng,viewAng,azmAng, &
1062 ! solarMuArray, viewMuArray, relAzmArray, &
1063 ! multiScatReflLUT_water, multiScatRefl_water, &
1064 ! multiScatReflLUT_ice, multiScatRefl_ice,ierror)
1065 !!................................................................................
1066 !! !F90
1067 !!
1068 !! !DESCRIPTION:
1069 ! !perform 3-D linear interpolation on multiple scattering part of the reflectance. Instead of
1070 ! !indexing, a search is done to find the the indices of the cube that enclose the interpolation
1071 ! !point.
1072 !! !INPUT PARAMETERS:
1073 ! ! solarAng : solar zenith angle in degrees (scalar)
1074 ! ! viewAng : sensor zenith angle in degrees (scalar)
1075 ! ! azmAng : rel azm ang in degrees (scalar)]
1076 ! ! solarMuArray : array of solar zenith angles (from the LUT) 1-D array
1077 ! ! viewMuArray : array of sensor zenith angles (from the LUT) 1D array
1078 ! ! relAzmArray : array of rel azimuth angles (from the LUT) 1-D array
1079 ! ! multiScatReflLUT: multi scat part of the reflectance (from LUT) 6D array
1080 ! ! DIMS[1:nview, 1:nsolar,1:nazm, 1:ntau, 1:nlambda, 1:nre]
1081 !!
1082 !!
1083 !! !OUTPUT PARAMETERS:
1084 ! ! multiScatRefl : interpolated MS reflectance for the input geometry 3D array
1085 ! ! DIMS[1:ntau, 1:nlambda, 1:nre]
1086 ! ! ierror : integer value
1087 ! ! ierror = 0 success,
1088 ! ! = 1 I/O error
1089 ! ! = 2 memory allocation error
1090 ! ! = 3 invalid data
1091 !!................................................................................
1092 !! !Revision History:
1093 !! Revision 1.0 2009/06/03 GW
1094 !! Initial integration of the standalone version. No changes from the standalone.
1095 !!
1096 !!................................................................................
1097 !! !Team-unique Header:
1098 !! Cloud Retrieval Group, NASA/GSFC
1099 !!
1100 !! !PROGRAMMER:
1101 !!
1102 !! Nandana Amarasinghe (SSAI)
1103 !! Climate and Radiation Branch
1104 !! NASA Goddard Space Flight Center
1105 !! Greenbelt, Maryland 20771, U.S.A.
1106 !!
1107 !! Gala Wind (SSAI)
1108 !! Climate and Radiation Branch
1109 !! NASA Goddard Space Flight Center
1110 !! Greenbelt, Maryland 20771, U.S.A.
1111 !!
1112 !!*******************************************************************************
1113 !! !END
1114 ! use libraryarrays
1115 !
1116 ! IMPLICIT NONE
1117 !
1118 ! REAL,INTENT(IN):: solarAng, viewAng, azmAng
1119 ! REAL,INTENT(IN):: solarMuArray(:), viewMuArray(:), relAzmArray(:)
1120 ! REAL,INTENT(IN):: multiScatReflLUT_water(:,:,:,:,:,:)
1121 ! REAL,INTENT(IN):: multiScatReflLUT_ice(:,:,:,:,:,:)
1122 !
1123 ! REAL,INTENT(OUT)::multiScatRefl_water(:,:,:)
1124 ! REAL,INTENT(OUT)::multiScatRefl_ice(:,:,:)
1125 ! INTEGER,INTENT(OUT)::ierror
1126 !
1127 !
1128 ! REAL*8::prod11,prod12,prod21,prod22,vol1,vol2,vol3,vol4,vol5,vol6,vol7,vol8,volume
1129 ! REAL*4::solarmu,viewmu
1130 ! REAL*8::dmu0,dmu,dmu0_1,dmu0_2,dmu_1,dmu_2,dazm,dazm_1,dazm_2
1131 ! INTEGER:: ishi,islow, ivhi,ivlow, iazhi,iazlow,n1,n2,n3
1132 !
1133 ! n1 = number_solarzenith !size(solarMuArray)
1134 ! n2 = number_sensorzenith !size(viewMuArray)
1135 ! n3 = number_relazimuth !size(relAzmArray)
1136 !
1137 !
1138 ! ierror = 0 !no error
1139 ! solarmu = solarAng !COS(solarAng * RAD_PER_DEG)
1140 ! viewmu = viewAng !COS(viewAng * RAD_PER_DEG)
1141 !
1142 ! CALL BisectionSearch(solarmu,solarMuArray(1:n1),n1,islow,ishi)
1143 !
1144 ! CALL BisectionSearch(viewmu,viewMuArray(1:n2),n2,ivlow,ivhi)
1145 !
1146 ! CALL BisectionSearch(azmAng,relAzmArray(1:n3),n3,iazlow,iazhi)
1147 !
1148 ! dmu = solarMuArray(ishi) - solarMuArray(islow)
1149 ! dmu0 = viewMuArray(ivhi) - viewMuArray(ivlow)
1150 ! dazm = relAzmArray(iazhi) - relAzmArray(iazlow)
1151 !
1152 ! dmu_1 = solarMu - solarMuArray(islow) ; dmu_2 = solarMuArray(ishi) - solarMu
1153 ! dmu0_1 = viewMu - viewMuArray(ivlow) ; dmu0_2 = viewMuArray(ivhi) - viewMu
1154 ! dazm_1 = azmAng - relAzmArray(iazlow); dazm_2 = relAzmArray(iazhi) - azmAng
1155 !
1156 ! volume = dmu0 * dmu * dazm
1157 ! IF(volume == 0.0)THEN
1158 ! ierror = 3 !invalid data
1159 ! RETURN
1160 ! ENDIF
1161 ! !print*,ivhi,ishi,iazlow
1162 ! !print*,dmu0_1,dmu0_2,dmu_1,dmu_2,dazm_1,dazm_2
1163 !
1164 ! prod22 = dmu_2 * dmu0_2
1165 ! prod12 = dmu_1 * dmu0_2
1166 ! prod11 = dmu_1 * dmu0_1
1167 ! prod21 = dmu_2 * dmu0_1
1168 !
1169 ! vol8 = abs(prod22 * dazm_2)
1170 ! vol7 = abs(prod22 * dazm_1)
1171 ! vol6 = abs(prod12 * dazm_1)
1172 ! vol5 = abs(prod12 * dazm_2)
1173 !
1174 ! vol1 = abs(prod11 * dazm_1)
1175 ! vol2 = abs(prod21 * dazm_1)
1176 ! vol3 = abs(prod21 * dazm_2)
1177 ! vol4 = abs(prod11 * dazm_2)
1178 ! !volume = vol1 + vol2 + vol3 + vol4 + vol5 + vol6 + vol7 + vol8
1179 !
1180 !
1181 ! multiScatRefl_water(:,:,:) = ( multiScatReflLUT_water(ivlow,islow,iazlow,:,:,:) * vol8 + &
1182 ! multiScatReflLUT_water(ivhi,islow,iazlow,:,:,:) * vol3 + &
1183 ! multiScatReflLUT_water(ivhi,islow,iazhi,:,:,:) * vol2 + &
1184 ! multiScatReflLUT_water(ivlow,islow,iazhi,:,:,:) * vol7 + &
1185 ! multiScatReflLUT_water(ivlow,ishi,iazlow,:,:,:) * vol5 + &
1186 ! multiScatReflLUT_water(ivhi,ishi,iazlow,:,:,:) * vol4 + &
1187 ! multiScatReflLUT_water(ivhi,ishi,iazhi,:,:,:) * vol1 + &
1188 ! multiScatReflLUT_water(ivlow,ishi,iazhi,:,:,:) * vol6 )/volume
1189 !
1190 ! multiScatRefl_ice(:,:,:) = ( multiScatReflLUT_ice(ivlow,islow,iazlow,:,:,:) * vol8 + &
1191 ! multiScatReflLUT_ice(ivhi,islow,iazlow,:,:,:) * vol3 + &
1192 ! multiScatReflLUT_ice(ivhi,islow,iazhi,:,:,:) * vol2 + &
1193 ! multiScatReflLUT_ice(ivlow,islow,iazhi,:,:,:) * vol7 + &
1194 ! multiScatReflLUT_ice(ivlow,ishi,iazlow,:,:,:) * vol5 + &
1195 ! multiScatReflLUT_ice(ivhi,ishi,iazlow,:,:,:) * vol4 + &
1196 ! multiScatReflLUT_ice(ivhi,ishi,iazhi,:,:,:) * vol1 + &
1197 ! multiScatReflLUT_ice(ivlow,ishi,iazhi,:,:,:) * vol6 )/volume
1198 !
1199 !
1200 !
1201 ! RETURN
1202 !
1203 !
1204 ! CONTAINS
1205 !
1206 ! SUBROUTINE BisectionSearch(theta,thetaArray,ntheta,iAngLow, iAngHi)
1207 !
1208 ! INTEGER,INTENT(IN)::ntheta
1209 ! REAL,INTENT(IN)::theta,thetaArray(1:ntheta)
1210 ! INTEGER,INTENT(OUT)::iAngLow, iAngHi
1211 !
1212 ! INTEGER:: iAng
1213 !
1214 !
1215 ! iAngLow = 1
1216 ! iAngHi = ntheta
1217 !
1218 ! if (ntheta == 1) then
1219 ! iAngLow = 1
1220 ! iAngHi = 1
1221 ! return
1222 ! endif
1223 !
1224 ! DO
1225 ! IF((iAngHi - iAngLow) == 1)EXIT
1226 ! iAng = (iAngHi + iAngLow)/2
1227 ! IF(thetaArray(iAng) < theta)THEN
1228 ! iAngLow = iAng
1229 ! ELSE
1230 ! iAngHi = iAng
1231 ! ENDIF
1232 ! ENDDO
1233 !
1234 ! if (iAngLow < 1) iAngLow = 1
1235 ! if (ianghi < 1) ianghi = 1
1236 ! if (iAngHi > ntheta) iAngHi = ntheta
1237 ! if (ianglow > ntheta) ianglow = ntheta
1238 !
1239 !
1240 ! RETURN
1241 !
1242 ! END SUBROUTINE BisectionSearch
1243 !
1244 ! END SUBROUTINE TriLinearInterpolationRefl
1245 
1246 
1247  SUBROUTINE getrefl(solarAng,viewAng,azmAng,in_scat, refl_water, refl_ice, interp_MS, interp_SS, ierror)
1248 !................................................................................
1249 ! !F90
1250 !
1251 ! !DESCRIPTION:
1252  !This subroutine outouts the Reflectance table (R(tau,lambda, re)) for a given sun-satellite
1253  !geometry
1254 ! !INPUT PARAMETERS:
1255  ! solarAng : solar zenith in degrees (scalar)
1256  ! viewAng : viewing angle in degrees (scalar)
1257  ! azmAng : relative azimuth between sat and solar planes
1258 !
1259 !
1260 ! !OUTPUT PARAMETERS:
1261  ! refl : reflectance as a function of tau,lambda,re : 3-D Array
1262  ! DIM-1 = ntau, DIM-2 = nlambda, DIM-3 = nre
1263  ! ierror : integer value
1264  ! ierror = 0 success,
1265  ! = 1 I/O error
1266  ! = 2 memory allocation error
1267  ! = 3 invalid data
1268 !................................................................................
1269 ! !Revision History:
1270 ! Revision 1.0 2009/06/03 GW
1271 ! Initial integration of the standalone version. Changed from the standalone
1272 ! delivered version to not apply the albedo inside this routine. That is done in a
1273 ! different place later in corescience.
1274 !
1275 !................................................................................
1276 ! !Team-unique Header:
1277 ! Cloud Retrieval Group, NASA/GSFC
1278 !
1279 ! !PROGRAMMER:
1280 !
1281 ! Nandana Amarasinghe (SSAI)
1282 ! Climate and Radiation Branch
1283 ! NASA Goddard Space Flight Center
1284 ! Greenbelt, Maryland 20771, U.S.A.
1285 !
1286 ! Gala Wind (SSAI)
1287 ! Climate and Radiation Branch
1288 ! NASA Goddard Space Flight Center
1289 ! Greenbelt, Maryland 20771, U.S.A.
1290 !
1291 !*******************************************************************************
1292 ! !END
1293 
1294  use libraryarrays
1295  use generalauxtype
1296  ! WDR to get the scan line
1297  use ch_xfr, only : c2_scan
1298  !
1299  REAL, INTENT(IN) :: solarAng,viewAng,azmAng, in_scat
1300  REAL,INTENT(OUT) :: refl_water(:,:,:), refl_ice(:,:,:)
1301  INTEGER,INTENT(OUT)::ierror
1302  logical, intent(in) :: interp_MS, interp_SS
1303 
1304  INTEGER::allocateStatus
1305  REAL :: scat_angle
1306  INTEGER::do_mgr
1307 
1308  !WDR TEMP set some loop controls for refl table output
1309  !INTEGER::ksen,klam,ktau,kre
1310 
1311  scat_angle = in_scat ! scatAngle(solarAng,viewAng,azmAng)
1312 
1313  if (interp_ms) then
1314 
1315  !interpolate multi scattering part of the reflection
1316  multiscatrefl_water_lamb = 0
1317  multiscatrefl_ice_lamb = 0
1318  call mng_ms_get_lib( solarang, viewang, azmang, 0, 0, c2_scan, &
1319  multiscatrefl_water_lamb, multiscatrefl_ice_lamb, ierror )
1320  if( ierror /= 0 ) return
1321  endif
1322 
1323  if (interp_ss) then
1324 
1325  !get the phase function values
1327  phase_fun_norm_constant_water, phasefunvals_water,ierror)
1329  phase_fun_norm_constant_ice, phasefunvals_ice,ierror)
1330 
1331 
1332 ! IF(ierror /= 0)RETURN !if there is any error no point of continuing
1333 
1334  !calculate the single scattering part of the reflection
1335  CALL calcsingscatpartofreflectance(phasefunvals_water, phasefunvals_ice, &
1336  viewang, solarang, ssrefl_water, ssrefl_ice, ierror)
1337 
1338  endif
1339 
1340 
1341 ! IF(ierror /= 0)RETURN !if there is any error no point of continuing
1342 
1343 
1344  refl_water = ssrefl_water + multiscatrefl_water_lamb !total reflection with asurf = 0.0
1345  refl_ice = ssrefl_ice + multiscatrefl_ice_lamb !total reflection with asurf = 0.0
1346 
1347  RETURN
1348  END SUBROUTINE getrefl
1349 
1350 
1351 
1352  !--------------------------SUBROUTINE GetReflForGivenWindSpeedWater-----------------------------
1353  !This subroutine outputs the Reflectance table (R(tau,lambda, re)) for a given sun-satellite
1354  !geometry and a wind speed
1355  !INPUTS :
1356  ! solarAng : solar zenith in degrees (scalar)
1357  ! viewAng : viewing angle in degrees (scalar)
1358  ! azmAng : relative azimuth between sat and solar planes
1359  ! wspeed : wind speed m/s
1360  !OUTPUTS :
1361  ! reflAsurf : reflectance as a function of tau,lambda,re : 3-D Array
1362  ! DIM-1 = ntau, DIM-2 = nlambda, DIM-3 = nre
1363  ! ierror : integer value
1364  ! ierror = 0 success,
1365  ! = 1 I/O error
1366  ! = 2 memory allocation error
1367  ! = 3 invalid data
1368  !ROUTINES CAlLED :
1369  ! ReadPhaseFunctionDataHDF
1370  ! ReadWaterLibraryHDF
1371  ! getAllPhaseFunctionValues
1372  ! TriLinearInterpolationReflSearch
1373  ! CalcSingScatPartOfReflectance`
1374  !-----------------------------------------------------------------------------------------------
1375  SUBROUTINE getreflforgivenwindspeed(solarAng,viewAng,azmAng, in_scat, cos_scat, wspeed, reflAsurf_water, &
1376  reflAsurf_ice, wind_speed_only, interp_MS, interp_SS, ierror)
1378 
1379  use libraryarrays
1381  use ch_xfr, only : c2_scan
1382  !
1383  REAL, INTENT(IN) :: solarAng,viewAng,azmAng,wspeed, in_scat, cos_scat
1384  REAL,INTENT(OUT) :: reflAsurf_water(:,:,:), reflAsurf_ice(:,:,:)
1385  INTEGER,INTENT(OUT)::ierror
1386  logical, intent(in) :: wind_speed_only, interp_MS, interp_SS
1387 
1388  INTEGER::allocateStatus,iuhi,iulow
1389  REAL :: scat_angle,deltau
1390  INTEGER::do_mgr
1391 
1392  scat_angle = in_scat !scatAngle(solarAng,viewAng,azmAng)
1393 
1394  if (interp_ss) then
1395 
1396  !get the phase function values
1397  call get_aero_params(cos_scat, aerosol_asym)
1398 
1400  phase_fun_norm_constant_water, phasefunvals_water,ierror)
1401 
1403  phase_fun_norm_constant_ice, phasefunvals_ice,ierror)
1404 
1405  !calculate the single scattering part of the reflection
1406  call single_scattering_calcs_ocean(phasefunvals_water, phasefunvals_ice, singlescattering_water, singlescattering_ice, &
1407  rlphase, aerophase, rayleigh_tau, aerosol_tau, aerosol_ssa, &
1408  solarang,viewang, ssrefl_water, ssrefl_ice)
1409 
1410  endif
1411 
1412 
1413 
1414  if (interp_ms) then
1415 
1416 ! ! WDR wire up the sfc typ 1 for 3 m/s
1417  multiscatrefl_water_cm(:,:,:,1) = 0
1418  multiscatrefl_ice_cm(:,:,:,1) = 0
1419  call mng_ms_get_lib( solarang, viewang, azmang, 1, 0, c2_scan, &
1420  multiscatrefl_water_cm(:,:,:,1), multiscatrefl_ice_cm(:,:,:,1), &
1421  ierror )
1422  if( ierror /= 0 ) return
1423 
1424 !
1425 ! ! WDR wire up the sfc typ 1 for 7 m/s
1426  multiscatrefl_water_cm(:,:,:,2) = 0
1427  multiscatrefl_ice_cm(:,:,:,2) = 0
1428  call mng_ms_get_lib( solarang, viewang, azmang, 2, 0, c2_scan, &
1429  multiscatrefl_water_cm(:,:,:,2), multiscatrefl_ice_cm(:,:,:,2), &
1430  ierror )
1431  if( ierror /= 0 ) return
1432 
1433 !
1434 ! ! WDR wire up the sfc typ 1 for 15 m/s
1435  multiscatrefl_water_cm(:,:,:,3) = 0
1436  multiscatrefl_ice_cm(:,:,:,3) = 0
1437  call mng_ms_get_lib( solarang, viewang, azmang, 3, 0, c2_scan, &
1438  multiscatrefl_water_cm(:,:,:,3), multiscatrefl_ice_cm(:,:,:,3), &
1439  ierror )
1440  if( ierror /= 0 ) return
1441  endif
1442 
1443 
1444  int_reflectance_water_wspeed(:,:,:,1) = multiscatrefl_water_cm(:,:,:,1) + ssrefl_water(:,:,:)
1445  int_reflectance_water_wspeed(:,:,:,2) = multiscatrefl_water_cm(:,:,:,2) + ssrefl_water(:,:,:)
1446  int_reflectance_water_wspeed(:,:,:,3) = multiscatrefl_water_cm(:,:,:,3) + ssrefl_water(:,:,:)
1447 
1448  int_reflectance_ice_wspeed(:,:,:,1) = multiscatrefl_ice_cm(:,:,:,1) + ssrefl_ice(:,:,:)
1449  int_reflectance_ice_wspeed(:,:,:,2) = multiscatrefl_ice_cm(:,:,:,2) + ssrefl_ice(:,:,:)
1450  int_reflectance_ice_wspeed(:,:,:,3) = multiscatrefl_ice_cm(:,:,:,3) + ssrefl_ice(:,:,:)
1451 
1452 
1453 
1454  call interpolate_wind_speed(wspeed, int_reflectance_water_wspeed, reflasurf_water)
1455  call interpolate_wind_speed(wspeed, int_reflectance_ice_wspeed, reflasurf_ice)
1456 
1457  END SUBROUTINE getreflforgivenwindspeed
1458 
1459 
1460 
1461  subroutine interpolate_wind_speed(wspeed, data_in, data_out)
1463  use ch_xfr, only : c2_scan
1464  real, intent(in) :: wspeed
1465  real, dimension(:,:,:,:), intent(in) :: data_in
1466  real, dimension(:,:,:), intent(inout) :: data_out
1467 
1468  real :: deltau
1469  integer :: iuhi, iulow
1470 
1471  IF( (wspeed - wind_speed(1)) <= 0.2)THEN
1472 
1473  data_out(:,:,:) = data_in(:,:,:,1)
1474 
1475 
1476  ELSEIF( (wspeed - wind_speed(3)) >= -0.2)THEN
1477 
1478  data_out(:,:,:) = data_in(:,:,:,3)
1479 
1480 
1481  ELSEIF(abs(wspeed - wind_speed(2)) <= 0.2)THEN
1482 
1483 
1484  data_out(:,:,:) = data_in(:,:,:,2)
1485 
1486  ELSE
1487 
1488  IF(wspeed - wind_speed(2) < 0.0)THEN
1489  deltau = wind_speed(2) - wind_speed(1)
1490  iuhi = 2
1491  iulow = 1
1492 
1493  data_out(:,:,:) = ( data_in(:,:,:,1) * (wind_speed(iuhi)- wspeed) + &
1494  data_in(:,:,:,2) * (wspeed - wind_speed(iulow) ))/deltau
1495 
1496 
1497  ELSE
1498 
1499  deltau = wind_speed(3) - wind_speed(2)
1500  iuhi = 3
1501  iulow = 2
1502 
1503  data_out(:,:,:) = ( data_in(:,:,:,2) * (wind_speed(iuhi)- wspeed) + &
1504  data_in(:,:,:,3) * (wspeed - wind_speed(iulow) ))/deltau
1505 
1506 
1507 
1508  ENDIF
1509 
1510 
1511  ENDIF
1512 
1513 
1514  end subroutine interpolate_wind_speed
1515 
1516 
1517 
1518  !--------------------------SUBROUTINE GetReflForGivenWindSpeedIce-------------------------------
1519  !This subroutine outputs the Reflectance table (R(tau,lambda, re)) for a given sun-satellite
1520  !geometry and a wind speed(m/s)
1521  !INPUTS :
1522  ! solarAng : solar zenith in degrees (scalar)
1523  ! viewAng : viewing angle in degrees (scalar)
1524  ! azmAng : relative azimuth between sat and solar planes
1525  ! wspeed : wind speed m/s
1526  !OUTPUTS :
1527  ! reflAsurf : reflectance as a function of tau,lambda,re : 3-D Array
1528  ! DIM-1 = ntau, DIM-2 = nlambda, DIM-3 = nre
1529  ! ierror : integer value
1530  ! ierror = 0 success,
1531  ! = 1 I/O error
1532  ! = 2 memory allocation error
1533  ! = 3 invalid data
1534  !ROUTINES CAlLED :
1535  ! ReadPhaseFunctionDataHDF
1536  ! ReadIceLibraryHDF
1537  ! getAllPhaseFunctionValues
1538  ! TriLinearInterpolationReflSearch
1539  ! CalcSingScatPartOfReflectance
1540  !-----------------------------------------------------------------------------------------------
1541  SUBROUTINE getsdevreflforgivenwindspeed(solarAng,viewAng,azmAng,wspeed, &
1542  inrefl_ws_water, reflAsurf_water, inrefl_ws_ice, reflAsurf_ice, &
1543  wind_speed_only, ierror)
1545  use libraryarrays
1546  use ch_xfr, only : c2_scan
1547  !
1548  REAL, INTENT(IN) :: solarAng,viewAng,azmAng,wspeed
1549  real, intent(inout) :: inrefl_ws_water(:,:,:,:), inrefl_ws_ice(:,:,:,:)
1550  REAL,INTENT(OUT) :: reflAsurf_water(:,:,:), reflAsurf_ice(:,:,:)
1551  INTEGER,INTENT(OUT) :: ierror
1552  logical, intent(in) :: wind_speed_only
1553 
1554  INTEGER :: allocateStatus,iuhi,iulow
1555  REAL :: deltau
1556  integer :: num_radii
1557  INTEGER::do_mgr
1558 
1559  if (.not. wind_speed_only) then
1560 
1561 !
1562 ! ! WDR wire up the sfc typ 1 for 3 m/s
1563  inrefl_ws_water(:,:,:,1) = 0
1564  inrefl_ws_ice(:,:,:,1) = 0
1565  call mng_ms_get_lib( solarang, viewang, azmang, 1, 1, c2_scan, &
1566  inrefl_ws_water(:,:,:,1), inrefl_ws_ice(:,:,:,1), ierror )
1567  if( ierror /= 0 ) return
1568 
1569 !
1570 ! ! WDR wire up the sfc typ 2 for 7 m/s
1571  inrefl_ws_water(:,:,:,2) = 0
1572  inrefl_ws_ice(:,:,:,2) = 0
1573  call mng_ms_get_lib( solarang, viewang, azmang, 2, 1, c2_scan, &
1574  inrefl_ws_water(:,:,:,2), inrefl_ws_ice(:,:,:,2), ierror )
1575  if( ierror /= 0 ) return
1576 
1577 !
1578 ! ! WDR wire up the sfc typ 3 for 15 m/s
1579  inrefl_ws_water(:,:,:,3) = 0
1580  inrefl_ws_ice(:,:,:,3) = 0
1581  call mng_ms_get_lib( solarang, viewang, azmang, 3, 1, c2_scan, &
1582  inrefl_ws_water(:,:,:,3), inrefl_ws_ice(:,:,:,3), ierror )
1583  if( ierror /= 0 ) return
1584 
1585  !deallocate( wtrsd_int, icesd_int )
1586 
1587  endif
1588 
1589 
1590  call interpolate_wind_speed(wspeed, inrefl_ws_water, reflasurf_water)
1591  call interpolate_wind_speed(wspeed, inrefl_ws_ice, reflasurf_ice)
1592 
1593 
1594  RETURN
1595 
1596  END SUBROUTINE getsdevreflforgivenwindspeed
1597  !-----------------------------------------------------------------------------------------------
1598  SUBROUTINE getsdevrefllamb(solarAng,viewAng,azmAng, reflAsurf_water, &
1599  reflAsurf_ice, ierror)
1601 
1602  use libraryarrays
1603  ! WDR access the scan line
1604  use ch_xfr, only : c2_scan
1605  !
1606  REAL, INTENT(IN) :: solarAng,viewAng,azmAng
1607  REAL,INTENT(OUT) :: reflAsurf_water(:,:,:), reflAsurf_ice(:,:,:)
1608  INTEGER,INTENT(OUT) :: ierror
1609 
1610  INTEGER :: allocateStatus,iuhi,iulow
1611  REAL :: deltau
1612  integer :: num_radii
1613  INTEGER::do_mgr
1614 
1615  reflasurf_water = 0
1616  reflasurf_ice = 0
1617  call mng_ms_get_lib( solarang, viewang, azmang, 0, 1, c2_scan, &
1618  reflasurf_water, reflasurf_ice, ierror )
1619  if( ierror /= 0 ) return
1620 
1621 ! deallocate( wtrsd_int, icesd_int )
1622 
1623  END SUBROUTINE getsdevrefllamb
1624 
1625  end module interpolate_libraries
Definition: ch_xfr.f90:1
subroutine interpolatefluxes(solarOrViewAng, solarAngMuArray, inFluxArray, outFluxArray, iAngHi, iAngLow, dtheta, ierror)
integer number_wavelengths
real(single), dimension(:,:,:,:,:), allocatable surface_emissivity_water
real(single), dimension(:,:,:), allocatable int_surface_emissivity_water_sdev
real(single), dimension(:,:,:,:,:), allocatable cloud_emissivity_ice
real(single), dimension(:,:), allocatable phase_fun_norm_constant_ice
real(single), dimension(:,:,:,:,:), allocatable surface_emissivity_water_sdev
real(single), dimension(:,:,:,:,:), allocatable surface_emissivity_ice
subroutine getrefl(solarAng, viewAng, azmAng, in_scat, refl_water, refl_ice, interp_MS, interp_SS, ierror)
real(single), dimension(:,:,:,:), allocatable int_surface_emis_ice_wspeed
integer number_phase_angles_water
real(single), dimension(:,:,:,:), allocatable flux_down_ice_sensor
real(single), dimension(:,:), allocatable phase_fun_norm_constant_water
real function, public scatangle(solarAng, viewAng, relAzm)
real(single), dimension(:,:,:), allocatable int_reflectance_ice
subroutine, public libraryinterpolate(local_solarzenith, local_sensorzenith, local_relativeazimuth, local_scatangle, local_wind_speed, wind_speed_only, interp_MS, interp_SS, debug, status, i, j)
real(single), dimension(:,:,:,:), allocatable int_cloud_emis_water_wspeed
real(single), dimension(:,:,:), allocatable int_fluxdownwater_solar
real(single), dimension(:,:,:,:), allocatable flux_down_water_solar
character *15 platform_name
#define real
Definition: DbAlgOcean.cpp:26
real(single), dimension(:,:), allocatable singlescattering_water
real(single), dimension(:,:,:,:,:), allocatable cloud_emissivity_water_sdev
real(single), dimension(:,:,:), allocatable int_cloud_emissivity_ice
real(single), dimension(:,:,:), allocatable int_cloud_emissivity_water
real(single), dimension(:), allocatable aerosol_ssa
real(single), dimension(:,:,:,:), allocatable flux_down_ice_solar
real(single), dimension(:), allocatable library_fluxsolarzenith
real(single), dimension(:), allocatable library_taus
real(single), dimension(:,:,:), allocatable int_reflectance_ice_sdev
real(single), dimension(:,:,:,:), allocatable int_cloud_emis_water_sdev_wspeed
real(single), dimension(:,:,:), allocatable int_reflectance_water_sdev
real(single), dimension(:,:,:,:), allocatable int_cloud_emis_ice_sdev_wspeed
real(single), dimension(:,:,:,:,:), allocatable surface_emissivity_ice_sdev
subroutine, public interpolate_wind_speed(wspeed, data_in, data_out)
real(single), dimension(:,:,:), allocatable int_surface_emissivity_ice
real(single), dimension(:,:), allocatable singlescattering_ice
real(single), dimension(:,:), allocatable extinction_ice
real(single), dimension(:,:,:), allocatable int_fluxdownice_solar
real(single), dimension(:,:,:,:), allocatable int_refl_ice_sdev_wspeed
real(single), dimension(:,:), allocatable extinction_water
subroutine getphasefunctionvalues(scatAngle, scatAngleArray, num_angles, phaseFunArray, phaseNormConst, phaseFunVals, ierror)
real(single), dimension(:), allocatable library_sensor_zenith
real(single), dimension(:,:,:), allocatable int_surface_emissivity_water
real(single), dimension(:,:,:), allocatable phase_funcs_ice
real(single), dimension(:), allocatable aerosol_asym
real(single), dimension(:,:,:,:), allocatable flux_up_water_sensor
real(single), dimension(:,:,:,:), allocatable int_surface_emis_water_wspeed
real(single), dimension(:,:,:,:), allocatable flux_down_water_sensor
real(single), dimension(:,:,:), allocatable int_surface_emissivity_ice_sdev
real(single), dimension(:), allocatable rayleigh_tau
subroutine get_aero_params(cos_scatAngle, aeroG)
integer number_phase_angles_ice
subroutine getsdevreflforgivenwindspeed(solarAng, viewAng, azmAng, wspeed, inrefl_ws_water, reflAsurf_water, inrefl_ws_ice, reflAsurf_ice, wind_speed_only, ierror)
subroutine getsdevrefllamb(solarAng, viewAng, azmAng, reflAsurf_water, reflAsurf_ice, ierror)
real(single), dimension(:,:,:,:), allocatable int_surface_emis_water_sdev_wspeed
real(single), dimension(:,:,:), allocatable int_fluxupice_sensor
real(single), dimension(:,:,:), allocatable int_reflectance_water
integer number_waterradii
subroutine setup_emissivity_flux(angle, angle_array, idx_hi, idx_lo, dtheta)
subroutine getreflforgivenwindspeed(solarAng, viewAng, azmAng, in_scat, cos_scat, wspeed, reflAsurf_water, reflAsurf_ice, wind_speed_only, interp_MS, interp_SS, ierror)
real(single), dimension(:,:,:,:,:), allocatable cloud_emissivity_ice_sdev
subroutine single_scattering_calcs_ocean(phaseFunVals_liq, phaseFunVals_ice, ssAlbedo_liq, ssAlbedo_ice, RLphase, aeroPhase, RLTau, aeroTau, aeroOmega, theta, theta0, ssRefl_liq, ssRefl_ice)
integer c2_scan
Definition: ch_xfr.f90:44
real(single), dimension(:,:,:), allocatable int_fluxdownwater_sensor
real(single), dimension(:,:,:), allocatable int_cloud_emissivity_ice_sdev
real(single), dimension(:,:), allocatable truncation_factor_ice
integer number_iceradii
real(single), dimension(:,:,:,:), allocatable int_cloud_emis_ice_wspeed
real(single), dimension(:,:,:,:,:), allocatable cloud_emissivity_water
real(single), dimension(:,:,:), allocatable phase_funcs_water
real(single), dimension(:,:,:), allocatable int_fluxdownice_sensor
real(single), dimension(:,:,:,:), allocatable int_surface_emis_ice_sdev_wspeed
real(single), dimension(:,:,:,:), allocatable int_reflectance_water_wspeed
real(single), dimension(:), allocatable phase_angles_water
real(single), dimension(:,:,:,:), allocatable flux_up_ice_sensor
real(single), dimension(:,:,:,:), allocatable int_refl_water_sdev_wspeed
real(single), dimension(:), allocatable phase_angles_ice
#define abs(a)
Definition: misc.h:90
real(single), dimension(:,:,:,:), allocatable int_reflectance_ice_wspeed
real(single), dimension(:), allocatable library_fluxsensorzenith
real(single), dimension(:), allocatable aerosol_tau
real(single), dimension(:,:), allocatable truncation_factor_water
real(single), dimension(:,:,:), allocatable int_cloud_emissivity_water_sdev
real(single), dimension(:,:,:), allocatable int_fluxupwater_sensor
integer number_taus