Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes (minor) to MODIS and LIDAR simulators. #9

Merged
merged 1 commit into from
Apr 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified driver/data/outputs/UKMO/cosp2_output_um.ref.nc
Binary file not shown.
20 changes: 10 additions & 10 deletions src/simulator/MODIS_simulator/modis_simulator.F90
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ subroutine modis_column(nPoints,nSubCols,phase, cloud_top_pressure, optical_thic
Optical_Thickness_Total_MeanLog10(1:nPoints) = sum(log10(abs(optical_thickness)), mask = cloudMask, &
dim = 2) / Cloud_Fraction_Total_Mean(1:nPoints)
elsewhere
Optical_Thickness_Total_Mean = 0._wp
Optical_Thickness_Total_MeanLog10 = 0._wp
Optical_Thickness_Total_Mean = R_UNDEF
Optical_Thickness_Total_MeanLog10 = R_UNDEF
endwhere
where(Cloud_Fraction_Water_Mean(1:nPoints) > 0)
Optical_Thickness_Water_Mean(1:nPoints) = sum(optical_thickness, mask = waterCloudMask, dim = 2) / &
Expand All @@ -338,10 +338,10 @@ subroutine modis_column(nPoints,nSubCols,phase, cloud_top_pressure, optical_thic
Cloud_Particle_Size_Water_Mean(1:nPoints) = sum(particle_size, mask = waterCloudMask, dim = 2) / &
Cloud_Fraction_Water_Mean(1:nPoints)
elsewhere
Optical_Thickness_Water_Mean = 0._wp
Optical_Thickness_Water_MeanLog10 = 0._wp
Cloud_Particle_Size_Water_Mean = 0._wp
Liquid_Water_Path_Mean = 0._wp
Optical_Thickness_Water_Mean = R_UNDEF
Optical_Thickness_Water_MeanLog10 = R_UNDEF
Cloud_Particle_Size_Water_Mean = R_UNDEF
Liquid_Water_Path_Mean = R_UNDEF
endwhere
where(Cloud_Fraction_Ice_Mean(1:nPoints) > 0)
Optical_Thickness_Ice_Mean(1:nPoints) = sum(optical_thickness, mask = iceCloudMask, dim = 2) / &
Expand All @@ -353,10 +353,10 @@ subroutine modis_column(nPoints,nSubCols,phase, cloud_top_pressure, optical_thic
Cloud_Particle_Size_Ice_Mean(1:nPoints) = sum(particle_size, mask = iceCloudMask, dim = 2) / &
Cloud_Fraction_Ice_Mean(1:nPoints)
elsewhere
Optical_Thickness_Ice_Mean = 0._wp
Optical_Thickness_Ice_MeanLog10 = 0._wp
Cloud_Particle_Size_Ice_Mean = 0._wp
Ice_Water_Path_Mean = 0._wp
Optical_Thickness_Ice_Mean = R_UNDEF
Optical_Thickness_Ice_MeanLog10 = R_UNDEF
Cloud_Particle_Size_Ice_Mean = R_UNDEF
Ice_Water_Path_Mean = R_UNDEF
endwhere
Cloud_Top_Pressure_Total_Mean = sum(cloud_top_pressure, mask = cloudMask, dim = 2) / &
max(1, count(cloudMask, dim = 2))
Expand Down
21 changes: 10 additions & 11 deletions src/simulator/actsim/lidar_simulator.F90
Original file line number Diff line number Diff line change
Expand Up @@ -388,17 +388,14 @@ subroutine cmp_backsignal(nlev,npoints,beta,tau,pnorm)
! Other layers
do k=2,nlev
tautot_lay(:) = tau(:,k)-tau(:,k-1)
WHERE ( EXP(-2._wp*tau(:,k-1)) .gt. 0. )
WHERE (tautot_lay(:) .gt. 0.)
pnorm(:,k) = beta(:,k)*EXP(-2._wp*tau(:,k-1)) /&
(2._wp*tautot_lay(:))*(1._wp-EXP(-2._wp*tautot_lay(:)))
ELSEWHERE
! This must never happen, but just in case, to avoid div. by 0
pnorm(:,k) = beta(:,k) * EXP(-2._wp*tau(:,k-1))
END WHERE
WHERE (tautot_lay(:) .gt. 0.)
pnorm(:,k) = beta(:,k)*EXP(-2._wp*tau(:,k-1)) /&
(2._wp*tautot_lay(:))*(1._wp-EXP(-2._wp*tautot_lay(:)))
ELSEWHERE
pnorm(:,k) = 0._wp!beta(:,k)
! This must never happen, but just in case, to avoid div. by 0
pnorm(:,k) = beta(:,k) * EXP(-2._wp*tau(:,k-1))
END WHERE

END DO
end subroutine cmp_backsignal

Expand All @@ -413,19 +410,21 @@ subroutine cmp_beta(nlev,npoints,pnorm,tau,beta)
! Internal Variables
real(wp), dimension(npoints) :: tautot_lay
integer :: k
real(wp) :: epsrealwp

epsrealwp = epsilon(1._wp)
beta(:,1) = pnorm(:,1) * (2._wp*tau(:,1))/(1._wp-exp(-2._wp*tau(:,1)))
do k=2,nlev
tautot_lay(:) = tau(:,k)-tau(:,k-1)
WHERE ( EXP(-2._wp*tau(:,k-1)) .gt. 0. )
WHERE ( EXP(-2._wp*tau(:,k-1)) .gt. epsrealwp )
WHERE (tautot_lay(:) .gt. 0.)
beta(:,k) = pnorm(:,k)/ EXP(-2._wp*tau(:,k-1))* &
(2._wp*tautot_lay(:))/(1._wp-exp(-2._wp*tautot_lay(:)))
ELSEWHERE
beta(:,k)=pnorm(:,k)/EXP(-2._wp*tau(:,k-1))
END WHERE
ELSEWHERE
beta(:,k)=pnorm(:,k)
beta(:,k)=pnorm(:,k)/epsrealwp
END WHERE
ENDDO

Expand Down