Changeset 1747 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Dec 17, 2017, 4:08:32 PM (8 years ago)
Author:
lfita
Message:

Adding:

  • `fill3DI_2Dvec': Subroutine to fill a 3D integer matrix from a series of indices from a 2D matrix
  • `fill3DR_2Dvec': Subroutine to fill a 3D float matrix from a series of indices from a 2D matrix
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/module_scientific.f90

    r1743 r1747  
    1515! clean_polygons: Subroutine to clean polygons from non-used paths, polygons only left as path since they are inner path of a hole
    1616! FindMinimumR_K*: Function returns the location of the minimum in the section between Start and End.
     17! fill3DI_2Dvec: Subroutine to fill a 3D integer matrix from a series of indices from a 2D matrix
     18! fill3DR_2Dvec: Subroutine to fill a 3D float matrix from a series of indices from a 2D matrix
    1719! gridpoints_InsidePolygon: Subroutine to determine if a series of grid points are inside a polygon
    1820!   following ray casting algorithm
     
    5355
    5456  CONTAINS
     57
     58  SUBROUTINE fill3DI_2Dvec(matind, inmat, id1, id2, od1, od2, od3, outmat)
     59! Subroutine to fill a 3D integer matrix from a series of indices from a 2D matrix
     60
     61    IMPLICIT NONE
     62
     63    INTEGER, INTENT(in)                                  :: id1, id2, od1, od2, od3
     64    INTEGER, DIMENSION(id1,id2), INTENT(in)              :: inmat
     65    INTEGER, DIMENSION(od1,od2), INTENT(in)              :: matind
     66    INTEGER, DIMENSION(od1,od2,od3), INTENT(out)         :: outmat
     67
     68! Local
     69    INTEGER                                              :: i, j
     70
     71!!!!!!! Variables
     72! matind: equivalence on the 2D space of the location in inmat
     73! inmat: values of the input matrix (1Dvec, time)
     74! id1/2: dimensions of the input matrix
     75! od1/3: dimensions of the output matrix
     76! outmat: output matrix
     77! NOTE: id2 == od3
     78
     79    fname = 'fill3DR_2Dvec'
     80
     81    DO i=1, od1
     82      DO j=1, od2
     83        IF (matind(i,j) /= -1) THEN
     84          outmat(i,j,:) = inmat(matind(i,j),:)
     85        ELSE
     86          outmat(i,j,:) = fillvalI
     87        END IF
     88      END DO
     89    END DO
     90
     91  END SUBROUTINE fill3DI_2Dvec
     92
     93  SUBROUTINE fill3DR_2Dvec(matind, inmat, id1, id2, od1, od2, od3, outmat)
     94! Subroutine to fill a 3D float matrix from a series of indices from a 2D matrix
     95
     96    IMPLICIT NONE
     97
     98    INTEGER, INTENT(in)                                  :: id1, id2, od1, od2, od3
     99    REAL(r_k), DIMENSION(id1,id2), INTENT(in)            :: inmat
     100    INTEGER, DIMENSION(od1,od2), INTENT(in)              :: matind
     101    REAL(r_k), DIMENSION(od1,od2,od3), INTENT(out)       :: outmat
     102
     103! Local
     104    INTEGER                                              :: i, j
     105
     106!!!!!!! Variables
     107! matind: equivalence on the 2D space of the location in inmat
     108! inmat: values of the input matrix (1Dvec, time)
     109! id1/2: dimensions of the input matrix
     110! od1/3: dimensions of the output matrix
     111! outmat: output matrix
     112! NOTE: id2 == od3
     113
     114    fname = 'fill3DR_2Dvec'
     115
     116    DO i=1, od1
     117      DO j=1, od2
     118        IF (matind(i,j) /= -1) THEN
     119          outmat(i,j,:) = inmat(matind(i,j),:)
     120        ELSE
     121          outmat(i,j,:) = fillval64
     122        END IF
     123      END DO
     124    END DO
     125
     126  END SUBROUTINE fill3DR_2Dvec
    55127
    56128  SUBROUTINE reconstruct_matrix(vectorXpos, vectorYpos, dvec, Xmin, Xmax, Ymin, Ymax, dmatx, dmaty,   &
Note: See TracChangeset for help on using the changeset viewer.