Changeset 4193 for LMDZ6/trunk/libf/misc
- Timestamp:
- Jul 4, 2022, 11:45:46 PM (2 years ago)
- Location:
- LMDZ6/trunk/libf/misc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/misc/readTracFiles_mod.f90
r4191 r4193 21 21 22 22 PUBLIC :: tran0, idxAncestor, ancestor !--- GENERATION 0 TRACER + TOOLS FOR GENERATIONS 23 PUBLIC :: maxTableWidth 23 24 !------------------------------------------------------------------------------------------------------------------------------ 24 25 TYPE :: dataBase_type !=== TYPE FOR TRACERS SECTION … … 59 60 CHARACTER(LEN=maxlen), SAVE :: newH2OIso(5) = ['H2[16]O', 'H[2]HO ', 'H2[18]O', 'H2[17]O', 'H[3]HO '] 60 61 61 62 62 !=== LOCAL COPIES OF THE TRACERS AND ISOTOPES DESCRIPTORS, USED BY getKey (INITIALIZED IN getKey_init) 63 63 TYPE(trac_type), ALLOCATABLE, TARGET, SAVE :: tracers(:) 64 64 TYPE(isot_type), ALLOCATABLE, TARGET, SAVE :: isotopes(:) 65 65 66 INTEGER, PARAMETER :: maxTableWidth = 192 !--- Maximum width of a table displayed with "dispTable" 66 67 CHARACTER(LEN=maxlen) :: modname 67 68 … … 267 268 TYPE(trac_type), ALLOCATABLE :: tt(:) 268 269 TYPE(trac_type) :: tmp 269 CHARACTER(LEN=1024) :: str 270 CHARACTER(LEN=1024) :: str, str2 270 271 CHARACTER(LEN=maxlen) :: secn 271 272 INTEGER :: ierr, n … … 273 274 IF(.NOT.ALLOCATED(dBase)) ALLOCATE(dBase(0)) 274 275 OPEN(90, FILE=fnam, FORM='formatted', STATUS='old') 275 DO; READ(90,'(a)', IOSTAT=ierr)str 276 DO; str='' 277 DO 278 READ(90,'(a)', IOSTAT=ierr)str2 !--- Read a full line 279 str=TRIM(str)//' '//TRIM(str2) !--- Append "str" with the current line 280 n=LEN_TRIM(str); IF(n == 0) EXIT !--- Empty line (probably end of file) 281 IF(IACHAR(str(n:n)) /= 92) EXIT !--- No "\" continuing line symbol found => end of line 282 str = str(1:n-1) !--- Remove the "\" continuing line symbol 283 END DO 284 str = ADJUSTL(str) !--- Remove the front space 276 285 IF(ierr /= 0 ) EXIT !--- Finished: error or end of file 277 286 IF(str(1:1)=='#') CYCLE !--- Skip comments lines … … 777 786 phas = [(fgetKey(iq, 'phases',tm(:)%keys, 'g' ), iq=1, nq)] 778 787 CALL msg(TRIM(message)//':', modname) 779 IF( tm(1)%parent == '') THEN780 IF(test(dispTable('iiiss', ['iq ','hadv ','vadv ','name ','phase '], cat(tm%name, phas), cat([(iq, iq=1, nq)],&781 hadv, vadv),sub=modname), lerr)) RETURN788 IF(ALL(tm(:)%parent == '')) THEN 789 IF(test(dispTable('iiiss', ['iq ','hadv ','vadv ','name ','phase '], cat(tm%name, phas), & 790 cat([(iq, iq=1, nq)], hadv, vadv), nColMax=maxTableWidth, nHead=2, sub=modname), lerr)) RETURN 782 791 ELSE 783 792 IF(test(dispTable('iiissis', ['iq ','hadv ','vadv ','name ','parent','igen ','phase '], cat(tm%name, tm%parent, & 784 tm%phase), cat([(iq, iq=1, nq)], hadv, vadv, tm%iGeneration), sub=modname), lerr)) RETURN793 tm%phase), cat([(iq, iq=1, nq)], hadv, vadv, tm%iGeneration), nColMax=maxTableWidth, nHead=2, sub=modname), lerr)) RETURN 785 794 END IF 786 795 END FUNCTION dispTraSection … … 933 942 CALL get_in('ok_iso_verif', isot(strIdx(isot%parent, 'H2O'))%check, .FALSE.) 934 943 935 lerr = dispIsotopes(isot, 'Isotopes parameters read from file ', modname)944 lerr = dispIsotopes(isot, 'Isotopes parameters read from file "'//TRIM(fnam)//'"', modname) 936 945 937 946 END FUNCTION readIsotopesFile … … 945 954 !=== NOTE: THIS IS DONE HERE (IN A ROUTINE CALLED BY THE DYNAMIC), BECAUSE THE DYNAMIC NEEDS FEW PHYSICAL PARAMETERS. === 946 955 !============================================================================================================================== 947 SUBROUTINE initIsotopes(trac, isot)956 LOGICAL FUNCTION initIsotopes(trac, isot) RESULT(lerr) 948 957 TYPE(trac_type), ALLOCATABLE, TARGET, INTENT(INOUT) :: trac(:) 949 958 TYPE(isot_type), ALLOCATABLE, TARGET, INTENT(INOUT) :: isot(:) … … 955 964 TYPE(trac_type), POINTER :: t(:), t1 956 965 TYPE(isot_type), POINTER :: i 966 lerr = .FALSE. 957 967 958 968 t => trac … … 1019 1029 !=== READ PHYSICAL PARAMETERS FROM "isotopes_params.def" FILE 1020 1030 ! DONE HERE, AND NOT ONLY IN "infotrac_phy", BECAUSE SOME PHYSICAL PARAMS ARE NEEDED FOR RESTARTS (tnat AND alpha_ideal) 1021 IF(readIsotopesFile('isotopes_params.def',isot)) THEN 1022 STOP 'Problem when reading isotopes parameters in initIsotopes' 1023 ENDIF 1024 1025 END SUBROUTINE initIsotopes 1031 lerr = readIsotopesFile('isotopes_params.def',isot) 1032 1033 END FUNCTION initIsotopes 1026 1034 !============================================================================================================================== 1027 1035 … … 1048 1056 END DO 1049 1057 END DO 1050 IF(test(fmsg('Problem with the table content', modname, dispTable(prf, ttl, val, cat([(it,it=1,nt)]), rFmt='(EN8.4)',&1051 sub=modname)), lerr)) RETURN1058 IF(test(fmsg('Problem with the table content', modname, dispTable(prf, ttl, val, & 1059 cat([(it,it=1,nt)]), rFmt='(EN8.4)', nColMax=maxTableWidth, nHead=2, sub=modname)), lerr)) RETURN 1052 1060 DEALLOCATE(ttl, val) 1053 1061 END DO -
LMDZ6/trunk/libf/misc/strings_mod.F90
r4120 r4193 853 853 !--- Display a clean table composed of successive vectors of same length. 854 854 !=== The profile "p" describe in which order to pick up the columns from "s", "i" and "r" for display. 855 !============================================================================================================================== 856 LOGICAL FUNCTION dispTable(p, titles, s, i, r, rFmt, nmax, unit, sub) RESULT(lerr) 855 !=== * nRowMax lines are displayed (default: all lines) 856 !=== * nColMax characters (default: as long as needed) are displayed at most on a line. If the effective total length is 857 !=== higher, several partial tables are displayed ; the nHead (default: 1) first columns are included in each sub-table. 858 !============================================================================================================================== 859 LOGICAL FUNCTION dispTable(p, titles, s, i, r, rFmt, nRowMax, nColMax, nHead, unit, sub) RESULT(lerr) 857 860 CHARACTER(LEN=*), INTENT(IN) :: p !--- DISPLAY MAP: s/i/r 858 861 CHARACTER(LEN=*), INTENT(IN) :: titles(:) !--- TITLES (ONE EACH COLUMN) … … 861 864 REAL, OPTIONAL, INTENT(IN) :: r(:,:) !--- REALS 862 865 CHARACTER(LEN=*), OPTIONAL, INTENT(IN) :: rFmt !--- Format for reals 863 INTEGER, OPTIONAL, INTENT(IN) :: nmax !--- Display less than "nrow" rows 866 INTEGER, OPTIONAL, INTENT(IN) :: nRowMax !--- Display at most "nRowMax" rows 867 INTEGER, OPTIONAL, INTENT(IN) :: nColMax !--- Display at most "nColMax" characters each line 868 INTEGER, OPTIONAL, INTENT(IN) :: nHead !--- Head columns repeated for multiple tables display 864 869 INTEGER, OPTIONAL, INTENT(IN) :: unit !--- Output unit (default: screen) 865 870 CHARACTER(LEN=*), OPTIONAL, INTENT(IN) :: sub !--- Subroutine name … … 869 874 CHARACTER(LEN=maxlen), ALLOCATABLE :: d(:,:) 870 875 CHARACTER(LEN=1) :: s1, sp 871 INTEGER :: is, ii, ir, np, nrow, unt, ic872 INTEGER :: ns, ni, nr, n col, nmx873 INTEGER, ALLOCATABLE :: n(:) 874 INTEGER, PARAMETER :: nm= 2!--- Space between values & columns876 INTEGER :: is, ii, ir, it, k, nmx, unt, ic, np 877 INTEGER :: ns, ni, nr, nt, l, ncol, nHd, ib, l0 878 INTEGER, ALLOCATABLE :: n(:), ncmx(:) 879 INTEGER, PARAMETER :: nm=1 !--- Space between values & columns 875 880 LOGICAL :: ls, li, lr 876 881 … … 884 889 885 890 !--- CHECK ARGUMENTS COHERENCE 886 lerr = np /= SIZE(titles); IF(fmsg(' string "pattern" length and titles list mismatch', subn, lerr)) RETURN891 lerr = np /= SIZE(titles); IF(fmsg('display map "p" length and titles list mismatch', subn, lerr)) RETURN 887 892 IF(ls) THEN 888 893 ns = SIZE(s, 1); ncol = ncol + SIZE(s, 2); lerr = COUNT([(p(ic:ic)=='s', ic=1, np)]) /= SIZE(s, 2) … … 894 899 nr = SIZE(r, 1); ncol = ncol + SIZE(r, 2); lerr = COUNT([(p(ic:ic)=='r', ic=1, np)]) /= SIZE(r, 2) 895 900 END IF 896 IF(fmsg(' string "pattern" length and arguments number mismatch', subn, lerr)) RETURN901 IF(fmsg('display map "p" length and arguments number mismatch', subn, lerr)) RETURN 897 902 lerr = ncol /= SIZE(titles); IF(fmsg('"titles" length and arguments number mismatch', subn, lerr)) RETURN 898 903 lerr = ls.AND.li.AND.ns/=ni; IF(fmsg('string and integer arguments lengths mismatch', subn, lerr)) RETURN 899 904 lerr = ls.AND.lr.AND.ns/=nr; IF(fmsg( 'string and real arguments lengths mismatch', subn, lerr)) RETURN 900 905 lerr = li.AND.lr.AND.ni/=nr; IF(fmsg( 'integer and real arguments lengths mismatch', subn, lerr)) RETURN 901 nrow = MAX(ns,ni,nr)+1 902 nmx = nrow; IF(PRESENT(nmax)) nmx = MIN(nmx,nmax+1) 906 nmx = MAX(ns,ni,nr)+1; IF(PRESENT(nRowMax)) nmx = MIN(nmx,nRowMax+1) 903 907 904 908 !--- Allocate the assembled quantities array 905 ALLOCATE(d(n row,ncol), n(ncol))909 ALLOCATE(d(nmx,ncol), n(ncol)) 906 910 907 911 !--- Assemble the vectors into a strings array in the order indicated by "pattern" … … 914 918 CASE('r'); d(2:nmx,ic) = real2str(r(:,ir),rFm); ir = ir + 1 915 919 END SELECT 920 END DO 921 CALL cleanZeros(d) 922 DO ic = 1, ncol 916 923 n(ic)=0; DO ir=1, nmx; n(ic)=MAX(n(ic), LEN_TRIM(d(ir,ic))); END DO 917 924 END DO 918 925 n(:) = n(:) + 2*nm 919 926 927 !--- Build the vector of max column index in case the rows are too long (table must be displayed in multiple parts) 928 nHd = 1; IF(PRESENT(nHead)) nHd = nHead 929 IF(.NOT.PRESENT(nColMax)) THEN 930 nt = 1; ncmx = [ncol] 931 ELSE 932 nt = 1; l0 = SUM(n(1:nHd)+1)+1 933 IF(PRESENT(sub)) l0=l0+LEN_TRIM(subn)+1 934 !--- Count the number of table parts 935 l = l0; DO ic = nHd+1, ncol; l = l+n(ic)+1; IF(l>=nColMax) THEN; nt = nt+1; l = l0+n(ic)+1; END IF; END DO 936 !--- Get the index of the last column for each table part 937 ALLOCATE(ncmx(nt)); k = 1 938 l = l0; DO ic = nHd+1, ncol; l = l+n(ic)+1; IF(l>=nColMax) THEN; ncmx(k) = ic-1; l = l0+n(ic)+1; k = k+1; END IF; END DO 939 ncmx(nt) = ncol 940 END IF 941 920 942 !--- Display the strings array as a table 921 DO ir = 1, nmx; row = '' 922 DO ic = 1, ncol; el = d(ir,ic) 923 s1 = sp 924 row = TRIM(row)//REPEAT(' ',nm)//TRIM(el)//REPEAT(' ',n(ic)-LEN_TRIM(el)-nm)//s1 943 DO it = 1, nt 944 DO ir = 1, nmx; row = '' 945 DO ic = 1, nHd; el = d(ir,ic) 946 s1 = sp 947 row = TRIM(row)//REPEAT(' ',nm)//TRIM(el)//REPEAT(' ',n(ic)-LEN_TRIM(el)-nm)//s1 948 END DO 949 ib = nHd+1; IF(it>1) ib = ncmx(it-1)+1 950 DO ic = ib, ncmx(it); el = d(ir,ic) 951 s1 = sp 952 row = TRIM(row)//REPEAT(' ',nm)//TRIM(el)//REPEAT(' ',n(ic)-LEN_TRIM(el)-nm)//s1 953 END DO 954 nr = LEN_TRIM(row)-1 !--- Final separator removed 955 CALL msg(row(1:nr), subn, unit=unt) 956 IF(ir /= 1) CYCLE !--- Titles are underlined 957 row=''; DO ic=1,nHd; row=TRIM(row)//REPEAT('-',n(ic))//'+'; END DO 958 DO ic = ib,ncmx(it); row=TRIM(row)//REPEAT('-',n(ic))//'+'; END DO 959 CALL msg(row(1:LEN_TRIM(row)-1), subn, unit=unt) 925 960 END DO 926 nr = LEN_TRIM(row)-1 !--- Final separator removed 927 CALL msg(row(1:nr), subn, unit=unt) 928 IF(ir /= 1) CYCLE !--- Titles are underlined 929 row=''; DO ic=1,ncol; row=TRIM(row)//REPEAT('-',n(ic))//'+'; END DO 930 CALL msg(row(1:LEN_TRIM(row)-1), subn, unit=unt) 961 CALL msg('', subn, unit=unt) 931 962 END DO 932 963 … … 970 1001 lerr = COUNT([(p(ic:ic)=='r', ic=1, np)]) /= SIZE(r, DIM=2) 971 1002 END IF 972 IF(fmsg(' string "pattern" length and arguments number mismatch', ll=lerr)) RETURN1003 IF(fmsg('display map "p" length and arguments number mismatch', ll=lerr)) RETURN 973 1004 lerr = ncol /= SIZE(titles); IF(fmsg('"titles" length and arguments number mismatch', ll=lerr)) RETURN 974 1005 lerr = ls.AND.li.AND.ns/=ni; IF(fmsg('string and integer arguments lengths mismatch', ll=lerr)) RETURN … … 989 1020 CASE('r'); d(2:nrow,ic) = real2str(r(:,ir),rFm); ir = ir + 1 990 1021 END SELECT 1022 END DO 1023 CALL cleanZeros(d) 1024 DO ic = 1, ncol 991 1025 n(ic) = 0; DO ir=1, nrow; n(ic)=MAX(n(ic), LEN_TRIM(d(ir,ic))); END DO 992 1026 IF(needQuotes(d(2,ic)) .AND. ic/=1) n(ic) = n(ic) + 2 !--- For quotes, using second line only … … 1016 1050 1017 1051 !============================================================================================================================== 1018 LOGICAL FUNCTION dispOutliers_1(ll, a, n, err_msg, nam, subn, n max, unit) RESULT(lerr)1052 LOGICAL FUNCTION dispOutliers_1(ll, a, n, err_msg, nam, subn, nRowmax, nColMax, nHead, unit) RESULT(lerr) 1019 1053 ! Display outliers list in tables 1020 1054 ! If "nam" is supplied, it means the last index is for tracers => one table each tracer for rank > 2. … … 1024 1058 1025 1059 CHARACTER(LEN=*), OPTIONAL, INTENT(IN) :: err_msg, nam(:), subn !--- Error message, variables and calling subroutine names 1026 INTEGER, OPTIONAL, INTENT(IN) :: nmax, unit !--- Maximum number of lines to display (default: all) 1060 INTEGER, OPTIONAL, INTENT(IN) :: nRowMax !--- Maximum number of lines to display (default: all) 1061 INTEGER, OPTIONAL, INTENT(IN) :: nColMax !--- Maximum number of characters per line (default: 2048) 1062 INTEGER, OPTIONAL, INTENT(IN) :: nHead !--- Number of front columns to duplicate (default: 1) 1063 INTEGER, OPTIONAL, INTENT(IN) :: unit !--- Output unit (def: lunout) 1027 1064 CHARACTER(LEN=maxlen), ALLOCATABLE :: ttl(:) 1028 1065 LOGICAL, ALLOCATABLE :: m(:) 1029 1066 INTEGER, ALLOCATABLE :: ki(:), kj(:) 1030 INTEGER :: i, j, k, rk, rk1, ib, ie, itr, nm, unt, n mx, nv1067 INTEGER :: i, j, k, rk, rk1, ib, ie, itr, nm, unt, nRmx, nCmx, nHd, nv 1031 1068 CHARACTER(LEN=maxlen) :: mes, sub, fm='(f12.9)', v, s 1032 1069 CHARACTER(LEN=maxlen), ALLOCATABLE :: vnm(:) … … 1037 1074 vnm = ['a']; IF(PRESENT(nam )) vnm = nam !--- Variables names 1038 1075 sub = 'dispOutliers'; IF(PRESENT(subn)) sub = subn !--- Calling subroutine name 1039 nmx = SIZE(a); IF(PRESENT(nmax)) nmx = MIN(nmx,nmax) !--- Maximum number of lines to print 1076 nRmx= SIZE(a); IF(PRESENT(nRowMax)) nRmx=MIN(nRmx,nRowMax)!-- Maximum number of lines to print 1077 nCmx= 2048; IF(PRESENT(nColMax)) nCmx=MIN(nCmx,nColMax)!-- Maximum number of characters each line 1078 nHd = 1; IF(PRESENT(nHead)) nHd = nHead !--- Number of front columns to duplicate 1040 1079 unt = lunout; IF(PRESENT(unit)) unt = unit !--- Unit to print messages 1041 1080 … … 1061 1100 IF(rk==1) THEN 1062 1101 ALLOCATE(ttl(2)); ttl(2) = TRIM(vnm(1))//'(i)'; ttl(1) = 'i' 1063 IF(nv == 1) lerr = dispTable('sr', ttl, s=cat(PACK(nam,ll)), r=cat(PACK(a,ll)), rFmt=fm, nmax=nmax) 1064 IF(nv /= 1) lerr = dispTable('ir', ['name ','value'], i=cat(PACK(ki,m)), r=cat(PACK(a,ll)), rFmt=fm, nmax=nmax) 1102 IF(nv == 1) lerr = dispTable('sr', ttl, s=cat(PACK(nam,ll)), r=cat(PACK(a,ll)), & 1103 rFmt=fm, nRowMax=nRmx, nColMax=nCmx, nHead=nHd, unit=unt, sub=sub) 1104 IF(nv /= 1) lerr = dispTable('ir', ['name ','value'], i=cat(PACK(ki,m)), r=cat(PACK(a,ll)), & 1105 rFmt=fm, nRowMax=nRmx, nColMax=nCmx, nHead=nHd, unit=unt, sub=sub) 1065 1106 CALL msg("can't display outliers table", sub, lerr, unt) 1066 1107 RETURN … … 1078 1119 IF(nv == 1) ttl(rk) = TRIM(v)//','//int2str(itr)//')' !--- "<name>(i,j,itr)" (single name) 1079 1120 IF(nv /= 1) ttl(rk) = TRIM(v)//')' !--- "<nam(itr)>(i,j)" (one name each table/itr index) 1080 IF(rk==2) lerr = dispTable('ir', ttl, i=cat(PACK(ki,m)), r=cat(PACK(a(ib:ie),m)), rFmt=fm, nmax=nmax) 1081 IF(rk==3) lerr = dispTable('iir', ttl, i=cat(PACK(ki,m),PACK(kj,m)), r=cat(PACK(a(ib:ie),m)), rFmt=fm, nmax=nmax) 1121 IF(rk==2) lerr = dispTable('ir', ttl, i=cat(PACK(ki,m)), r=cat(PACK(a(ib:ie),m)), & 1122 rFmt=fm, nRowMax=nRmx, nColMax=nCmx, nHead=nHd, unit=unt, sub=sub) 1123 IF(rk==3) lerr = dispTable('iir', ttl, i=cat(PACK(ki,m),PACK(kj,m)), r=cat(PACK(a(ib:ie),m)), & 1124 rFmt=fm, nRowMax=nRmx, nColMax=nCmx, nHead=nHd, unit=unt, sub=sub) 1082 1125 CALL msg("can't display outliers table", sub, lerr, unt) 1083 1126 IF(lerr) RETURN … … 1085 1128 END FUNCTION dispOutliers_1 1086 1129 !============================================================================================================================== 1087 LOGICAL FUNCTION dispOutliers_2(ll, a, n, err_msg, nam, subn, n max, unit) RESULT(lerr)1130 LOGICAL FUNCTION dispOutliers_2(ll, a, n, err_msg, nam, subn, nRowMax, nColMax, nHead, unit) RESULT(lerr) 1088 1131 ! Display outliers list in tables 1089 1132 ! If "nam" is supplied and, it means the last index is for tracers => one table each tracer for rank > 2. … … 1092 1135 INTEGER, INTENT(IN) :: n(:) !--- Profile before linearization 1093 1136 CHARACTER(LEN=*), OPTIONAL, INTENT(IN) :: err_msg, nam(:), subn !--- Error message, variables and calling subroutine names 1094 INTEGER, OPTIONAL, INTENT(IN) :: nmax, unit !--- Maximum number of lines to display (default: all) 1137 INTEGER, OPTIONAL, INTENT(IN) :: nRowMax !--- Maximum number of lines to display (default: all) 1138 INTEGER, OPTIONAL, INTENT(IN) :: nColMax !--- Maximum number of characters per line (default: 2048) 1139 INTEGER, OPTIONAL, INTENT(IN) :: nHead !--- Number of front columns to duplicate (default: 1) 1140 INTEGER, OPTIONAL, INTENT(IN) :: unit !--- Output unit (def: lunout) 1095 1141 1096 1142 CHARACTER(LEN=maxlen) :: mes, sub, fm='(f12.9)', prf … … 1098 1144 LOGICAL, ALLOCATABLE :: m(:) 1099 1145 INTEGER, ALLOCATABLE :: ki(:), kj(:), kl(:) 1100 INTEGER :: i, j, k, rk, ib, ie, itr, nm, nv, unt, n mx, rk11146 INTEGER :: i, j, k, rk, ib, ie, itr, nm, nv, unt, nRmx, nCmx, nHd, rk1 1101 1147 REAL, ALLOCATABLE :: val(:,:) 1102 1148 1103 lerr = ANY(ll); IF(.NOT.lerr) RETURN 1149 lerr = ANY(ll); IF(.NOT.lerr) RETURN !--- No outliers -> finished 1104 1150 rk = SIZE(n); nv = SIZE(a,2) 1105 mes = 'outliers found'; IF(PRESENT(err_msg)) mes = err_msg !--- Error message 1106 vnm = [(ACHAR(k+96),k=1,nv)]; IF(PRESENT(nam )) vnm = nam !--- Variables names 1107 sub = 'dispOutliers'; IF(PRESENT(subn)) sub = subn !--- Calling subroutine name 1108 nmx = SIZE(a); IF(PRESENT(nmax)) nmx = MIN(nmx,nmax)!--- Maximum number of lines to print 1109 unt = lunout; IF(PRESENT(unit)) unt = unit !--- Unit to print messages 1110 lerr = SIZE(vnm) /= nv; IF(fmsg('SIZE(nam) /= SIZE(a,2)', sub, lerr, unt)) RETURN 1111 lerr = SIZE(a,1) /= SIZE(ll); IF(fmsg('"ll" and "a" sizes mismatch', sub, lerr, unt)) RETURN 1112 lerr = SIZE(a,1) /= PRODUCT(n); IF(fmsg('profile "n" does not match "a" and "ll"', sub, lerr, unt)) RETURN 1151 mes = 'outliers found'; IF(PRESENT(err_msg)) mes = err_msg !--- Error message 1152 vnm = [(ACHAR(k+96),k=1,nv)]; IF(PRESENT(nam )) vnm = nam !--- Variables names 1153 sub = 'dispOutliers'; IF(PRESENT(subn)) sub = subn !--- Calling subroutine name 1154 nRmx= SIZE(a); IF(PRESENT(nRowMax)) nRmx=MIN(nRmx,nRowMax)!-- Maximum number of lines to print 1155 nCmx= 2048; IF(PRESENT(nColMax)) nCmx=MIN(nCmx,nColMax)!-- Maximum number of characters each line 1156 nHd = 1; IF(PRESENT(nHead)) nHd = nHead !--- Number of front columns to duplicate 1157 unt = lunout; IF(PRESENT(unit)) unt = unit !--- Unit to print messages 1158 lerr= SIZE(vnm) /= nv; IF(fmsg('SIZE(nam) /= SIZE(a,2)', sub, lerr, unt)) RETURN 1159 lerr= SIZE(a,1) /= SIZE(ll); IF(fmsg('"ll" and "a" sizes mismatch', sub, lerr, unt)) RETURN 1160 lerr= SIZE(a,1) /= PRODUCT(n); IF(fmsg('profile "n" does not match "a" and "ll"', sub, lerr, unt)) RETURN 1113 1161 1114 1162 SELECT CASE(rk1) !--- Indices list … … 1124 1172 prf = REPEAT('i',rk)//REPEAT('r',nv) !--- Profile 1125 1173 ALLOCATE(val(COUNT(ll),nv)); DO k=1, nv; val(:,k) = PACK(a(:,k),ll); END DO 1126 IF(rk == 1) lerr = dispTable(prf, ttl, i = cat(PACK(ki,ll)), r = val, rFmt=fm, nmax=nmax) 1127 IF(rk == 2) lerr = dispTable(prf, ttl, i = cat(PACK(ki,ll),PACK(kj,ll)), r = val, rFmt=fm, nmax=nmax) 1128 IF(rk == 3) lerr = dispTable(prf, ttl, i = cat(PACK(ki,ll),PACK(kj,ll),PACK(kl,ll)), & 1129 r = val, rFmt=fm, nmax=nmax) 1174 IF(rk == 1) lerr = dispTable(prf, ttl, i = cat(PACK(ki,ll)), r = val, & 1175 rFmt=fm, nRowMax=nRmx, nColMax=nCmx, nHead=nHd, unit=unt, sub=sub) 1176 IF(rk == 2) lerr = dispTable(prf, ttl, i = cat(PACK(ki,ll),PACK(kj,ll)), r = val, & 1177 rFmt=fm, nRowMax=nRmx, nColMax=nCmx, nHead=nHd, unit=unt, sub=sub) 1178 IF(rk == 3) lerr = dispTable(prf, ttl, i = cat(PACK(ki,ll),PACK(kj,ll),PACK(kl,ll)), r = val, & 1179 rFmt=fm, nRowMax=nRmx, nColMax=nCmx, nHead=nHd, unit=unt, sub=sub) 1130 1180 CALL msg("can't display outliers table", sub, lerr, unt) 1131 1181 END FUNCTION dispOutliers_2 … … 1320 1370 END FUNCTION dble2str 1321 1371 !============================================================================================================================== 1322 1372 ELEMENTAL SUBROUTINE cleanZeros(s) 1373 CHARACTER(LEN=*), INTENT(INOUT) :: s 1374 INTEGER :: ls, ix, i 1375 IF(is_numeric(s)) THEN 1376 ls = LEN_TRIM(s) 1377 ix = MAX(INDEX(s,'E'),INDEX(s,'e'),INDEX(s,'D'),INDEX(s,'d')) 1378 IF(ix == 0) THEN 1379 DO ix = ls,1,-1; IF(s(ix:ix) /= '0') EXIT; END DO; s=s(1:ix+1) 1380 ELSE IF(INDEX(s,'.')/=0) THEN 1381 i = ix-1; DO WHILE(s(i:i) == '0'); i = i-1; END DO; s=s(1:i)//s(ix:ls) 1382 END IF 1383 END IF 1384 END SUBROUTINE cleanZeros 1385 !============================================================================================================================== 1323 1386 1324 1387 !==============================================================================================================================
Note: See TracChangeset
for help on using the changeset viewer.