| 1 | ! (c) British Crown Copyright 2008, the Met Office. |
|---|
| 2 | |
|---|
| 3 | ! All rights reserved. |
|---|
| 4 | ! |
|---|
| 5 | ! Redistribution and use in source and binary forms, with or without modification, are permitted |
|---|
| 6 | ! provided that the following conditions are met: |
|---|
| 7 | ! |
|---|
| 8 | ! * Redistributions of source code must retain the above copyright notice, this list |
|---|
| 9 | ! of conditions and the following disclaimer. |
|---|
| 10 | ! * Redistributions in binary form must reproduce the above copyright notice, this list |
|---|
| 11 | ! of conditions and the following disclaimer in the documentation and/or other materials |
|---|
| 12 | ! provided with the distribution. |
|---|
| 13 | ! * Neither the name of the Met Office nor the names of its contributors may be used |
|---|
| 14 | ! to endorse or promote products derived from this software without specific prior written |
|---|
| 15 | ! permission. |
|---|
| 16 | ! |
|---|
| 17 | ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR |
|---|
| 18 | ! IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
|---|
| 19 | ! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
|---|
| 20 | ! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|---|
| 21 | ! DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|---|
| 22 | ! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
|---|
| 23 | ! IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
|---|
| 24 | ! OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|---|
| 25 | |
|---|
| 26 | ! |
|---|
| 27 | ! History: |
|---|
| 28 | ! Jul 2007 - A. Bodas-Salcedo - Initial version |
|---|
| 29 | ! |
|---|
| 30 | ! |
|---|
| 31 | |
|---|
| 32 | MODULE MOD_COSP_SIMULATOR |
|---|
| 33 | USE MOD_COSP_TYPES |
|---|
| 34 | USE MOD_COSP_RADAR |
|---|
| 35 | USE MOD_COSP_LIDAR |
|---|
| 36 | USE MOD_COSP_ISCCP_SIMULATOR |
|---|
| 37 | USE MOD_COSP_MISR_SIMULATOR |
|---|
| 38 | USE MOD_COSP_STATS |
|---|
| 39 | IMPLICIT NONE |
|---|
| 40 | |
|---|
| 41 | CONTAINS |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 45 | !--------------------- SUBROUTINE COSP_SIMULATOR ------------------ |
|---|
| 46 | !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 47 | SUBROUTINE COSP_SIMULATOR(gbx,sgx,sghydro,cfg,vgrid,sgradar,sglidar,isccp,misr,stradar,stlidar) |
|---|
| 48 | |
|---|
| 49 | ! Arguments |
|---|
| 50 | type(cosp_gridbox),intent(in) :: gbx ! Grid-box inputs |
|---|
| 51 | type(cosp_subgrid),intent(in) :: sgx ! Subgrid inputs |
|---|
| 52 | type(cosp_sghydro),intent(in) :: sghydro ! Subgrid info for hydrometeors |
|---|
| 53 | type(cosp_config),intent(in) :: cfg ! Configuration options |
|---|
| 54 | type(cosp_vgrid),intent(in) :: vgrid ! Information on vertical grid of stats |
|---|
| 55 | type(cosp_sgradar),intent(inout) :: sgradar ! Output from radar simulator |
|---|
| 56 | type(cosp_sglidar),intent(inout) :: sglidar ! Output from lidar simulator |
|---|
| 57 | type(cosp_isccp),intent(inout) :: isccp ! Output from ISCCP simulator |
|---|
| 58 | type(cosp_misr),intent(inout) :: misr ! Output from MISR simulator |
|---|
| 59 | type(cosp_radarstats),intent(inout) :: stradar ! Summary statistics from radar simulator |
|---|
| 60 | type(cosp_lidarstats),intent(inout) :: stlidar ! Summary statistics from lidar simulator |
|---|
| 61 | ! Local variables |
|---|
| 62 | ! ***Timing variables (to be deleted in final version) |
|---|
| 63 | integer :: t0,t1,count_rate,count_max |
|---|
| 64 | |
|---|
| 65 | !+++++++++ Radar model ++++++++++ |
|---|
| 66 | if (cfg%Lradar_sim) then |
|---|
| 67 | call cosp_radar(gbx,sgx,sghydro,sgradar) |
|---|
| 68 | endif |
|---|
| 69 | |
|---|
| 70 | !+++++++++ Lidar model ++++++++++ |
|---|
| 71 | if (cfg%Llidar_sim) then |
|---|
| 72 | call cosp_lidar(gbx,sgx,sghydro,sglidar) |
|---|
| 73 | endif |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | !+++++++++ ISCCP simulator ++++++++++ |
|---|
| 77 | if (cfg%Lisccp_sim) then |
|---|
| 78 | call cosp_isccp_simulator(gbx,sgx,isccp) |
|---|
| 79 | endif |
|---|
| 80 | |
|---|
| 81 | !+++++++++ MISR simulator ++++++++++ |
|---|
| 82 | if (cfg%Lmisr_sim) then |
|---|
| 83 | call cosp_misr_simulator(gbx,sgx,misr) |
|---|
| 84 | endif |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | !+++++++++++ Summary statistics +++++++++++ |
|---|
| 88 | if (cfg%Lstats) then |
|---|
| 89 | call cosp_stats(gbx,sgx,cfg,sgradar,sglidar,vgrid,stradar,stlidar) |
|---|
| 90 | ! print *, '%%%%%% Stats:', (t1-t0)*1.0/count_rate, ' s' |
|---|
| 91 | endif |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | END SUBROUTINE COSP_SIMULATOR |
|---|
| 95 | |
|---|
| 96 | END MODULE MOD_COSP_SIMULATOR |
|---|