Changeset 75 for IOIPSL/trunk/src
- Timestamp:
- 06/25/07 14:19:52 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
IOIPSL/trunk/src/histcom.f90
r11 r75 73 73 INTEGER,PARAMETER :: nb_files_max=20, nb_var_max=400, & 74 74 & nb_hax_max=5, nb_zax_max=10, nbopp_max=10 75 REAL,PARAMETER :: missing_val=1.e20 76 !- or HUGE(1.0) maximum real number 75 REAL,PARAMETER :: missing_val=nf90_fill_real 77 76 !- 78 77 INTEGER :: bufftmp_max(nb_files_max) = 1 … … 131 130 & var_haxid,var_zaxid,var_axid,ncvar_ids 132 131 !- 133 REAL,SAVE :: minmax(nb_files_max,nb_var_max,2) 132 REAL,DIMENSION(nb_files_max,nb_var_max,2),SAVE :: hist_minmax 133 LOGICAL,DIMENSION(nb_files_max,nb_var_max),SAVE :: & 134 & hist_calc_rng=.FALSE.,hist_wrt_rng=.FALSE. 134 135 !- 135 136 REAL,DIMENSION(nb_files_max,nb_var_max),SAVE :: & … … 976 977 REAL,INTENT(IN) :: pzvalues(pzsize) 977 978 INTEGER, INTENT(OUT) :: pzaxid 978 CHARACTER(LEN=*),INTENT(IN), 979 CHARACTER(LEN=*),INTENT(IN),OPTIONAL :: pdirect 979 980 !- 980 981 INTEGER :: pos, iv, nb, zdimid, zaxid_tmp … … 1093 1094 & pxsize, pysize, phoriid, pzsize, & 1094 1095 & par_oriz, par_szz, pzid, & 1095 & pnbbyt, popp, pfreq_opp, pfreq_wrt )1096 & pnbbyt, popp, pfreq_opp, pfreq_wrt, var_range) 1096 1097 !--------------------------------------------------------------------- 1097 1098 !- With this subroutine each variable to be archived on the history … … 1136 1137 !- pfreq_wrt: Frequency at which the variable should be 1137 1138 !- written (in seconds) 1139 !- var_range: Range of the variable. 1140 !- If the minimum is greater than the maximum, 1141 !- the values will be calculated. 1138 1142 !- 1139 1143 !- VERSION … … 1146 1150 CHARACTER(LEN=*),INTENT(IN) :: ptitle 1147 1151 REAL,INTENT(IN) :: pfreq_opp, pfreq_wrt 1152 REAL,DIMENSION(2),OPTIONAL,INTENT(IN) :: var_range 1148 1153 !- 1149 1154 INTEGER :: iv, i, nb … … 1437 1442 IF (check) WRITE(*,*) "histdef : 5.0" 1438 1443 !- 1439 minmax(pfileid,iv,1) = ABS(missing_val) 1440 minmax(pfileid,iv,2) = -ABS(missing_val) 1441 !- 1442 last_opp(pfileid,iv) = itau0(pfileid) ! - freq_opp(pfileid,iv)/2./deltat(pfileid) 1443 last_wrt(pfileid,iv) = itau0(pfileid) ! - freq_wrt(pfileid,iv)/2./deltat(pfileid) 1444 last_opp_chk(pfileid,iv) = itau0(pfileid) ! - freq_opp(pfileid,iv)/2./deltat(pfileid) 1445 last_wrt_chk(pfileid,iv) = itau0(pfileid) ! - freq_wrt(pfileid,iv)/2./deltat(pfileid) 1444 hist_wrt_rng(pfileid,iv) = (PRESENT(var_range)) 1445 IF (hist_wrt_rng(pfileid,iv)) THEN 1446 hist_calc_rng(pfileid,iv) = (var_range(1) > var_range(2)) 1447 IF (hist_calc_rng(pfileid,iv)) THEN 1448 hist_minmax(pfileid,iv,1:2) = & 1449 & (/ ABS(missing_val), -ABS(missing_val) /) 1450 ELSE 1451 hist_minmax(pfileid,iv,1:2) = var_range(1:2) 1452 ENDIF 1453 ENDIF 1454 !- 1455 ! - freq_opp(pfileid,iv)/2./deltat(pfileid) 1456 last_opp(pfileid,iv) = itau0(pfileid) 1457 ! - freq_wrt(pfileid,iv)/2./deltat(pfileid) 1458 last_wrt(pfileid,iv) = itau0(pfileid) 1459 ! - freq_opp(pfileid,iv)/2./deltat(pfileid) 1460 last_opp_chk(pfileid,iv) = itau0(pfileid) 1461 ! - freq_wrt(pfileid,iv)/2./deltat(pfileid) 1462 last_wrt_chk(pfileid,iv) = itau0(pfileid) 1446 1463 nb_opp(pfileid,iv) = 0 1447 1464 nb_wrt(pfileid,iv) = 0 … … 1650 1667 iret = NF90_PUT_ATT (ncid,ncvarid,'missing_value', & 1651 1668 & REAL(missing_val,KIND=4)) 1652 iret = NF90_PUT_ATT (ncid,ncvarid,'valid_min', & 1653 & REAL(minmax(pfileid,iv,1),KIND=4)) 1654 iret = NF90_PUT_ATT (ncid,ncvarid,'valid_max', & 1655 & REAL(minmax(pfileid,iv,2),KIND=4)) 1669 IF (hist_wrt_rng(pfileid,iv)) THEN 1670 iret = NF90_PUT_ATT (ncid,ncvarid,'valid_min', & 1671 & REAL(hist_minmax(pfileid,iv,1),KIND=4)) 1672 iret = NF90_PUT_ATT (ncid,ncvarid,'valid_max', & 1673 & REAL(hist_minmax(pfileid,iv,2),KIND=4)) 1674 ENDIF 1656 1675 !- 1657 1676 iret = NF90_PUT_ATT (ncid,ncvarid,'long_name',TRIM(ttitle)) … … 2174 2193 REAL :: rtime 2175 2194 CHARACTER(LEN=7) :: tmp_opp 2176 REAL :: mindata, maxdata2177 2195 REAL,ALLOCATABLE,SAVE :: buff_tmp2(:) 2178 2196 INTEGER,SAVE :: buff_tmp2_sz 2179 2197 REAL,ALLOCATABLE,SAVE :: buffer_used(:) 2180 2198 INTEGER,SAVE :: buffer_sz 2181 !-xx INTEGER :: ji2182 2199 !- 2183 2200 LOGICAL :: check = .FALSE. … … 2304 2321 & TRIM(tmp_opp),'----',LEN_TRIM(tmp_opp),nbindex 2305 2322 !- 2306 mindata = ABS(missing_val) 2307 maxdata = -ABS(missing_val) 2308 !-xx DO ji=1,tsz 2309 !-xx IF (buff_tmp2(ji)/= missing_val) THEN 2310 !-xx mindata = MIN(mindata, buff_tmp2(ji)) 2311 !-xx maxdata = MAX(maxdata, buff_tmp2(ji)) 2312 !-xx ENDIF 2313 !-xx ENDDO 2314 !-?? 2315 !-?? mindata = MINVAL(buff_tmp2(1:tsz), 2316 !-?? & MASK = buff_tmp2(1:tsz) /= missing_val) 2317 !-?? maxdata = MAXVAL(buff_tmp2(1:tsz), 2318 !-?? & MASK = buff_tmp2(1:tsz) /= missing_val) 2319 !-?? 2320 minmax(pfileid,varid,1) = mindata 2321 minmax(pfileid,varid,2) = maxdata 2323 IF (hist_calc_rng(pfileid,varid)) THEN 2324 hist_minmax(pfileid,varid,1) = & 2325 & MIN(hist_minmax(pfileid,varid,1), & 2326 & MINVAL(buff_tmp2(1:tsz),MASK=buff_tmp2(1:tsz) /= missing_val)) 2327 hist_minmax(pfileid,varid,2) = & 2328 & MAX(hist_minmax(pfileid,varid,2), & 2329 & MAXVAL(buff_tmp2(1:tsz),MASK=buff_tmp2(1:tsz) /= missing_val)) 2330 ENDIF 2322 2331 !- 2323 2332 !-- 5.0 Do the operations if needed. In the case of instantaneous … … 2675 2684 IF ( check ) WRITE(*,*) 'Entering loop on vars :', nb_var(ifile) 2676 2685 DO iv = 1,nb_var(ifile) 2677 ncvarid = ncvar_ids(ifile,iv) 2678 IF (check) THEN 2679 WRITE(*,*) 'min value for file :',ifile,' var n. :',iv, & 2680 & ' is : ',minmax(ifile,iv,1) 2681 WRITE(*,*) 'max value for file :',ifile,' var n. :',iv, & 2682 & ' is : ',minmax(ifile,iv,2) 2686 IF (hist_wrt_rng(ifile,iv)) THEN 2687 IF (check) THEN 2688 WRITE(*,*) 'min value for file :',ifile,' var n. :',iv, & 2689 & ' is : ',hist_minmax(ifile,iv,1) 2690 WRITE(*,*) 'max value for file :',ifile,' var n. :',iv, & 2691 & ' is : ',hist_minmax(ifile,iv,2) 2692 ENDIF 2693 IF (hist_calc_rng(ifile,iv)) THEN 2694 !-------- 1.1 Put the min and max values on the file 2695 ncvarid = ncvar_ids(ifile,iv) 2696 iret = NF90_PUT_ATT (ncid,ncvarid,'valid_min', & 2697 & REAL(hist_minmax(ifile,iv,1),KIND=4)) 2698 iret = NF90_PUT_ATT (ncid,ncvarid,'valid_max', & 2699 & REAL(hist_minmax(ifile,iv,2),KIND=4)) 2700 ENDIF 2683 2701 ENDIF 2684 !-2685 !---- 1.1 Put the min and max values on the file2686 !-2687 iret = NF90_PUT_ATT (ncid,ncvarid,'valid_min', &2688 & REAL(minmax(ifile,iv,1),KIND=4))2689 iret = NF90_PUT_ATT (ncid,ncvarid,'valid_max', &2690 & REAL(minmax(ifile,iv,2),KIND=4))2691 2702 ENDDO 2692 2703 !-
Note: See TracChangeset
for help on using the changeset viewer.