Changeset 2316 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Feb 5, 2019, 2:29:03 PM (6 years ago)
Author:
lfita
Message:

Changing to gridareas as in the same form for gridpercens

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/module_scientific.f90

    r2311 r2316  
    52455245
    52465246  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)
    52485249  ! Subroutine to compute the space-percentages of a series of grid cells (B) which lay inside another
    52495250  !   series of grid-cells (A) porviding coincident polygons
     
    52625263    INTEGER, DIMENSION(dxA,dyA), INTENT(out)             :: Ngridsin
    52635264    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)      :: percentages
     5265    REAL(r_k), DIMENSION(dxB,dyB), INTENT(out)           :: areas2D
     5266    REAL(r_k), DIMENSION(dxA,dyA,dxyB), INTENT(out)      :: areas,percentages
    52665267
    52675268! Local
     
    52705271   INTEGER, ALLOCATABLE, DIMENSION(:,:)                  :: poinsin
    52715272   CHARACTER(len=20)                                     :: IS
    5272    REAL(r_k), ALLOCATABLE, DIMENSION(:)                  :: pareas
    52735273   REAL(r_k), ALLOCATABLE, DIMENSION(:,:)                :: vertexgrid
    52745274
     
    52855285! Ngridsin: number of grids from grid B with some extension within the grid cell A
    52865286! 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
    52885289! percentages: percentages of area of cells B of each of the grids inside the grid cell A
    52895290
    52905291    fname = 'grid_spacepercen'
    52915292
     5293    areas2D = zeroRK
    52925294    areas = zeroRK
     5295    percentages = zeroRK
    52935296
    52945297    DO ix = 1, dxA
     
    53125315        IF (ALLOCATED(poinsin)) DEALLOCATE(poinsin)
    53135316        ALLOCATE(poinsin(Ngridsin(ix,iy),2))
    5314         IF (ALLOCATED(pareas)) DEALLOCATE(pareas)
    5315         ALLOCATE(pareas(Ngridsin(ix,iy)))
    53165317
    53175318        DO iv=1, Ngridsin(ix,iy)
     
    53225323        Nptin = Ngridsin(ix,iy)
    53235324        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))
    53255326
    53265327        ! Filling areas
    53275328        DO iv = 1, Ngridsin(ix,iy)
    5328           IF (areas(poinsin(iv,1), poinsin(iv,2)) == zeroRK) THEN
    5329             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)
    53305331          END IF
    53315332        END DO
     
    53355336
    53365337    IF (ALLOCATED(vertexgrid)) DEALLOCATE(vertexgrid)
    5337     IF (ALLOCATED(pareas)) DEALLOCATE(pareas)
    53385338    IF (ALLOCATED(poinsin)) DEALLOCATE(poinsin)
    53395339
Note: See TracChangeset for help on using the changeset viewer.