Changeset 1654 in lmdz_wrf
- Timestamp:
- Sep 25, 2017, 11:28:03 PM (7 years ago)
- Location:
- trunk/tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/interpolate.f90
r1608 r1654 74 74 difffraclonlat = SQRT((fraclon-lonv)**2. + (fraclat-latv)**2.) 75 75 mindifffracLl = MINVAL(difffraclonlat) 76 ! ilonlatfrac = index2DArrayR_K(difffraclonlat, Nperx, Npery, mindifffracLl) 76 77 ilonlatfrac = index2DArrayR(difffraclonlat, Nperx, Npery, mindifffracLl) 77 78 -
trunk/tools/module_definitions.f90
r1621 r1654 1 1 MODULE module_definitions 2 2 3 INTEGER, PARAMETER :: r_k = KIND(1.d0) 3 ! INTEGER, PARAMETER :: r_k = KIND(1.d0) 4 INTEGER, PARAMETER :: r_k = KIND(1.) 4 5 REAL(r_k), PARAMETER :: zeroRK = 0. 5 6 REAL(r_k), PARAMETER :: oneRK = 1. -
trunk/tools/module_scientific.f90
r1652 r1654 43 43 CONTAINS 44 44 45 46 45 SUBROUTINE poly_overlap_tracks_area(dbg, dx, dy, dt, minarea, inNallpolys, allpolys, ctrpolys, & 47 46 areapolys, Nmaxpoly, Nmaxtracks, tracks, finaltracks) … … 65 64 INTEGER :: i, j, ip, it, iip, itt 66 65 INTEGER :: ierr 67 REAL(r_k), DIMENSION( 2,Nmaxpoly,dt) :: Actrpolys68 REAL(r_k), DIMENSION( Nmaxpoly,dt) :: Aareapolys66 REAL(r_k), DIMENSION(Nmaxpoly) :: Aprevpolys, Acurrpolys 67 REAL(r_k), DIMENSION(2,Nmaxpoly) :: Cprevpolys, Ccurrpolys 69 68 INTEGER, DIMENSION(dt) :: Nallpolys 70 69 INTEGER, DIMENSION(dx,dy) :: meetpolys, searchpolys … … 73 72 INTEGER, DIMENSION(:), ALLOCATABLE :: coins 74 73 INTEGER, DIMENSION(:,:), ALLOCATABLE :: coinsNpts 75 INTEGER, DIMENSION(Nmaxpoly,dt) :: polycoincidencies76 INTEGER, DIMENSION(Nmaxpoly,Nmaxpoly,dt) :: coincidenciesNpts77 74 INTEGER :: Nmeet, Nsearch, Nindep 78 75 INTEGER, DIMENSION(dt) :: Nindeppolys … … 105 102 IF (dbg) PRINT *,TRIM(fname) 106 103 107 polycoincidencies = fillvalI108 coincidenciesNpts = fillvalI109 104 ! Number of independent polygons by time step 110 105 Nindeppolys = 0 … … 131 126 SpolysIndep(ip,it) = i 132 127 currID(ip) = i 128 Acurrpolys(ip) = areapolys(i,it) 129 Ccurrpolys(1,ip) = ctrpolys(1,i,it) 130 Ccurrpolys(2,ip) = ctrpolys(2,i,it) 133 131 NpolysIndep(ip,it) = 1 134 132 polysIndep(ip,1,it) = i 135 Actrpolys(1,ip,it) = ctrpolys(1,i,it)136 Actrpolys(2,ip,it) = ctrpolys(2,i,it)137 Aareapolys(ip,it) = areapolys(i,it)138 133 ELSE 139 134 WHERE (meetpolys == i) … … 167 162 prevID = 0 168 163 prevID = currID 164 Aprevpolys = Acurrpolys 165 Cprevpolys = Ccurrpolys 169 166 ip = 0 170 167 … … 173 170 ip = ip + 1 174 171 currID(ip) = i 175 Actrpolys(1,ip,it+1) = ctrpolys(1,i,it+1) 176 Actrpolys(2,ip,it+1) = ctrpolys(2,i,it+1) 177 Aareapolys(ip,it+1) = areapolys(i,it+1) 172 Acurrpolys(ip) = areapolys(i,it+1) 173 Acurrpolys(ip) = areapolys(i,it+1) 174 Ccurrpolys(1,ip) = ctrpolys(1,i,it+1) 175 Ccurrpolys(2,ip) = ctrpolys(2,i,it+1) 178 176 ELSE 179 177 WHERE (meetpolys == i) … … 199 197 CALL ErrMsg(msg,fname,ierr) 200 198 201 CALL coincidence_all_polys_area(dbg, dx,dy, Nmeet, currID, meetpolys, Ac trpolys(:,1:Nmeet,it+1),&202 Nsearch, prevID, searchpolys, Actrpolys(:,1:Nsearch,it), Aareapolys(1:Nsearch,it), coins,&199 CALL coincidence_all_polys_area(dbg, dx,dy, Nmeet, currID, meetpolys, Acurrpolys(1:Nmeet), & 200 Nsearch, prevID, searchpolys, Cprevpolys(:,1:Nsearch), Aprevpolys(1:Nsearch), coins, & 203 201 coinsNpts) 204 205 polycoincidencies(1:Nmeet,it+1) = coins206 coincidenciesNpts(1:Nmeet,1:Nsearch,it+1) = coinsNpts207 202 208 203 ! Counting the number of times that a polygon has a coincidency … … 234 229 DO j=1, NNprev 235 230 IF (coins(i) == polysIndep(ip,j,it)) THEN 236 IF (coincidencies(ip) == 0) THEN 231 ! Which index corresponds to this coincidence? 232 iindep = Index1DArrayI(SpolysIndep(1:Nindep,it+1), Nindep, coins(i)) 233 IF (iindep == -1) THEN 237 234 Nindep = Nindep + 1 238 235 SpolysIndep(Nindep,it+1) = coins(i) 239 236 END IF 240 ! Which index corresponds to this coincidence? 241 iindep = Index1DArrayI(SpolysIndep(1:Nmeet,it+1), Nindep, coins(i)) 237 iindep = Index1DArrayI(SpolysIndep(1:Nindep,it+1), Nindep, coins(i)) 242 238 IF (iindep < 0) THEN 239 PRINT *,' Looking for:', coins(i) 240 PRINT *,' Within:', SpolysIndep(1:Nindep,it+1) 241 PRINT *,' Might content:', polysIndep(ip,1:NNprev,it) 242 PRINT *,' From an initial list:', coins(1:Nmeet) 243 243 msg = 'Wrong index! There must be an index here' 244 244 CALL ErrMsg(msg,fname,iindep) … … 384 384 itrack = INT(tracks(1,1,itt,it)) 385 385 Nprev = COUNT(INT(tracks(2,:,itt,it)) /= 0) 386 PRINT *,'it:', it,'itrack:', itrack, 'Nprev:', Nprev387 PRINT *,' coordinates ix iy _______'388 DO i=1,Nprev389 PRINT *,' ',tracks(3,i,itt,it),tracks(4,i,itt,it)390 END DO391 386 finaltracks(1,itrack,it) = itrack*1. 392 387 finaltracks(2,itrack,it) = SUM(tracks(3,:,itt,it))/Nprev 393 388 finaltracks(3,itrack,it) = SUM(tracks(4,:,itt,it))/Nprev 394 389 finaltracks(4,itrack,it) = it*1. 395 PRINT *,' finaltrack:', finaltracks(:,itrack,it)396 390 END DO 397 391 END DO 392 393 DEALLOCATE(coins) 394 DEALLOCATE(coinsNpts) 398 395 399 396 RETURN … … 1222 1219 meanvnctr = 0. 1223 1220 meanvxctr = 0. 1221 xcorr = 0. 1222 ycorr = 0. 1224 1223 1225 1224 nval = fillval64 … … 1240 1239 CASE ('lon/lat') 1241 1240 ! Area as fixed yres and sinus-lat varying for xres 1242 xcorr(i,j) = DABS(DSIN(lon(i,j)*DegRad)) 1241 ! IF (KIND(xcorr(i,j)) == KIND(1.d0)) THEN 1242 ! xcorr(i,j) = DABS(DSIN(lon(i,j)*DegRad)) 1243 ! ELSE 1244 xcorr(i,j) = ABS(SIN(lon(i,j)*DegRad)) 1245 ! END IF 1243 1246 ycorr(i,j) = 1. 1244 1247 CASE ('nadir-sat') 1245 1248 ! Area from nadir resolution and degrading as we get far from satellite's nadir 1246 1249 ! GOES-E: 0 N, 75 W 1247 xcorr(i,j) = DABS(DSIN(lon(i,j)*DegRad)) 1250 ! IF (KIND(xcorr(i,j)) == KIND(1.d0)) THEN 1251 ! xcorr(i,j) = DABS(DSIN(lon(i,j)*DegRad)) 1252 ! ELSE 1253 xcorr(i,j) = ABS(SIN(lon(i,j)*DegRad)) 1254 ! END IF 1248 1255 ycorr(i,j) = 1. 1249 1256 END SELECT … … 1267 1274 1268 1275 IF (dbg) THEN 1269 PRINT *,' gr di_coord lon lat value _______ '1276 PRINT *,' grid_coord lon lat value _______ ' 1270 1277 DO ip=1, Npolypts 1271 1278 PRINT *, polypts(ip,:), ';', lon(polypts(ip,1),polypts(ip,2)), lat(polypts(ip,1),polypts(ip,2)),& … … 1285 1292 PRINT *,' mean grid center: ', meanctr, ' weighted mean center: ', meanwctr 1286 1293 END IF 1287 1294 1288 1295 ! Statistics of the values within the polygon 1289 1296 CALL StatsR_K(Npolypts, polyvals, nval, xval, mval, m2val, stdval) … … 1296 1303 1297 1304 ! Mean center weighted to minimum and maximum values 1298 distvn = DABS(polyvals - nval) 1299 distvx = DABS(polyvals - xval) 1305 ! IF (KIND(polyvals(1)) == KIND(1.d0)) THEN 1306 ! distvn = DABS(polyvals - nval) 1307 ! distvx = DABS(polyvals - xval) 1308 ! ELSE 1309 distvn = ABS(polyvals - nval) 1310 distvx = ABS(polyvals - xval) 1311 ! END IF 1300 1312 1301 1313 meanvnctr = 0.
Note: See TracChangeset
for help on using the changeset viewer.