Oasis3 4.0.2
|
00001 SUBROUTINE pmesh (kx, ky, px, py, kngx, kngy, cdper, kper, 00002 $ pxi, pxs, pyi, pys) 00003 C**** 00004 C ***************************** 00005 C * OASIS ROUTINE - LEVEL 3 * 00006 C * ------------- ------- * 00007 C ***************************** 00008 C 00009 C**** *pmesh* - Calculate the mesh controlled by one point on a 00010 C periodical or non-periodical grid. 00011 C 00012 C Purpose: 00013 C ------- 00014 C For one point defined by the coordinates (px(k),py(k)) 00015 C on a lat-lon grid, gives the inferior and superior longitudes 00016 C (pxi,pxs) and latitudes (pyi,pys) of the associated mesh. 00017 C 00018 C 00019 C** Interface: 00020 C --------- 00021 C *CALL* *pmesh(kx, ky, px, py, kngx, kngy, cdper, kper, 00022 C pxi, pxs, pyi, pys)* 00023 C 00024 C Input: 00025 C ----- 00026 C kx : point longitude index 00027 C ky : point latitude index 00028 C px : longitude array (real 2D) 00029 C py : latitude array (real 2D) 00030 C kngx : number of longitudes 00031 C kngy : number of latitudes 00032 C cdper : grid periodicity 00033 C kper : number of overlapped points 00034 C 00035 C Output: 00036 C ------ 00037 C pxi : inferior longitude 00038 C pxs : superior longitude 00039 C pyi : inferior latitude 00040 C pys : superior latitude 00041 C 00042 C Workspace: 00043 C --------- 00044 C None 00045 C 00046 C External: 00047 C -------- 00048 C None 00049 C 00050 C References: 00051 C ---------- 00052 C O. Thual, Simple ocean-atmosphere interpolation. 00053 C Part A: The method, EPICOA 0629 (1992) 00054 C Part B: Software implementation, EPICOA 0630 (1992) 00055 C See also OASIS manual (1995) 00056 C 00057 C History: 00058 C ------- 00059 C Version Programmer Date Description 00060 C ------- ---------- ---- ----------- 00061 C 1.1 O. Thual 93/04/15 created 00062 C 2.0 L. Terray 95/10/01 modified: new structure 00063 C 2.3 L. Terray 99/09/15 changed periodicity variables 00064 C 00065 C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00066 C 00067 C* ---------------------------- Include files --------------------------- 00068 C 00069 USE mod_unit 00070 C 00071 C* ---------------------------- Argument declarations ------------------- 00072 C 00073 REAL (kind=ip_realwp_p) px(kngx,kngy), py(kngx,kngy) 00074 CHARACTER*8 cdper 00075 C 00076 C* ---------------------------- Poema verses ---------------------------- 00077 C 00078 C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00079 C 00080 C* 1. Left or right 00081 C ------------- 00082 C 00083 C* Periodic grid with kper overlapped points 00084 C 00085 IF (cdper .EQ. 'P') THEN 00086 IF (kx .EQ. 1) THEN 00087 pxi = 0.5 * (px(kx,ky) + px(kngx-kper,ky) - 360.) 00088 pxs = 0.5 * (px(kx,ky) + px(kx+1,ky)) 00089 ELSE IF (kx .EQ. kngx) THEN 00090 pxi = 0.5 * (px(kx-1,ky) + px(kx,ky)) 00091 pxs = 0.5 * (px(kx,ky) + px(1+kper,ky) + 360. ) 00092 ELSE 00093 pxi = 0.5 * (px(kx-1,ky) + px(kx,ky)) 00094 pxs = 0.5 * (px(kx,ky) + px(kx+1,ky)) 00095 ENDIF 00096 C 00097 C* Regional grid 00098 C 00099 ELSE IF (cdper .EQ. 'R') THEN 00100 IF (kx .EQ. 1) THEN 00101 pxi = px(kx,ky) 00102 pxs = 0.5 * (px(kx,ky) + px(kx+1,ky)) 00103 ELSE IF (kx .EQ. kngx) THEN 00104 pxi = 0.5 * (px(kx-1,ky) + px(kx,ky)) 00105 pxs = px(kx,ky) 00106 ELSE 00107 pxi = 0.5 * (px(kx-1,ky) + px(kx,ky)) 00108 pxs = 0.5 * (px(kx,ky) + px(kx+1,ky)) 00109 ENDIF 00110 END IF 00111 C 00112 C 00113 C* 2. Bottom or top (idem for both types of grid) 00114 C ------------------------------------------- 00115 C True only if it is a global grid in latitude [-90 , 90] 00116 C or as it is the case for regional models if the first and last 00117 C latitude row are masked ---> then we only go through the else statement. 00118 C 00119 IF (ky .EQ. 1) THEN 00120 pyi = -90. 00121 pys = 0.5 * (py(kx,ky) + py(kx,ky+1)) 00122 ELSE IF (ky .EQ. kngy) THEN 00123 pyi = 0.5 * (py(kx,ky-1) + py(kx,ky)) 00124 pys = 90. 00125 ELSE 00126 pyi = 0.5 * (py(kx,ky-1) + py(kx,ky)) 00127 pys = 0.5 * (py(kx,ky)+ py(kx,ky+1)) 00128 ENDIF 00129 C 00130 C* End of routine 00131 C 00132 RETURN 00133 END 00134