SURFEX v7.3
General documentation of Surfex
 All Classes Files Functions Variables Typedefs
/home/dasprezs/EXPORT_v7_3/src/SURFEX/get_grid_coord.F90
Go to the documentation of this file.
00001 !     #########
00002       SUBROUTINE GET_GRID_COORD(KLUOUT,PX,PY,KL,HGRID,PGRID_PAR)
00003 !     #######################################
00004 !!
00005 !!    PURPOSE
00006 !!    -------
00007 !!     Gets the coordinates of all points in the natural system of each projection
00008 !!
00009 !!    METHOD
00010 !!    ------
00011 !!   
00012 !!    EXTERNAL
00013 !!    --------
00014 !!
00015 !!
00016 !!    IMPLICIT ARGUMENTS
00017 !!    ------------------
00018 !!
00019 !!
00020 !!    REFERENCE
00021 !!    ---------
00022 !!
00023 !!    AUTHOR
00024 !!    ------
00025 !!
00026 !!    V. Masson                   Meteo-France
00027 !!
00028 !!    MODIFICATION
00029 !!    ------------
00030 !!
00031 !!    Original     01/2004
00032 !!                 10/2007  E. Martin  IGN Grid
00033 !----------------------------------------------------------------------------
00034 !
00035 !*    0.     DECLARATION
00036 !            -----------
00037 !
00038 USE MODD_SURF_ATM_GRID_n, ONLY : CGRID, NGRID_PAR, XGRID_PAR
00039 USE MODD_SURF_ATM_n,      ONLY : NSIZE_FULL
00040 !
00041 !
00042 USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
00043 USE PARKIND1  ,ONLY : JPRB
00044 !
00045 USE MODI_ABOR1_SFX
00046 !
00047 USE MODI_GET_GRID_COORD_CARTESIAN
00048 !
00049 USE MODI_GET_GRID_COORD_CONF_PROJ
00050 !
00051 USE MODI_GET_GRID_COORD_GAUSS
00052 !
00053 USE MODI_GET_GRID_COORD_IGN
00054 !
00055 USE MODI_GET_GRID_COORD_LONLAT_REG
00056 !
00057 USE MODI_GET_GRID_COORD_LONLATVAL
00058 IMPLICIT NONE
00059 !
00060 !*    0.1    Declaration of dummy arguments
00061 !            ------------------------------
00062 !
00063 INTEGER,                      INTENT(IN)  :: KLUOUT ! output listing logical unit
00064 REAL, DIMENSION(:), OPTIONAL, INTENT(OUT) :: PX     ! X natural coordinate in the projection
00065 REAL, DIMENSION(:), OPTIONAL, INTENT(OUT) :: PY     ! X natural coordinate in the projection
00066 INTEGER,            OPTIONAL, INTENT(IN)  :: KL         ! number of points
00067  CHARACTER(LEN=10),  OPTIONAL, INTENT(IN)  :: HGRID      ! grid type
00068 REAL, DIMENSION(:), OPTIONAL, POINTER     :: PGRID_PAR  ! parameters defining this grid
00069 !
00070 !
00071 !*    0.2    Declaration of local variables
00072 !            ------------------------------
00073 !
00074 REAL, DIMENSION(:), ALLOCATABLE :: ZX
00075 REAL, DIMENSION(:), ALLOCATABLE :: ZY
00076 !
00077  CHARACTER(LEN=10)           :: YGRID
00078 REAL, DIMENSION(:), POINTER :: ZGRID_PAR
00079 INTEGER                     :: IGRID_PAR
00080 INTEGER                     :: IL
00081 REAL(KIND=JPRB) :: ZHOOK_HANDLE
00082 !------------------------------------------------------------------------------
00083 !
00084 IF (LHOOK) CALL DR_HOOK('GET_GRID_COORD',0,ZHOOK_HANDLE)
00085 IF (PRESENT(HGRID)) THEN
00086   YGRID = HGRID
00087   IGRID_PAR = SIZE(PGRID_PAR)
00088   IL = KL
00089   ALLOCATE(ZGRID_PAR(IGRID_PAR))
00090   ZGRID_PAR = PGRID_PAR
00091 ELSE
00092   YGRID = CGRID
00093   IGRID_PAR = NGRID_PAR
00094   IL = NSIZE_FULL
00095   ALLOCATE(ZGRID_PAR(IGRID_PAR))
00096   ZGRID_PAR = XGRID_PAR
00097 END IF
00098 !
00099 ALLOCATE(ZX(IL))
00100 ALLOCATE(ZY(IL))
00101 !
00102 !
00103 SELECT CASE (YGRID)
00104 !
00105 !*    1.      Conformal projection grid
00106 !             -------------------------
00107 !
00108       CASE ('CONF PROJ ')
00109         CALL GET_GRID_COORD_CONF_PROJ(IGRID_PAR,IL,ZGRID_PAR,ZX,ZY)
00110         ! note that all points of the grid will be kept, whatever the surface
00111         ! type under consideration (e.g. sea points will be kept even for
00112         ! initialization of continents)
00113         !
00114 !
00115 !*    2.      Regular latlon grid
00116 !             -------------------
00117 !
00118       CASE ('LONLAT REG')
00119         CALL GET_GRID_COORD_LONLAT_REG(IGRID_PAR,IL,ZGRID_PAR,ZX,ZY)
00120 
00121 !
00122 !*    3.      Cartesian grid
00123 !             --------------
00124 !
00125       CASE ('CARTESIAN ')
00126         CALL GET_GRID_COORD_CARTESIAN(IGRID_PAR,IL,ZGRID_PAR,ZX,ZY)
00127         ! note that all points of the grid will be kept, whatever the surface
00128         ! type under consideration (e.g. sea points will be kept even for
00129         ! initialization of continents)
00130         !
00131 !
00132 !*    4.      Gaussian grid
00133 !             -------------
00134 !
00135       CASE ('GAUSS     ')
00136         CALL GET_GRID_COORD_GAUSS(IGRID_PAR,IL,ZGRID_PAR,ZX,ZY)
00137 !
00138 !*    5.      IGN grid
00139 !             -------------
00140 !
00141       CASE ('IGN       ')
00142         CALL GET_GRID_COORD_IGN(IGRID_PAR,IL,ZGRID_PAR,ZX,ZY)
00143 
00144 !
00145 !*    5.      lonlatval
00146 !             -------------
00147 !
00148       CASE ('LONLATVAL ')
00149         CALL GET_GRID_COORD_LONLATVAL(IGRID_PAR,IL,ZGRID_PAR,ZX,ZY)
00150 
00151 !
00152 !*    5.      Other cases
00153 !             -----------
00154 !
00155       CASE DEFAULT
00156         CALL ABOR1_SFX('GET_GRID_COORD: GRID TYPE '//YGRID//' NOT SUPPORTED')
00157 
00158 END SELECT
00159 !
00160 IF(PRESENT(PX)) PX(:)=ZX(:)
00161 IF(PRESENT(PY)) PY(:)=ZY(:)
00162 !
00163 DEALLOCATE(ZX)
00164 DEALLOCATE(ZY)
00165 DEALLOCATE(ZGRID_PAR)
00166 IF (LHOOK) CALL DR_HOOK('GET_GRID_COORD',1,ZHOOK_HANDLE)
00167 !-------------------------------------------------------------------------------
00168 !
00169 END SUBROUTINE GET_GRID_COORD