Changeset 2316 in lmdz_wrf for trunk/tools
- Timestamp:
- Feb 5, 2019, 2:29:03 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/module_scientific.f90
r2311 r2316 5245 5245 5246 5246 SUBROUTINE grid_spacepercen(xCAvals, yCAvals, xBAvals, yBAvals, xCBvals, yCBvals, xBBvals, yBBvals, & 5247 dxA, dyA, NAvertexmax, dxB, dyB, dxyB, NBvertexmax, strict, Ngridsin, gridsin, areas, percentages) 5247 dxA, dyA, NAvertexmax, dxB, dyB, dxyB, NBvertexmax, strict, Ngridsin, gridsin, areas2D, areas, & 5248 percentages) 5248 5249 ! Subroutine to compute the space-percentages of a series of grid cells (B) which lay inside another 5249 5250 ! series of grid-cells (A) porviding coincident polygons … … 5262 5263 INTEGER, DIMENSION(dxA,dyA), INTENT(out) :: Ngridsin 5263 5264 INTEGER, DIMENSION(dxA,dyA,dxyB,2), INTENT(out) :: gridsin 5264 REAL(r_k), DIMENSION(dxB,dyB), INTENT(out) :: areas 5265 REAL(r_k), DIMENSION(dxA,dyA,dxyB), INTENT(out) :: percentages5265 REAL(r_k), DIMENSION(dxB,dyB), INTENT(out) :: areas2D 5266 REAL(r_k), DIMENSION(dxA,dyA,dxyB), INTENT(out) :: areas,percentages 5266 5267 5267 5268 ! Local … … 5270 5271 INTEGER, ALLOCATABLE, DIMENSION(:,:) :: poinsin 5271 5272 CHARACTER(len=20) :: IS 5272 REAL(r_k), ALLOCATABLE, DIMENSION(:) :: pareas5273 5273 REAL(r_k), ALLOCATABLE, DIMENSION(:,:) :: vertexgrid 5274 5274 … … 5285 5285 ! Ngridsin: number of grids from grid B with some extension within the grid cell A 5286 5286 ! gridsin: indices of B grids within the grids of A 5287 ! areas: areas of the grids 5287 ! areas2D: areas of the grids as 2D matrix in the original shape 5288 ! areas: areas of cells B of each of the grids inside the grid cell A 5288 5289 ! percentages: percentages of area of cells B of each of the grids inside the grid cell A 5289 5290 5290 5291 fname = 'grid_spacepercen' 5291 5292 5293 areas2D = zeroRK 5292 5294 areas = zeroRK 5295 percentages = zeroRK 5293 5296 5294 5297 DO ix = 1, dxA … … 5312 5315 IF (ALLOCATED(poinsin)) DEALLOCATE(poinsin) 5313 5316 ALLOCATE(poinsin(Ngridsin(ix,iy),2)) 5314 IF (ALLOCATED(pareas)) DEALLOCATE(pareas)5315 ALLOCATE(pareas(Ngridsin(ix,iy)))5316 5317 5317 5318 DO iv=1, Ngridsin(ix,iy) … … 5322 5323 Nptin = Ngridsin(ix,iy) 5323 5324 CALL grid_spacepercen_within_reg(Nvertex, vertexgrid, dxB, dyB, NBvertexmax, xBBvals, & 5324 yBBvals, Ngridsin(ix,iy), poinsin, strict, pareas, percentages(ix,iy,1:Nptin))5325 yBBvals, Ngridsin(ix,iy), poinsin, strict, areas(ix,iy,1:Nptin), percentages(ix,iy,1:Nptin)) 5325 5326 5326 5327 ! Filling areas 5327 5328 DO iv = 1, Ngridsin(ix,iy) 5328 IF (areas (poinsin(iv,1), poinsin(iv,2)) == zeroRK) THEN5329 areas (poinsin(iv,1), poinsin(iv,2)) = pareas(iv)5329 IF (areas2D(poinsin(iv,1), poinsin(iv,2)) == zeroRK) THEN 5330 areas2D(poinsin(iv,1), poinsin(iv,2)) = areas(ix,iy,iv) 5330 5331 END IF 5331 5332 END DO … … 5335 5336 5336 5337 IF (ALLOCATED(vertexgrid)) DEALLOCATE(vertexgrid) 5337 IF (ALLOCATED(pareas)) DEALLOCATE(pareas)5338 5338 IF (ALLOCATED(poinsin)) DEALLOCATE(poinsin) 5339 5339
Note: See TracChangeset
for help on using the changeset viewer.