Oasis3 4.0.2
|
00001 SUBROUTINE extraw (pfild, kmask, ksize, 00002 $ cdfic, kunit, cdgrd, knumb, 00003 $ pwork, kwork, knbor, ldread) 00004 C**** 00005 C ***************************** 00006 C * OASIS ROUTINE - LEVEL 3 * 00007 C * ------------- ------- * 00008 C ***************************** 00009 C 00010 C**** *extraw* - Weighted extrapolation 00011 C 00012 C Purpose: 00013 C ------- 00014 C Do simple weighted extrapolation to replace land point values 00015 C 00016 C** Interface: 00017 C --------- 00018 C *CALL* *extraw (pfild, kmask, ksize, cdfic, kunit, 00019 C cdgrd. knumb, pwork, kwork, knbor, ldread)* 00020 C 00021 C Input: 00022 C ----- 00023 C pfild : field on source grid (real 1D) 00024 C kmask : land-sea mask on source grid (integer 1D) 00025 C ksize : size of field array on source grid (integer) 00026 C kunit : logical unit number for extrapolation file (integer) 00027 C cdfic : filename for extrapolation data (character) 00028 C cdgrd : locator to read data in cdfic (character) 00029 C knumb : extrapolation dataset identity number (integer) 00030 C pwork : temporary array to read weights (real 2D) 00031 C kwork : temporary array to read adresses (integer 2D) 00032 C knbor : maximum number of source grid neighbors with non zero 00033 C weights with a source grid-square (integer) 00034 C ldread : logical flag to read extrapolation data 00035 C 00036 C Output: 00037 C ------ 00038 C pfild : field on source grid (real 1D) 00039 C 00040 C Workspace: 00041 C --------- 00042 C None 00043 C 00044 C Externals: 00045 C --------- 00046 C locrint, locread 00047 C 00048 C Reference: 00049 C --------- 00050 C See OASIS manual (1995) 00051 C 00052 C History: 00053 C ------- 00054 C Version Programmer Date Description 00055 C ------- ---------- ---- ----------- 00056 C 2.2 L. Terray 97/12/16 created 00057 C 2.3 S. Valcke 99/04/30 added: printing levels 00058 C 00059 C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00060 C 00061 C* ---------------------------- Include files --------------------------- 00062 C 00063 USE mod_unit 00064 USE mod_printing 00065 C 00066 C* ---------------------------- Argument declarations ------------------- 00067 C 00068 REAL (kind=ip_realwp_p) pfild(ksize), pwork(knbor,ksize) 00069 INTEGER (kind=ip_intwp_p) kwork(knbor,ksize), kmask(ksize) 00070 CHARACTER*8 cdfic, cdgrd 00071 LOGICAL ldread 00072 C 00073 C* ---------------------------- Local declarations ---------------------- 00074 C 00075 CHARACTER*8 clweight, cladress 00076 C 00077 C* ---------------------------- Poema verses ---------------------------- 00078 C 00079 C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00080 C 00081 C* 1. Initialization 00082 C -------------- 00083 C 00084 IF (nlogprt .GE. 2) THEN 00085 WRITE (UNIT = nulou,FMT = *) ' ' 00086 WRITE (UNIT = nulou,FMT = *) ' ' 00087 WRITE (UNIT = nulou,FMT = *) 00088 $ ' ROUTINE extraw - Level 3' 00089 WRITE (UNIT = nulou,FMT = *) 00090 $ ' ************** *******' 00091 WRITE (UNIT = nulou,FMT = *) ' ' 00092 WRITE (UNIT = nulou,FMT = *) ' weighted extrapolation' 00093 WRITE (UNIT = nulou,FMT = *) ' ' 00094 CALL FLUSH(nulou) 00095 ENDIF 00096 C 00097 C* initialize error flag for I/O routine 00098 C 00099 iflag = 0 00100 C 00101 C 00102 C* 2. Read extrapolation data the first time 00103 C -------------------------------------- 00104 C 00105 IF (ldread) THEN 00106 C 00107 C* Initialize locators and array sizes 00108 C 00109 WRITE(clweight,'(''WEIGHTS'',I1)') knumb 00110 WRITE(cladress,'(''ADRESSE'',I1)') knumb 00111 isize = ksize * knbor 00112 C 00113 C* Adress of connected points on source grid 00114 C 00115 CALL locrint (cladress, kwork, isize, kunit, iflag) 00116 C 00117 C* Checking 00118 C 00119 IF (iflag .NE. 0) THEN 00120 CALL prcout 00121 $ ('WARNING: problem in reading mapping data', 00122 $ cdgrd, 1) 00123 CALL prcout 00124 $ ('Could not get adress array', cladress, 1) 00125 CALL prtout 00126 $ ('Error reading logical unit', kunit, 1) 00127 CALL prcout 00128 $ ('It is connected to file', cdfic, 1) 00129 CALL HALTE ('STOP in extraw') 00130 ENDIF 00131 C 00132 C* Weights of overlapped points on source grid 00133 C 00134 CALL locread (clweight, pwork, isize, kunit, iflag) 00135 C 00136 C* Checking 00137 C 00138 IF (iflag .NE. 0) THEN 00139 CALL prcout 00140 $ ('WARNING: problem in reading mapping data', 00141 $ cdgrd, 1) 00142 CALL prcout 00143 $ ('Could not get weight array', clweight, 1) 00144 CALL prtout 00145 $ ('Error reading logical unit', kunit, 1) 00146 CALL prcout 00147 $ ('It is connected to file', cdfic, 1) 00148 CALL HALTE ('STOP in extraw') 00149 ENDIF 00150 ldread = .FALSE. 00151 ENDIF 00152 C 00153 C 00154 C* 3. Do the mapping interpolation 00155 C ---------------------------- 00156 C 00157 C* Loop on all the target grid points 00158 C 00159 DO 310 ji = 1, ksize 00160 C* If it is a land point, we extrapolate 00161 IF (kmask(ji) .EQ. 1) THEN 00162 zsum = 0. 00163 DO 320 jk = 1, knbor 00164 zsum = zsum + pwork(jk,ji) * pfild(kwork(jk,ji)) 00165 320 CONTINUE 00166 pfild(ji) = zsum 00167 ENDIF 00168 310 CONTINUE 00169 C 00170 C 00171 C* 4. End of routine 00172 C -------------- 00173 C 00174 IF (nlogprt .GE. 2) THEN 00175 WRITE (UNIT = nulou,FMT = *) ' ' 00176 WRITE (UNIT = nulou,FMT = *) 00177 $ ' --------- End of ROUTINE extraw ---------' 00178 CALL FLUSH (nulou) 00179 ENDIF 00180 RETURN 00181 END