1 | ! $Revision: 23 $, $Date: 2011-03-31 15:41:37 +0200 (jeu. 31 mars 2011) $ |
---|
2 | ! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/MODIS_simulator/test_modis_simulator.F90 $ |
---|
3 | program test_modis_simulator |
---|
4 | use mod_modis_sim |
---|
5 | implicit none |
---|
6 | ! |
---|
7 | ! Tests cases for MODIS L2 (pixel) and L3 (grid-scale) simulators |
---|
8 | ! |
---|
9 | |
---|
10 | ! |
---|
11 | ! Inputs |
---|
12 | ! |
---|
13 | integer, parameter :: nLayers = 6, nSubCols = 10 |
---|
14 | real, dimension(1, nLayers) :: temp, pressureLayers |
---|
15 | real, dimension(1, nLayers+1) :: pressureLevels |
---|
16 | real, dimension(1, nSubCols, nLayers) :: & |
---|
17 | opticalThickness, cloudWater, cloudIce, waterSize, iceSize, & |
---|
18 | liquid_opticalThickness, ice_opticalThickness |
---|
19 | ! |
---|
20 | ! Pixel-scale retreivals |
---|
21 | ! |
---|
22 | integer, dimension(1, nSubCols) :: retrievedPhase |
---|
23 | real, dimension(1, nSubCols) :: isccpTau, isccpCloudTopPressure, & |
---|
24 | retrievedCloudTopPressure, retrievedTau, retrievedSize |
---|
25 | integer :: i, k |
---|
26 | character(len = 6) :: phase |
---|
27 | |
---|
28 | ! |
---|
29 | ! Grid mean properties |
---|
30 | ! |
---|
31 | real, dimension(1) :: & |
---|
32 | Cloud_Fraction_Total_Mean, Cloud_Fraction_Water_Mean, Cloud_Fraction_Ice_Mean, & |
---|
33 | Optical_Thickness_Total_Mean, Optical_Thickness_Water_Mean, Optical_Thickness_Ice_Mean, & |
---|
34 | Optical_Thickness_Total_LogMean, Optical_Thickness_Water_LogMean, Optical_Thickness_Ice_LogMean, & |
---|
35 | Cloud_Particle_Size_Water_Mean, Cloud_Particle_Size_Ice_Mean, & |
---|
36 | Cloud_Top_Pressure_Total_Mean, & |
---|
37 | Liquid_Water_Path_Mean, Ice_Water_Path_Mean |
---|
38 | real, dimension(1, numTauHistogramBins, numPressureHistogramBins) :: Optical_Thickness_vs_Cloud_Top_Pressure |
---|
39 | |
---|
40 | ! --------------------------------------------------------------------------------------------- |
---|
41 | pressureLevels(1, :) = (/ 0., 200., 400., 600., 800., 1000., 1200. /) |
---|
42 | pressureLayers(1, :) = (pressureLevels(1, 2:) + pressureLevels(1, 1:nLayers)) / 2 |
---|
43 | temp(1, :) = (/ 200., 220., 240., 260., 280., 300.0 /) |
---|
44 | isccpCloudTopPressure(:, :) = 999. |
---|
45 | |
---|
46 | |
---|
47 | ! |
---|
48 | ! Tests: these 9 from Steve Platnick |
---|
49 | ! |
---|
50 | ice_opticalThickness = 0.; liquid_opticalThickness = 0. |
---|
51 | iceSize = 0.; waterSize = 0. |
---|
52 | |
---|
53 | ice_opticalThickness (1, 1, 3) = 0.2 |
---|
54 | iceSize (1, 1, 3) = 30 |
---|
55 | |
---|
56 | ice_opticalThickness (1, 2, 3) = 1. |
---|
57 | iceSize (1, 2, 3) = 30 |
---|
58 | |
---|
59 | liquid_opticalThickness(1, 3, 5) = 0.2 |
---|
60 | waterSize (1, 3, 5) = 10 |
---|
61 | |
---|
62 | liquid_opticalThickness(1, 4, 5) = 1. |
---|
63 | waterSize (1, 4, 5) = 10 |
---|
64 | |
---|
65 | ice_opticalThickness (1, 5, 3) = 0.2 |
---|
66 | iceSize (1, 5, 3) = 30 |
---|
67 | liquid_opticalThickness(1, 5, 5) = 5. |
---|
68 | waterSize (1, 5, 5) = 10 |
---|
69 | |
---|
70 | ice_opticalThickness (1, 6, 3) = 1. |
---|
71 | iceSize (1, 6, 3) = 30 |
---|
72 | liquid_opticalThickness(1, 6, 5) = 5. |
---|
73 | waterSize (1, 6, 5) = 10 |
---|
74 | |
---|
75 | ice_opticalThickness (1, 7, 3) = 10. |
---|
76 | iceSize (1, 7, 3) = 30 |
---|
77 | liquid_opticalThickness(1, 7, 5) = 5. |
---|
78 | waterSize (1, 7, 5) = 10 |
---|
79 | |
---|
80 | ice_opticalThickness (1, 8, 2) = 1. |
---|
81 | iceSize (1, 8, 2) = 15. |
---|
82 | ice_opticalThickness (1, 8, 3) = 1. |
---|
83 | iceSize (1, 8, 3) = 30. |
---|
84 | ice_opticalThickness (1, 8, 4) = 1. |
---|
85 | iceSize (1, 8, 4) = 60. |
---|
86 | |
---|
87 | liquid_opticalThickness(1, 9, 4) = 1. |
---|
88 | waterSize (1, 9, 4) = 15 |
---|
89 | liquid_opticalThickness(1, 9, 5) = 3. |
---|
90 | waterSize (1, 9, 5) = 10. |
---|
91 | liquid_opticalThickness(1, 9, 6) = 1. |
---|
92 | waterSize (1, 9, 6) = 50. |
---|
93 | |
---|
94 | call modis_l2_simulator(temp(1,:), pressureLayers(1,:), pressureLevels(1,:), & |
---|
95 | liquid_opticalThickness(1,:, :), ice_opticalThickness(1,:, :), & |
---|
96 | waterSize(1,:, :), iceSize(1,:, :), & |
---|
97 | isccpTau(1, :), isccpCloudTopPressure(1, :), & |
---|
98 | retrievedPhase(1, :), retrievedCloudTopPressure(1, :), retrievedTau(1, :), retrievedSize(1, :)) |
---|
99 | do i = 1, nSubcols |
---|
100 | print * |
---|
101 | print *, "Profile ", i |
---|
102 | if(any(ice_opticalThickness(1, i, :) > 0.) .or. any(liquid_opticalThickness(1, i, :) > 0.)) & |
---|
103 | print *, "center p ice: tau size water: tau size" |
---|
104 | do k = 1, nLayers |
---|
105 | if(ice_opticalThickness(1, i, k) > 0. .or. liquid_opticalThickness(1, i, k) > 0.) & |
---|
106 | write(*, '(3x, f5.0, 7x, 2(f4.1, 3x, f4.1, 10x))'), & |
---|
107 | pressureLayers(1, k), ice_opticalThickness(1, i, k), iceSize(1, i, k), liquid_opticalThickness(1, i, k), waterSize(1, i, k) |
---|
108 | end do |
---|
109 | select case(retrievedPhase(1, i)) |
---|
110 | case(phaseIsNone) |
---|
111 | phase = "None" |
---|
112 | case(phaseIsIce) |
---|
113 | phase = "Ice" |
---|
114 | case(phaseIsLiquid) |
---|
115 | phase = "Liquid" |
---|
116 | case(phaseIsUndetermined) |
---|
117 | phase = "Undet." |
---|
118 | case default |
---|
119 | phase = "???" |
---|
120 | end select |
---|
121 | print *, "Retrievals" |
---|
122 | write(*, '(" Phase: ", a6, 2x, "CTP: ", f5.0, ", tau = ", f4.1, ", size = ", f4.1)') & |
---|
123 | phase, retrievedCloudTopPressure(1, i), retrievedTau(1, i), retrievedSize(1, i) |
---|
124 | end do |
---|
125 | |
---|
126 | call modis_L3_simulator(retrievedPhase, retrievedCloudTopPressure, retrievedTau, retrievedSize, & |
---|
127 | Cloud_Fraction_Total_Mean, Cloud_Fraction_Water_Mean, Cloud_Fraction_Ice_Mean, & |
---|
128 | Optical_Thickness_Total_Mean, Optical_Thickness_Water_Mean, Optical_Thickness_Ice_Mean, & |
---|
129 | Optical_Thickness_Total_LogMean, Optical_Thickness_Water_LogMean, Optical_Thickness_Ice_LogMean, & |
---|
130 | Cloud_Particle_Size_Water_Mean, Cloud_Particle_Size_Ice_Mean, & |
---|
131 | Cloud_Top_Pressure_Total_Mean, & |
---|
132 | Liquid_Water_Path_Mean, Ice_Water_Path_Mean, & |
---|
133 | Optical_Thickness_vs_Cloud_Top_Pressure) |
---|
134 | |
---|
135 | print *; print *; print *, "Grid means" |
---|
136 | do i = 1, nSubcols |
---|
137 | write(*, '(" Phase: ", i2, 2x, "CTP: ", f5.0, ", tau = ", f4.1, ", size = ", f4.1)') & |
---|
138 | retrievedPhase(1, i), retrievedCloudTopPressure(1, i), retrievedTau(1, i), retrievedSize(1, i) |
---|
139 | end do |
---|
140 | print *, " Total Liquid Ice" |
---|
141 | write(*, '("Fraction: ", 3(f4.3, 6x))') Cloud_Fraction_Total_Mean, Cloud_Fraction_Water_Mean, Cloud_Fraction_Ice_Mean |
---|
142 | write(*, '("Tau: ", 3(f4.1, 6x))') Optical_Thickness_Total_Mean, Optical_Thickness_Water_Mean, Optical_Thickness_Ice_Mean |
---|
143 | write(*, '("TauLog: ", 3(f4.1, 6x))') Optical_Thickness_Total_LogMean, Optical_Thickness_Water_LogMean, Optical_Thickness_Ice_LogMean |
---|
144 | write(*, '("Size: ", 10x, 2(f4.1, 6x))') Cloud_Particle_Size_Water_Mean, Cloud_Particle_Size_Ice_Mean |
---|
145 | write(*, '("WaterPath:", 9x, 2(f5.1, 5x))') Liquid_Water_Path_Mean, Ice_Water_Path_Mean |
---|
146 | write(*, '("CTP: ", f5.1)') Cloud_Top_Pressure_Total_Mean |
---|
147 | print *; print *, "Histogram" |
---|
148 | write(*, '(8x, 7(f4.1, 3x))') tauHistogramBoundaries(:) |
---|
149 | do k = 1, numPressureHistogramBins |
---|
150 | write(*, '(f5.0, 3x, 7(f4.2, 3x))') pressureHistogramBoundaries(k), Optical_Thickness_vs_Cloud_Top_Pressure(1, :, k) |
---|
151 | end do |
---|
152 | print *, "Total fraction from histogram:", sum(Optical_Thickness_vs_Cloud_Top_Pressure(1, :, :)) |
---|
153 | end program test_modis_simulator |
---|
154 | |
---|