Changeset 3907 for dynamico_lmdz/aquaplanet/IOIPSL
- Timestamp:
- Feb 11, 2016, 3:01:01 PM (9 years ago)
- Location:
- dynamico_lmdz/aquaplanet/IOIPSL
- Files:
-
- 4 added
- 21 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
dynamico_lmdz/aquaplanet/IOIPSL/src/calendar.f90
r3847 r3907 1 1 MODULE calendar 2 2 !- 3 !$Id: calendar.f90 1 011 2010-05-07 13:05:34Z bellier$3 !$Id: calendar.f90 1519 2011-08-01 09:34:10Z mmaipsl $ 4 4 !- 5 5 ! This software is governed by the CeCILL license … … 40 40 !--------------------------------------------------------------------- 41 41 USE stringop,ONLY : strlowercase 42 USE errioipsl,ONLY : ipslerr 42 USE errioipsl,ONLY : ipslerr, ipsldbg, ipslout 43 43 !- 44 44 PRIVATE … … 354 354 tmp_str = input_str 355 355 DO WHILE ( MAX(y_pos,m_pos,d_pos,s_pos) > 0) 356 !---- WRITE( *,*) tmp_str357 !---- WRITE( *,*) y_pos,m_pos,d_pos,s_pos356 !---- WRITE(ipslout,*) tmp_str 357 !---- WRITE(ipslout,*) y_pos,m_pos,d_pos,s_pos 358 358 IF (y_pos > 0) THEN 359 359 WRITE(fmt,'("(I",I10.10,")")') y_pos-1 … … 530 530 INTEGER :: yearp,dayp 531 531 REAL :: sec,secp 532 LOGICAL :: check = .FALSE. 533 !--------------------------------------------------------------------- 534 IF (check) THEN 535 WRITE(*,*) & 532 LOGICAL :: l_dbg 533 !--------------------------------------------------------------------- 534 CALL ipsldbg (old_status=l_dbg) 535 !--------------------------------------------------------------------- 536 IF (l_dbg) THEN 537 WRITE(ipslout,*) & 536 538 & "isittime 1.0 ",itau,date0,dt,freq,last_action,last_check 537 539 ENDIF … … 604 606 & <= ABS( next_check_itau-next_act_itau)) THEN 605 607 do_action = .TRUE. 606 IF ( check) THEN607 WRITE( *,*) &608 IF (l_dbg) THEN 609 WRITE(ipslout,*) & 608 610 & 'ACT-TIME : itau, next_act_itau, next_check_itau : ', & 609 611 & itau,next_act_itau,next_check_itau 610 612 CALL ju2ymds (date_now,year,month,day,sec) 611 WRITE( *,*) 'ACT-TIME : y, m, d, s : ',year,month,day,sec612 WRITE( *,*) &613 WRITE(ipslout,*) 'ACT-TIME : y, m, d, s : ',year,month,day,sec 614 WRITE(ipslout,*) & 613 615 & 'ACT-TIME : date_mp1, date_mpf : ',date_mp1,date_mpf 614 616 ENDIF … … 618 620 ENDIF 619 621 !- 620 IF ( check) THEN621 WRITE( *,*) "isittime 2.0 ", &622 IF (l_dbg) THEN 623 WRITE(ipslout,*) "isittime 2.0 ", & 622 624 & date_next_check,date_next_act,ABS(dt_action-freq), & 623 625 & ABS(dt_action+dt_check-freq),dt_action,dt_check, & -
dynamico_lmdz/aquaplanet/IOIPSL/src/errioipsl.f90
r3847 r3907 1 1 MODULE errioipsl 2 2 !- 3 !$Id: errioipsl.f90 759 2009-10-22 08:53:27Z bellier$3 !$Id: errioipsl.f90 2079 2013-06-03 09:14:13Z jgipsl $ 4 4 !- 5 5 ! This software is governed by the CeCILL license … … 10 10 PRIVATE 11 11 !- 12 PUBLIC :: ipslnlf, ipslerr, ipslerr_act, ipslerr_inq, histerr, ipsldbg 13 !- 14 INTEGER :: n_l=6, ilv_cur=0, ilv_max=012 PUBLIC :: ipslnlf, ipslerr, ipslerr_act, ipslerr_inq, histerr, ipsldbg, ipslout 13 !- 14 INTEGER :: ipslout=6, ilv_cur=0, ilv_max=0 15 15 LOGICAL :: ioipsl_debug=.FALSE., lact_mode=.TRUE. 16 16 !- … … 39 39 !--------------------------------------------------------------------- 40 40 IF (PRESENT(old_number)) THEN 41 old_number = n_l41 old_number = ipslout 42 42 ENDIF 43 43 IF (PRESENT(new_number)) THEN 44 n_l= new_number44 ipslout = new_number 45 45 ENDIF 46 46 !--------------------- … … 76 76 ilv_cur = plev 77 77 ilv_max = MAX(ilv_max,plev) 78 WRITE( n_l,'(/,A," ",A)') TRIM(pemsg(plev)),TRIM(pcname)79 WRITE( n_l,'(3(" --> ",A,/))') TRIM(pstr1),TRIM(pstr2),TRIM(pstr3)78 WRITE(ipslout,'(/,A," ",A)') TRIM(pemsg(plev)),TRIM(pcname) 79 WRITE(ipslout,'(3(" --> ",A,/))') TRIM(pstr1),TRIM(pstr2),TRIM(pstr3) 80 80 ENDIF 81 81 IF ( (plev == 3).AND.lact_mode) THEN 82 WRITE( n_l,'("Fatal error from IOIPSL. STOP in ipslerr with code")')82 WRITE(ipslout,'("Fatal error from IOIPSL. STOP in ipslerr with code")') 83 83 STOP 1 84 84 ENDIF … … 177 177 ENDIF 178 178 IF (plev == 3) THEN 179 STOP 'Fatal error from IOIPSL. See stdout for more details' 179 WRITE(ipslout,'("Fatal error from IOIPSL. See stdout for more details")') 180 STOP 1 180 181 ENDIF 181 182 !--------------------- -
dynamico_lmdz/aquaplanet/IOIPSL/src/flincom.f90
r3847 r3907 1 1 MODULE flincom 2 2 !- 3 !$Id: flincom.f90 427 2008-10-16 07:55:13Z bellier$3 !$Id: flincom.f90 1932 2012-11-28 09:56:17Z jgipsl $ 4 4 !- 5 5 ! This software is governed by the CeCILL license … … 9 9 !- 10 10 USE calendar, ONLY : ju2ymds, ymds2ju, ioconf_calendar 11 USE errioipsl, ONLY : histerr 11 USE errioipsl, ONLY : histerr, ipslout,ipslerr,ipsldbg 12 12 USE stringop, ONLY : strlowercase 13 13 !- … … 175 175 CHARACTER(LEN=250):: name 176 176 !- 177 LOGICAL :: check = .FALSE. 178 !--------------------------------------------------------------------- 177 LOGICAL :: l_dbg 178 !--------------------------------------------------------------------- 179 CALL ipsldbg (old_status=l_dbg) 180 179 181 lll = LEN_TRIM(filename) 180 182 IF (filename(lll-2:lll) /= '.nc') THEN … … 193 195 ! Vertical axis 194 196 !- 195 IF ( check) WRITE(*,*) 'flincre Vertical axis'197 IF (l_dbg) WRITE(ipslout,*) 'flincre Vertical axis' 196 198 !- 197 199 iret = NF90_DEF_VAR (fid, 'lev', NF90_FLOAT, zdimid1, levid) … … 202 204 ! Time axis 203 205 !- 204 IF ( check) WRITE(*,*) 'flincre time axis'206 IF (l_dbg) WRITE(ipslout,*) 'flincre time axis' 205 207 !- 206 208 iret = NF90_DEF_VAR (fid, 'tstep', NF90_FLOAT, tdimid1, timeid) … … 211 213 ! The longitude 212 214 !- 213 IF ( check) WRITE(*,*) 'flincre Longitude axis'215 IF (l_dbg) WRITE(ipslout,*) 'flincre Longitude axis' 214 216 !- 215 217 iret = NF90_DEF_VAR (fid, "nav_lon", NF90_FLOAT, & … … 226 228 ! The Latitude 227 229 !- 228 IF ( check) WRITE(*,*) 'flincre Latitude axis'230 IF (l_dbg) WRITE(ipslout,*) 'flincre Latitude axis' 229 231 !- 230 232 iret = NF90_DEF_VAR (fid, "nav_lat", NF90_FLOAT, & … … 253 255 iret = NF90_ENDDEF (fid) 254 256 !- 255 IF ( check) WRITE(*,*) 'flincre Variable'257 IF (l_dbg) WRITE(ipslout,*) 'flincre Variable' 256 258 !- 257 259 iret = NF90_PUT_VAR (fid, levid, lev1(1:llm1)) 258 260 !- 259 IF ( check) WRITE(*,*) 'flincre Time Variable'261 IF (l_dbg) WRITE(ipslout,*) 'flincre Time Variable' 260 262 !- 261 263 iret = NF90_PUT_VAR (fid, timeid, REAL(itaus(1:ttm1))) 262 264 !- 263 IF ( check) WRITE(*,*) 'flincre Longitude'265 IF (l_dbg) WRITE(ipslout,*) 'flincre Longitude' 264 266 !- 265 267 iret = NF90_PUT_VAR (fid, lonid, lon1(1:iim1,1:jjm1)) 266 268 !- 267 IF ( check) WRITE(*,*) 'flincre Latitude'269 IF (l_dbg) WRITE(ipslout,*) 'flincre Latitude' 268 270 !- 269 271 iret = NF90_PUT_VAR (fid, latid, lat1(1:iim1,1:jjm1)) … … 311 313 INTEGER :: fid_out 312 314 !- 313 LOGICAL :: check = .FALSE. 314 !--------------------------------------------------------------------- 315 IF (check) WRITE (*,*) ' iideb, iilen, jjdeb, jjlen, iim, jjm ', & 315 LOGICAL :: l_dbg 316 !--------------------------------------------------------------------- 317 CALL ipsldbg (old_status=l_dbg) 318 319 IF (l_dbg) WRITE (*,*) ' iideb, iilen, jjdeb, jjlen, iim, jjm ', & 316 320 iideb, iilen, jjdeb, jjlen, iim, jjm 317 IF ( check) WRITE (*,*) ' lon ', lon(1,1), lon(iilen,jjlen)318 IF ( check) WRITE (*,*) ' lat ', lat(1,1), lat(iilen,jjlen)321 IF (l_dbg) WRITE (*,*) ' lon ', lon(1,1), lon(iilen,jjlen) 322 IF (l_dbg) WRITE (*,*) ' lat ', lat(1,1), lat(iilen,jjlen) 319 323 !- 320 324 CALL flinopen_work & … … 341 345 REAL :: date0, dt 342 346 INTEGER :: fid_out 343 !--------------------------------------------------------------------- 347 INTEGER :: iimc, jjmc 348 !--------------------------------------------------------------------- 349 iimc=iim 350 jjmc=jjm 344 351 CALL flinopen_work & 345 (filename, 1, iim , 1, jjm, do_test, &352 (filename, 1, iimc, 1, jjmc, do_test, & 346 353 iim, jjm, llm, lon, lat, lev, ttm, itaus, date0, dt, fid_out) 347 354 !------------------------- … … 385 392 !- 386 393 LOGICAL :: open_file 387 LOGICAL :: check = .FALSE. 388 !--------------------------------------------------------------------- 394 LOGICAL :: l_dbg 395 !--------------------------------------------------------------------- 396 CALL ipsldbg (old_status=l_dbg) 397 389 398 iilast = iideb+iilen-1 390 399 jjlast = jjdeb+jjlen-1 391 IF ( check) WRITE (*,*) &400 IF (l_dbg) WRITE (*,*) & 392 401 ' flinopen_work zoom 2D information '// & 393 402 ' iideb, iilen, iilast, jjdeb, jjlen, jjlast ', & … … 419 428 ENDIF 420 429 !- 421 IF ( check) &422 WRITE( *,*) 'OUT OF flininfo :',tmp_iim,tmp_jjm,tmp_llm,tmp_ttm430 IF (l_dbg) & 431 WRITE(ipslout,*) 'OUT OF flininfo :',tmp_iim,tmp_jjm,tmp_llm,tmp_ttm 423 432 !- 424 433 fid = ncids(fid_out) … … 429 438 ! 2.2 We test the axis if we have to. 430 439 !- 431 IF ( check) &432 WRITE( *,*) 'flininfo 2.2 We test if we have to test : ',do_test440 IF (l_dbg) & 441 WRITE(ipslout,*) 'flininfo 2.2 We test if we have to test : ',do_test 433 442 !- 434 443 IF (do_test) THEN … … 450 459 !-- 2.3 Else the sizes of the axes are returned to the user 451 460 !--- 452 IF ( check) WRITE(*,*) 'flinopen 2.3 Else sizes are returned'461 IF (l_dbg) WRITE(ipslout,*) 'flinopen 2.3 Else sizes are returned' 453 462 !--- 454 463 iim = tmp_iim … … 462 471 ! if not then we get the lon, lat and lev variables from the file 463 472 !- 464 IF ( check) WRITE(*,*) 'flinopen 3.0 we are realy talking'473 IF (l_dbg) WRITE(ipslout,*) 'flinopen 3.0 we are realy talking' 465 474 !- 466 475 IF (do_test) THEN … … 470 479 iret = NF90_GET_VAR (fid, vid, x_last, start=(/ iilast, jjlast /)) 471 480 !--- 472 IF ( check) &473 WRITE( *,*) 'from file lon first and last, modulo 360. ', &481 IF (l_dbg) & 482 WRITE(ipslout,*) 'from file lon first and last, modulo 360. ', & 474 483 x_first, x_last, MODULO(x_first,360.), MODULO(x_last,360.) 475 IF ( check) &476 WRITE( *,*) 'from model lon first and last, modulo 360. ', &484 IF (l_dbg) & 485 WRITE(ipslout,*) 'from model lon first and last, modulo 360. ', & 477 486 lon(1,1),lon(iilen,jjlen), & 478 487 MODULO(lon(1,1),360.), MODULO(lon(iilen,jjlen),360.) … … 491 500 iret = NF90_GET_VAR (fid, vid, x_last, start=(/ iilast, jjlast /)) 492 501 !--- 493 IF ( check) WRITE(*,*) &502 IF (l_dbg) WRITE(ipslout,*) & 494 503 'from file lat first and last ',x_first,x_last 495 IF ( check) WRITE(*,*) &504 IF (l_dbg) WRITE(ipslout,*) & 496 505 'from model lat first and last ',lat(1,1),lat(iilen,jjlen) 497 506 !--- … … 509 518 iret = NF90_GET_VAR (fid, vid, x_last, start=(/ llm /)) 510 519 !----- 511 IF ( check) WRITE(*,*) &520 IF (l_dbg) WRITE(ipslout,*) & 512 521 'from file lev first and last ',x_first ,x_last 513 IF ( check) WRITE(*,*) &522 IF (l_dbg) WRITE(ipslout,*) & 514 523 'from model lev first and last ',lev(1),lev(llm) 515 524 !----- … … 527 536 !-- 4.0 extracting the coordinates if we do not check 528 537 !--- 529 IF ( check) WRITE(*,*) 'flinopen 4.0 extracting the coordinates'538 IF (l_dbg) WRITE(ipslout,*) 'flinopen 4.0 extracting the coordinates' 530 539 !--- 531 540 CALL flinfindcood (fid_out, 'lon', vid, nbdim) … … 572 581 ! 5.0 Get all the details for the time if possible needed 573 582 !- 574 IF ( check) WRITE(*,*) 'flinopen 5.0 Get time'583 IF (l_dbg) WRITE(ipslout,*) 'flinopen 5.0 Get time' 575 584 !- 576 585 IF (ttm > 0) THEN … … 588 597 IF (INDEX(units,'seconds since') > 0) gdtmaf_id = iv 589 598 IF (INDEX(units,'timesteps since') > 0) gdtt_id = iv 590 IF (INDEX(name, 'tstep') > 0 ) old_id = iv599 IF (INDEX(name, 'tstep') > 0 .OR. INDEX(name,'time') > 0 ) old_id = iv 591 600 ENDDO 592 601 !--- … … 606 615 DEALLOCATE(vec_tmp) 607 616 !--- 608 IF ( check) WRITE(*,*) 'flinopen 5.1 Times ',itaus617 IF (l_dbg) WRITE(ipslout,*) 'flinopen 5.1 Times ',itaus 609 618 !--- 610 619 !-- Getting all the details for the time axis … … 626 635 sec0 = hours0*3600. + minutes0*60. + seci 627 636 CALL ymds2ju (year0, month0, day0, sec0, date0) 628 IF ( check) &629 WRITE( *,*) 'flinopen 5.1 gdtt_id year0 ... date0 ', &637 IF (l_dbg) & 638 WRITE(ipslout,*) 'flinopen 5.1 gdtt_id year0 ... date0 ', & 630 639 year0, month0, day0, sec0, date0 631 640 !----- … … 639 648 CALL ymds2ju (year0, month0, day0, sec0, date0) 640 649 !----- 641 IF ( check) &642 WRITE( *,*) 'flinopen 5.1 gdtmaf_id year0 ... date0 ', &650 IF (l_dbg) & 651 WRITE(ipslout,*) 'flinopen 5.1 gdtmaf_id year0 ... date0 ', & 643 652 year0, month0, day0, sec0, date0 644 653 ELSE IF (old_id > 0) THEN … … 657 666 ENDIF 658 667 !- 659 IF ( check) WRITE(*,*) 'flinopen 6.0 File opened', date0, dt668 IF (l_dbg) WRITE(ipslout,*) 'flinopen 6.0 File opened', date0, dt 660 669 !--------------------------- 661 670 END SUBROUTINE flinopen_work … … 685 694 CHARACTER(LEN=30) :: axname 686 695 !- 687 LOGICAL :: check = .FALSE. 688 !--------------------------------------------------------------------- 696 LOGICAL :: l_dbg 697 !--------------------------------------------------------------------- 698 CALL ipsldbg (old_status=l_dbg) 699 689 700 lll = LEN_TRIM(filename) 690 701 IF (filename(lll-2:lll) /= '.nc') THEN … … 713 724 axname = ADJUSTL(axname) 714 725 !--- 715 IF ( check) WRITE(*,*) &726 IF (l_dbg) WRITE(ipslout,*) & 716 727 'flininfo - getting axname',iv,axname,lll 717 728 !--- … … 728 739 zid = iv; llm = lll; 729 740 ELSE IF ( (INDEX(axname,'tstep') == 1) & 741 .OR.(INDEX(axname,'time') == 1) & 730 742 .OR.(INDEX(axname,'time_counter') == 1) ) THEN 731 743 !---- For the time we certainly need to allow for other names … … 775 787 !- 776 788 INTEGER :: fid, ncvarid, ndim, iret 777 LOGICAL :: check = .FALSE. 778 !--------------------------------------------------------------------- 779 IF (check) WRITE(*,*) & 789 LOGICAL :: l_dbg 790 !--------------------------------------------------------------------- 791 CALL ipsldbg (old_status=l_dbg) 792 793 IF (l_dbg) WRITE(ipslout,*) & 780 794 "flinput_r1d : SIZE(var) = ",SIZE(var) 781 795 !- … … 802 816 !- 803 817 INTEGER :: fid, ncvarid, ndim, iret 804 LOGICAL :: check = .FALSE. 805 !--------------------------------------------------------------------- 806 IF (check) WRITE(*,*) & 818 LOGICAL :: l_dbg 819 !--------------------------------------------------------------------- 820 CALL ipsldbg (old_status=l_dbg) 821 822 IF (l_dbg) WRITE(ipslout,*) & 807 823 "flinput_r2d : SIZE(var) = ",SIZE(var) 808 824 !- … … 829 845 !- 830 846 INTEGER :: fid, ncvarid, ndim, iret 831 LOGICAL :: check = .FALSE. 832 !--------------------------------------------------------------------- 833 IF (check) WRITE(*,*) & 847 LOGICAL :: l_dbg 848 !--------------------------------------------------------------------- 849 CALL ipsldbg (old_status=l_dbg) 850 851 IF (l_dbg) WRITE(ipslout,*) & 834 852 "flinput_r3d : SIZE(var) = ",SIZE(var) 835 853 !- … … 856 874 !- 857 875 INTEGER :: fid, ncvarid, ndim, iret 858 LOGICAL :: check = .FALSE. 859 !--------------------------------------------------------------------- 860 IF (check) WRITE(*,*) & 876 LOGICAL :: l_dbg 877 !--------------------------------------------------------------------- 878 CALL ipsldbg (old_status=l_dbg) 879 880 IF (l_dbg) WRITE(ipslout,*) & 861 881 "flinput_r4d : SIZE(var) = ",SIZE(var) 862 882 !- … … 955 975 INTEGER :: jl, ji 956 976 REAL,DIMENSION(:),ALLOCATABLE,SAVE :: buff_tmp 957 LOGICAL :: check = .FALSE. 958 !--------------------------------------------------------------------- 977 LOGICAL :: l_dbg 978 !--------------------------------------------------------------------- 979 CALL ipsldbg (old_status=l_dbg) 980 959 981 IF (.NOT.ALLOCATED(buff_tmp)) THEN 960 IF ( check) WRITE(*,*) &982 IF (l_dbg) WRITE(ipslout,*) & 961 983 "flinget_r1d : allocate buff_tmp for buff_sz = ",SIZE(var) 962 984 ALLOCATE (buff_tmp(SIZE(var))) 963 985 ELSE IF (SIZE(var) > SIZE(buff_tmp)) THEN 964 IF ( check) WRITE(*,*) &986 IF (l_dbg) WRITE(ipslout,*) & 965 987 "flinget_r1d : re-allocate buff_tmp for buff_sz = ",SIZE(var) 966 988 DEALLOCATE (buff_tmp) … … 993 1015 INTEGER :: jl, jj, ji 994 1016 REAL,DIMENSION(:),ALLOCATABLE,SAVE :: buff_tmp 995 LOGICAL :: check = .FALSE. 996 !--------------------------------------------------------------------- 1017 LOGICAL :: l_dbg 1018 !--------------------------------------------------------------------- 1019 CALL ipsldbg (old_status=l_dbg) 1020 997 1021 IF (.NOT.ALLOCATED(buff_tmp)) THEN 998 IF ( check) WRITE(*,*) &1022 IF (l_dbg) WRITE(ipslout,*) & 999 1023 "flinget_r2d : allocate buff_tmp for buff_sz = ",SIZE(var) 1000 1024 ALLOCATE (buff_tmp(SIZE(var))) 1001 1025 ELSE IF (SIZE(var) > SIZE(buff_tmp)) THEN 1002 IF ( check) WRITE(*,*) &1026 IF (l_dbg) WRITE(ipslout,*) & 1003 1027 "flinget_r2d : re-allocate buff_tmp for buff_sz = ",SIZE(var) 1004 1028 DEALLOCATE (buff_tmp) … … 1034 1058 INTEGER :: jl, jj, ji 1035 1059 REAL,DIMENSION(:),ALLOCATABLE,SAVE :: buff_tmp 1036 LOGICAL :: check = .FALSE. 1037 !--------------------------------------------------------------------- 1060 LOGICAL :: l_dbg 1061 !--------------------------------------------------------------------- 1062 CALL ipsldbg (old_status=l_dbg) 1063 1038 1064 IF (.NOT.ALLOCATED(buff_tmp)) THEN 1039 IF ( check) WRITE(*,*) &1065 IF (l_dbg) WRITE(ipslout,*) & 1040 1066 "flinget_r2d_zoom : allocate buff_tmp for buff_sz = ",SIZE(var) 1041 1067 ALLOCATE (buff_tmp(SIZE(var))) 1042 1068 ELSE IF (SIZE(var) > SIZE(buff_tmp)) THEN 1043 IF ( check) WRITE(*,*) &1069 IF (l_dbg) WRITE(ipslout,*) & 1044 1070 "flinget_r2d_zoom : re-allocate buff_tmp for buff_sz = ",SIZE(var) 1045 1071 DEALLOCATE (buff_tmp) … … 1074 1100 INTEGER :: jl, jk, jj, ji 1075 1101 REAL,DIMENSION(:),ALLOCATABLE,SAVE :: buff_tmp 1076 LOGICAL :: check = .FALSE. 1077 !--------------------------------------------------------------------- 1102 LOGICAL :: l_dbg 1103 !--------------------------------------------------------------------- 1104 CALL ipsldbg (old_status=l_dbg) 1105 1078 1106 IF (.NOT.ALLOCATED(buff_tmp)) THEN 1079 IF ( check) WRITE(*,*) &1107 IF (l_dbg) WRITE(ipslout,*) & 1080 1108 "flinget_r3d : allocate buff_tmp for buff_sz = ",SIZE(var) 1081 1109 ALLOCATE (buff_tmp(SIZE(var))) 1082 1110 ELSE IF (SIZE(var) > SIZE(buff_tmp)) THEN 1083 IF ( check) WRITE(*,*) &1111 IF (l_dbg) WRITE(ipslout,*) & 1084 1112 "flinget_r3d : re-allocate buff_tmp for buff_sz = ",SIZE(var) 1085 1113 DEALLOCATE (buff_tmp) … … 1117 1145 INTEGER :: jl, jk, jj, ji 1118 1146 REAL,DIMENSION(:),ALLOCATABLE,SAVE :: buff_tmp 1119 LOGICAL :: check = .FALSE. 1120 !--------------------------------------------------------------------- 1147 LOGICAL :: l_dbg 1148 !--------------------------------------------------------------------- 1149 CALL ipsldbg (old_status=l_dbg) 1150 1121 1151 IF (.NOT.ALLOCATED(buff_tmp)) THEN 1122 IF ( check) WRITE(*,*) &1152 IF (l_dbg) WRITE(ipslout,*) & 1123 1153 "flinget_r3d_zoom : allocate buff_tmp for buff_sz = ",SIZE(var) 1124 1154 ALLOCATE (buff_tmp(SIZE(var))) 1125 1155 ELSE IF (SIZE(var) > SIZE(buff_tmp)) THEN 1126 IF ( check) WRITE(*,*) &1156 IF (l_dbg) WRITE(ipslout,*) & 1127 1157 "flinget_r3d_zoom : re-allocate buff_tmp for buff_sz = ",SIZE(var) 1128 1158 DEALLOCATE (buff_tmp) … … 1159 1189 INTEGER :: jl, jk, jj, ji, jm 1160 1190 REAL,DIMENSION(:),ALLOCATABLE,SAVE :: buff_tmp 1161 LOGICAL :: check = .FALSE. 1162 !--------------------------------------------------------------------- 1191 LOGICAL :: l_dbg 1192 !--------------------------------------------------------------------- 1193 CALL ipsldbg (old_status=l_dbg) 1194 1163 1195 IF (.NOT.ALLOCATED(buff_tmp)) THEN 1164 IF ( check) WRITE(*,*) &1196 IF (l_dbg) WRITE(ipslout,*) & 1165 1197 "flinget_r4d : allocate buff_tmp for buff_sz = ",SIZE(var) 1166 1198 ALLOCATE (buff_tmp(SIZE(var))) 1167 1199 ELSE IF (SIZE(var) > SIZE(buff_tmp)) THEN 1168 IF ( check) WRITE(*,*) &1200 IF (l_dbg) WRITE(ipslout,*) & 1169 1201 "flinget_r4d : re-allocate buff_tmp for buff_sz = ",SIZE(var) 1170 1202 DEALLOCATE (buff_tmp) … … 1204 1236 INTEGER :: jl, jk, jj, ji, jm 1205 1237 REAL,DIMENSION(:),ALLOCATABLE,SAVE :: buff_tmp 1206 LOGICAL :: check = .FALSE. 1207 !--------------------------------------------------------------------- 1238 LOGICAL :: l_dbg 1239 !--------------------------------------------------------------------- 1240 CALL ipsldbg (old_status=l_dbg) 1241 1208 1242 IF (.NOT.ALLOCATED(buff_tmp)) THEN 1209 IF ( check) WRITE(*,*) &1243 IF (l_dbg) WRITE(ipslout,*) & 1210 1244 "flinget_r4d_zoom : allocate buff_tmp for buff_sz = ",SIZE(var) 1211 1245 ALLOCATE (buff_tmp(SIZE(var))) 1212 1246 ELSE IF (SIZE(var) > SIZE(buff_tmp)) THEN 1213 IF ( check) WRITE(*,*) &1247 IF (l_dbg) WRITE(ipslout,*) & 1214 1248 "flinget_r4d_zoom : re-allocate buff_tmp for buff_sz = ",SIZE(var) 1215 1249 DEALLOCATE (buff_tmp) … … 1280 1314 ! ARGUMENTS 1281 1315 !- 1282 INTEGER :: fid_in1283 CHARACTER(LEN=*) :: varname1284 INTEGER :: iim, jjm, llm, ttm1285 INTEGER :: itau_dep, itau_fin, iideb, iilen, jjdeb, jjlen1286 REAL :: var(:)1316 INTEGER, INTENT(IN) :: fid_in 1317 CHARACTER(LEN=*), INTENT(IN) :: varname 1318 INTEGER, INTENT(IN) :: iim, jjm, llm, ttm 1319 INTEGER, INTENT(IN) :: itau_dep, itau_fin, iideb, iilen, jjdeb, jjlen 1320 REAL, INTENT(OUT) :: var(:) 1287 1321 !- 1288 1322 ! LOCAL … … 1300 1334 INTEGER :: i, nvars, i2d, cnd 1301 1335 REAL,DIMENSION(:),ALLOCATABLE,SAVE :: var_tmp 1336 INTEGER :: itau_len 1302 1337 LOGICAL :: uncompress = .FALSE. 1303 LOGICAL :: check = .FALSE. 1304 !--------------------------------------------------------------------- 1338 INTEGER :: il, ip, i2p, it 1339 !- 1340 LOGICAL :: l_dbg 1341 !--------------------------------------------------------------------- 1342 CALL ipsldbg (old_status=l_dbg) 1343 !- 1305 1344 fid = ncids(fid_in) 1306 1345 !- 1307 IF ( check) THEN1308 WRITE( *,*) &1346 IF (l_dbg) THEN 1347 WRITE(ipslout,*) & 1309 1348 'flinget_mat : fid_in, fid, varname :', fid_in, fid, TRIM(varname) 1310 WRITE( *,*) &1349 WRITE(ipslout,*) & 1311 1350 'flinget_mat : iim, jjm, llm, ttm, itau_dep, itau_fin :', & 1312 1351 iim, jjm, llm, ttm, itau_dep, itau_fin 1313 WRITE( *,*) &1352 WRITE(ipslout,*) & 1314 1353 'flinget_mat : iideb, iilen, jjdeb, jjlen :', & 1315 1354 iideb, iilen, jjdeb, jjlen … … 1332 1371 iret = NF90_INQUIRE_VARIABLE (fid, vid, & 1333 1372 ndims=ndims, dimids=dimids, nAtts=nb_atts) 1334 IF ( check) THEN1335 WRITE( *,*) &1373 IF (l_dbg) THEN 1374 WRITE(ipslout,*) & 1336 1375 'flinget_mat : fid, vid :', fid, vid 1337 WRITE( *,*) &1376 WRITE(ipslout,*) & 1338 1377 'flinget_mat : ndims, dimids(1:ndims), nb_atts :', & 1339 1378 ndims, dimids(1:ndims), nb_atts … … 1344 1383 iret = NF90_INQUIRE_DIMENSION (fid, dimids(i), len=w_dim(i)) 1345 1384 ENDDO 1346 IF ( check) WRITE(*,*) &1385 IF (l_dbg) WRITE(ipslout,*) & 1347 1386 'flinget_mat : w_dim :', w_dim(1:ndims) 1348 1387 !- … … 1350 1389 !- 1351 1390 IF (nb_atts > 0) THEN 1352 IF (check) THEN1353 WRITE( *,*) 'flinget_mat : attributes for variable :'1391 IF (l_dbg) THEN 1392 WRITE(ipslout,*) 'flinget_mat : attributes for variable :' 1354 1393 ENDIF 1355 1394 ENDIF … … 1361 1400 .OR.(x_typ == NF90_BYTE) ) THEN 1362 1401 iret = NF90_GET_ATT (fid, vid, att_n, tmp_i) 1363 IF (check) THEN1364 WRITE( *,*) ' ',TRIM(att_n),' : ',tmp_i1402 IF (l_dbg) THEN 1403 WRITE(ipslout,*) ' ',TRIM(att_n),' : ',tmp_i 1365 1404 ENDIF 1366 1405 ELSE IF ( (x_typ == NF90_FLOAT).OR.(x_typ == NF90_DOUBLE) ) THEN 1367 1406 iret = NF90_GET_ATT (fid, vid, att_n, tmp_r) 1368 IF (check) THEN1369 WRITE( *,*) ' ',TRIM(att_n),' : ',tmp_r1407 IF (l_dbg) THEN 1408 WRITE(ipslout,*) ' ',TRIM(att_n),' : ',tmp_r 1370 1409 ENDIF 1371 1410 IF (index(att_n,'missing_value') > 0) THEN … … 1375 1414 tmp_n = '' 1376 1415 iret = NF90_GET_ATT (fid, vid, att_n, tmp_n) 1377 IF (check) THEN1378 WRITE( *,*) ' ',TRIM(att_n),' : ',TRIM(tmp_n)1416 IF (l_dbg) THEN 1417 WRITE(ipslout,*) ' ',TRIM(att_n),' : ',TRIM(tmp_n) 1379 1418 ENDIF 1380 1419 IF (index(att_n,'axis') > 0) THEN … … 1399 1438 iret = NF90_INQ_VARID (fid, tmp_n, cvid) 1400 1439 !--- 1401 IF ( check) WRITE(*,*) &1440 IF (l_dbg) WRITE(ipslout,*) & 1402 1441 'Dimname, iret , NF90_NOERR : ',TRIM(tmp_n),iret,NF90_NOERR 1403 1442 !--- … … 1556 1595 ! 3.0 Reading the data 1557 1596 !- 1558 IF ( check) WRITE(*,*) &1597 IF (l_dbg) WRITE(ipslout,*) & 1559 1598 'flinget_mat 3.0 : ', uncompress, w_sta, w_len 1560 1599 !--- 1600 var(:) = mis_v 1561 1601 IF (uncompress) THEN 1562 1602 !--- 1563 1603 IF (ALLOCATED(var_tmp)) THEN 1564 IF (SIZE(var_tmp) < clen) THEN1565 DEALLOCATE(var_tmp)1566 ALLOCATE(var_tmp(clen))1604 IF (SIZE(var_tmp) < PRODUCT(w_len(:),mask=(w_len>1))) THEN 1605 DEALLOCATE(var_tmp) 1606 ALLOCATE(var_tmp(PRODUCT(w_len(:),mask=(w_len>1)))) 1567 1607 ENDIF 1568 1608 ELSE 1569 ALLOCATE(var_tmp( clen))1609 ALLOCATE(var_tmp(PRODUCT(w_len(:),mask=(w_len>1)))) 1570 1610 ENDIF 1571 1611 !--- … … 1573 1613 start=w_sta(:), count=w_len(:)) 1574 1614 !--- 1615 itau_len=itau_fin-itau_dep+1 1616 IF (l_dbg) WRITE(ipslout,*) 'flinget_mat 3.0 : clen, itau_len ',clen,itau_len 1575 1617 var(:) = mis_v 1576 var(cindex(:)) = var_tmp(:) 1618 IF (itau_len > 0) THEN 1619 DO it=1,itau_len 1620 DO il=1,clen 1621 ip = il + (it-1)*clen 1622 i2p = cindex(il)+(it-1)*iim*jjm 1623 var(i2p) = var_tmp(ip) 1624 ENDDO 1625 ENDDO 1626 ELSE 1627 var(cindex(:)) = var_tmp(:) 1628 ENDIF 1577 1629 !--- 1578 1630 ELSE … … 1581 1633 ENDIF 1582 1634 !- 1583 IF ( check) WRITE(*,*) 'flinget_mat 3.1 : ',NF90_STRERROR (iret)1635 IF (l_dbg) WRITE(ipslout,*) 'flinget_mat 3.1 : ',NF90_STRERROR (iret) 1584 1636 !-------------------------- 1585 1637 END SUBROUTINE flinget_mat … … 1627 1679 ! LOCAL 1628 1680 !- 1629 INTEGER :: iret, fid 1630 !- 1631 LOGICAL :: check = .FALSE. 1632 !--------------------------------------------------------------------- 1633 IF (check) THEN 1634 WRITE (*,*) 'flinget_scal in file with id ',fid_in 1681 INTEGER :: iret, fid, vid 1682 INTEGER :: attlen, attnum 1683 INTEGER :: ndims, nb_atts 1684 INTEGER,DIMENSION(NF90_MAX_VAR_DIMS) :: dimids 1685 LOGICAL :: var_exists 1686 !- 1687 LOGICAL :: l_dbg 1688 INTEGER :: lll 1689 !--------------------------------------------------------------------- 1690 CALL ipsldbg (old_status=l_dbg) 1691 1692 IF (l_dbg) THEN 1693 WRITE (ipslout,*) 'flinget_scal in file with id ',fid_in 1635 1694 ENDIF 1636 1695 !- 1637 1696 fid = ncids(fid_in) 1697 iret = NF90_INQUIRE_ATTRIBUTE(fid, NF90_GLOBAL, varname, len=attlen, attnum=attnum) 1638 1698 !- 1639 1699 ! 1.0 Reading a global attribute 1640 1700 !- 1641 iret = NF90_GET_ATT (fid, NF90_GLOBAL, varname, var) 1701 IF ( iret == nf90_noerr ) THEN 1702 ! 1703 ! This seems to be a Global attribute 1704 ! 1705 iret = NF90_GET_ATT (fid, NF90_GLOBAL, varname, var) 1706 ELSE 1707 ! 1708 ! If there was an error on the test for a global attribute it 1709 ! is perhaps a scalar variable. 1710 ! 1711 vid = -1 1712 iret = NF90_INQ_VARID (fid, varname, vid) 1713 ! 1714 IF ( (vid >= 0).AND.(iret == NF90_NOERR) ) THEN 1715 iret = NF90_INQUIRE_VARIABLE (fid, vid, & 1716 ndims=ndims, dimids=dimids, nAtts=nb_atts) 1717 IF (ndims == 1) THEN 1718 iret = NF90_INQUIRE_DIMENSION (fid, dimids(1), len=lll) 1719 ENDIF 1720 1721 IF ( ((ndims == 0) .OR. ((ndims == 1).AND.(lll == 1))) .AND. (nb_atts >= 0) ) THEN 1722 iret = NF90_GET_VAR(fid, vid, var) 1723 ELSE 1724 CALL histerr (3,'flinget_scal', & 1725 'The variable has coordinates and thus is probably not a scalar.', & 1726 'Check your netCDF file.', " ") 1727 ENDIF 1728 ENDIF 1729 IF (l_dbg) THEN 1730 WRITE(ipslout,*) "Reading a Scalar value for varibale ", varname," It has value ", var 1731 ENDIF 1732 ENDIF 1733 !- 1642 1734 !--------------------------- 1643 1735 END SUBROUTINE flinget_scal … … 1891 1983 WRITE (*,*) 'Dimension Z size : ',llm 1892 1984 ELSE IF ( (INDEX(axname,'tstep') == 1) & 1985 .OR.(INDEX(axname,'time') == 1) & 1893 1986 .OR.(INDEX(axname,'time_counter') == 1)) THEN 1894 1987 !---- For the time we certainly need to allow for other names -
dynamico_lmdz/aquaplanet/IOIPSL/src/fliocom.f90
r3847 r3907 1 1 MODULE fliocom 2 2 !- 3 !$Id: fliocom.f90 965 2010-04-07 08:38:54Z bellier$3 !$Id: fliocom.f90 2311 2014-08-04 13:52:44Z mafoipsl $ 4 4 !- 5 5 ! This software is governed by the CeCILL license … … 11 11 USE calendar, ONLY : lock_calendar,ioget_calendar, & 12 12 & ioconf_calendar,ju2ymds,ymds2ju 13 USE errioipsl, ONLY : ipslerr,ipsldbg 13 USE errioipsl, ONLY : ipslerr,ipsldbg, ipslout 14 14 USE stringop, ONLY : strlowercase,str_xfw 15 15 !- … … 49 49 !!-------------------------------------------------------------------- 50 50 INTEGER,PARAMETER,PUBLIC :: & 51 & flio_max_files=100, flio_max_dims=1 0, flio_max_var_dims=551 & flio_max_files=100, flio_max_dims=15, flio_max_var_dims=5 52 52 INTEGER,PARAMETER,PUBLIC :: & 53 53 & flio_i = -1, flio_r = -2, flio_c =nf90_char, & … … 867 867 !- 868 868 IF (l_dbg) THEN 869 WRITE( *,*) "->fliocrfd - file name : ",TRIM(f_n)869 WRITE(ipslout,*) "->fliocrfd - file name : ",TRIM(f_n) 870 870 ENDIF 871 871 !- … … 990 990 !- 991 991 IF (l_dbg) THEN 992 WRITE( *,*) ' fliocrfd, external model file-id : ',f_e992 WRITE(ipslout,*) ' fliocrfd, external model file-id : ',f_e 993 993 ENDIF 994 994 !- … … 1040 1040 !- 1041 1041 IF (l_dbg) THEN 1042 WRITE( *,*) '<-fliocrfd'1042 WRITE(ipslout,*) '<-fliocrfd' 1043 1043 ENDIF 1044 1044 !---------------------- … … 1074 1074 !- 1075 1075 IF (l_dbg) THEN 1076 WRITE( *,*) "->fliopstc"1076 WRITE(ipslout,*) "->fliopstc" 1077 1077 ENDIF 1078 1078 !- … … 1100 1100 !--- 1101 1101 IF (l_dbg) THEN 1102 WRITE( *,*) ' fliopstc : Define the Longitude axis'1102 WRITE(ipslout,*) ' fliopstc : Define the Longitude axis' 1103 1103 ENDIF 1104 1104 !--- … … 1144 1144 !--- 1145 1145 IF (l_dbg) THEN 1146 WRITE( *,*) ' fliopstc : Define the Latitude axis'1146 WRITE(ipslout,*) ' fliopstc : Define the Latitude axis' 1147 1147 ENDIF 1148 1148 !--- … … 1188 1188 !--- 1189 1189 IF (l_dbg) THEN 1190 WRITE( *,*) ' fliopstc : Define the Vertical axis'1190 WRITE(ipslout,*) ' fliopstc : Define the Vertical axis' 1191 1191 ENDIF 1192 1192 !--- … … 1219 1219 !--- 1220 1220 IF (l_dbg) THEN 1221 WRITE( *,*) ' fliopstc : Define the Time axis'1221 WRITE(ipslout,*) ' fliopstc : Define the Time axis' 1222 1222 ENDIF 1223 1223 !--- … … 1317 1317 IF (PRESENT(x_axis).OR.PRESENT(x_axis_2d)) THEN 1318 1318 IF (l_dbg) THEN 1319 WRITE( *,*) ' fliopstc : Create the Longitude axis'1319 WRITE(ipslout,*) ' fliopstc : Create the Longitude axis' 1320 1320 ENDIF 1321 1321 IF (PRESENT(x_axis)) THEN … … 1330 1330 IF (PRESENT(y_axis).OR.PRESENT(y_axis_2d)) THEN 1331 1331 IF (l_dbg) THEN 1332 WRITE( *,*) ' fliopstc : Create the Latitude axis'1332 WRITE(ipslout,*) ' fliopstc : Create the Latitude axis' 1333 1333 ENDIF 1334 1334 IF (PRESENT(y_axis)) THEN … … 1343 1343 IF (PRESENT(z_axis)) THEN 1344 1344 IF (l_dbg) THEN 1345 WRITE( *,*) ' fliopstc : Create the Vertical axis'1345 WRITE(ipslout,*) ' fliopstc : Create the Vertical axis' 1346 1346 ENDIF 1347 1347 i_rc = NF90_PUT_VAR(f_e,levid,z_axis(:)) … … 1352 1352 IF (PRESENT(t_axis)) THEN 1353 1353 IF (l_dbg) THEN 1354 WRITE( *,*) ' fliopstc : Create the Time axis'1354 WRITE(ipslout,*) ' fliopstc : Create the Time axis' 1355 1355 ENDIF 1356 1356 i_rc = NF90_PUT_VAR(f_e,timeid,REAL(t_axis(:))) … … 1362 1362 !- 1363 1363 IF (l_dbg) THEN 1364 WRITE( *,*) "<-fliopstc"1364 WRITE(ipslout,*) "<-fliopstc" 1365 1365 ENDIF 1366 1366 !---------------------- … … 1428 1428 !- 1429 1429 IF (l_dbg) THEN 1430 WRITE( *,*) "->fliodefv ",TRIM(v_n)," ",n_d,"D"1430 WRITE(ipslout,*) "->fliodefv ",TRIM(v_n)," ",n_d,"D" 1431 1431 ENDIF 1432 1432 !- … … 1567 1567 !- 1568 1568 IF (l_dbg) THEN 1569 WRITE( *,*) "<-fliodefv"1569 WRITE(ipslout,*) "<-fliodefv" 1570 1570 ENDIF 1571 1571 !---------------------- … … 2048 2048 ELSE IF (PRESENT(r_85)) THEN; cvr_d = "R8 5D"; 2049 2049 ENDIF 2050 WRITE( *,*) "->flioputv ",TRIM(v_n)," ",TRIM(cvr_d)2050 WRITE(ipslout,*) "->flioputv ",TRIM(v_n)," ",TRIM(cvr_d) 2051 2051 ENDIF 2052 2052 !- … … 2131 2131 !- 2132 2132 IF (l_dbg) THEN 2133 WRITE( *,*) "<-flioputv"2133 WRITE(ipslout,*) "<-flioputv" 2134 2134 ENDIF 2135 2135 !---------------------- … … 2238 2238 !- 2239 2239 IF (l_dbg) THEN 2240 WRITE( *,*) "->flioputa ",TRIM(v_n)," ",TRIM(a_n)2240 WRITE(ipslout,*) "->flioputa ",TRIM(v_n)," ",TRIM(a_n) 2241 2241 ENDIF 2242 2242 !- … … 2270 2270 !- 2271 2271 IF (l_dbg) THEN 2272 WRITE( *,*) "<-flioputa"2272 WRITE(ipslout,*) "<-flioputa" 2273 2273 ENDIF 2274 2274 !---------------------- … … 2291 2291 !- 2292 2292 IF (l_dbg) THEN 2293 WRITE( *,*) '->flioopfd, file name : ',TRIM(f_n)2293 WRITE(ipslout,*) '->flioopfd, file name : ',TRIM(f_n) 2294 2294 ENDIF 2295 2295 !- … … 2325 2325 !- 2326 2326 IF (l_dbg) THEN 2327 WRITE( *,*) ' flioopfd, model file-id : ',f_e2327 WRITE(ipslout,*) ' flioopfd, model file-id : ',f_e 2328 2328 ENDIF 2329 2329 !- … … 2350 2350 !- 2351 2351 IF (l_dbg) THEN 2352 WRITE( *,'(" flioopfd - dimensions :",/,(5(1X,I10),:))') &2352 WRITE(ipslout,'(" flioopfd - dimensions :",/,(5(1X,I10),:))') & 2353 2353 & nw_dl(:,f_i) 2354 WRITE( *,*) "<-flioopfd"2354 WRITE(ipslout,*) "<-flioopfd" 2355 2355 ENDIF 2356 2356 !---------------------- … … 2373 2373 !- 2374 2374 IF (l_dbg) THEN 2375 WRITE( *,*) "->flioinqf"2375 WRITE(ipslout,*) "->flioinqf" 2376 2376 ENDIF 2377 2377 !- … … 2418 2418 !- 2419 2419 IF (l_dbg) THEN 2420 WRITE( *,*) "<-flioinqf"2420 WRITE(ipslout,*) "<-flioinqf" 2421 2421 ENDIF 2422 2422 !---------------------- … … 2445 2445 !- 2446 2446 IF (l_dbg) THEN 2447 WRITE( *,*) "->flioinqn"2447 WRITE(ipslout,*) "->flioinqn" 2448 2448 ENDIF 2449 2449 !- … … 2622 2622 !- 2623 2623 IF (l_dbg) THEN 2624 WRITE( *,*) "<-flioinqn"2624 WRITE(ipslout,*) "<-flioinqn" 2625 2625 ENDIF 2626 2626 !---------------------- … … 2662 2662 !- 2663 2663 IF (l_dbg) THEN 2664 WRITE( *,*) "->fliogstc"2664 WRITE(ipslout,*) "->fliogstc" 2665 2665 ENDIF 2666 2666 !- … … 2702 2702 !- 2703 2703 IF (l_dbg) THEN 2704 WRITE( *,'(" fliogstc - dimensions :",/,(5(1X,I10),:))') &2704 WRITE(ipslout,'(" fliogstc - dimensions :",/,(5(1X,I10),:))') & 2705 2705 & m_x,m_y,m_z,m_t 2706 2706 ENDIF … … 2932 2932 !--- 2933 2933 IF (l_dbg) THEN 2934 WRITE( *,*) ' fliogstc - get time details'2934 WRITE(ipslout,*) ' fliogstc - get time details' 2935 2935 ENDIF 2936 2936 !--- … … 2977 2977 !--- 2978 2978 IF (l_dbg) THEN 2979 WRITE( *,*) ' fliogstc - first time : ',t_axis(1:1)2979 WRITE(ipslout,*) ' fliogstc - first time : ',t_axis(1:1) 2980 2980 ENDIF 2981 2981 ENDIF … … 3015 3015 CALL lock_calendar (new_status=l_tmp) 3016 3016 IF (l_dbg) THEN 3017 WRITE( *,*) ' fliogstc - time_type : '3018 WRITE( *,*) it_t3019 WRITE( *,*) ' fliogstc - year month day second t_init : '3020 WRITE( *,*) j_yy,j_mo,j_dd,r_ss,t_init3017 WRITE(ipslout,*) ' fliogstc - time_type : ' 3018 WRITE(ipslout,*) it_t 3019 WRITE(ipslout,*) ' fliogstc - year month day second t_init : ' 3020 WRITE(ipslout,*) j_yy,j_mo,j_dd,r_ss,t_init 3021 3021 ENDIF 3022 3022 ENDIF … … 3080 3080 !- 3081 3081 IF (l_dbg) THEN 3082 WRITE( *,*) "<-fliogstc"3082 WRITE(ipslout,*) "<-fliogstc" 3083 3083 ENDIF 3084 3084 !---------------------- … … 3108 3108 !- 3109 3109 IF (l_dbg) THEN 3110 WRITE( *,*) "->flioinqv ",TRIM(v_n)3110 WRITE(ipslout,*) "->flioinqv ",TRIM(v_n) 3111 3111 ENDIF 3112 3112 !- … … 3221 3221 !- 3222 3222 IF (l_dbg) THEN 3223 WRITE( *,*) "<-flioinqv"3223 WRITE(ipslout,*) "<-flioinqv" 3224 3224 ENDIF 3225 3225 !---------------------- … … 3702 3702 ELSE IF (PRESENT(r_85)) THEN; cvr_d = "R8 5D"; 3703 3703 ENDIF 3704 WRITE( *,*) "->fliogetv ",TRIM(v_n)," ",TRIM(cvr_d)3704 WRITE(ipslout,*) "->fliogetv ",TRIM(v_n)," ",TRIM(cvr_d) 3705 3705 ENDIF 3706 3706 !- … … 3785 3785 !- 3786 3786 IF (l_dbg) THEN 3787 WRITE( *,*) "<-fliogetv"3787 WRITE(ipslout,*) "<-fliogetv" 3788 3788 ENDIF 3789 3789 !---------------------- … … 3806 3806 !- 3807 3807 IF (l_dbg) THEN 3808 WRITE( *,*) "->flioinqa ",TRIM(v_n),"-",TRIM(a_n)3808 WRITE(ipslout,*) "->flioinqa ",TRIM(v_n),"-",TRIM(a_n) 3809 3809 ENDIF 3810 3810 !- … … 3836 3836 !- 3837 3837 IF (l_dbg) THEN 3838 WRITE( *,*) "<-flioinqa"3838 WRITE(ipslout,*) "<-flioinqa" 3839 3839 ENDIF 3840 3840 !---------------------- … … 3948 3948 !- 3949 3949 IF (l_dbg) THEN 3950 WRITE( *,*) "->fliogeta ",TRIM(v_n)," ",TRIM(a_n)3950 WRITE(ipslout,*) "->fliogeta ",TRIM(v_n)," ",TRIM(a_n) 3951 3951 ENDIF 3952 3952 !- … … 4012 4012 !- 4013 4013 IF (l_dbg) THEN 4014 WRITE( *,*) "<-fliogeta"4014 WRITE(ipslout,*) "<-fliogeta" 4015 4015 ENDIF 4016 4016 !---------------------- … … 4031 4031 !- 4032 4032 IF (l_dbg) THEN 4033 WRITE( *,*) &4033 WRITE(ipslout,*) & 4034 4034 & "->fliorenv ",TRIM(v_o_n),"->",TRIM(v_n_n) 4035 4035 ENDIF … … 4052 4052 !- 4053 4053 IF (l_dbg) THEN 4054 WRITE( *,*) "<-fliorenv"4054 WRITE(ipslout,*) "<-fliorenv" 4055 4055 ENDIF 4056 4056 !---------------------- … … 4071 4071 !- 4072 4072 IF (l_dbg) THEN 4073 WRITE( *,*) &4073 WRITE(ipslout,*) & 4074 4074 & "->fliorena ",TRIM(v_n),"-",TRIM(a_o_n),"->",TRIM(a_n_n) 4075 4075 ENDIF … … 4102 4102 !- 4103 4103 IF (l_dbg) THEN 4104 WRITE( *,*) "<-fliorena"4104 WRITE(ipslout,*) "<-fliorena" 4105 4105 ENDIF 4106 4106 !---------------------- … … 4121 4121 !- 4122 4122 IF (l_dbg) THEN 4123 WRITE( *,*) "->fliodela ",TRIM(v_n),"-",TRIM(a_n)4123 WRITE(ipslout,*) "->fliodela ",TRIM(v_n),"-",TRIM(a_n) 4124 4124 ENDIF 4125 4125 !- … … 4150 4150 !- 4151 4151 IF (l_dbg) THEN 4152 WRITE( *,*) "<-fliodela"4152 WRITE(ipslout,*) "<-fliodela" 4153 4153 ENDIF 4154 4154 !---------------------- … … 4169 4169 !- 4170 4170 IF (l_dbg) THEN 4171 WRITE( *,*) "->fliocpya - file",f_i_i,"-",TRIM(v_n_i),"-",TRIM(a_n)4172 WRITE( *,*) " copied to file ",f_i_o,"-",TRIM(v_n_o)4171 WRITE(ipslout,*) "->fliocpya - file",f_i_i,"-",TRIM(v_n_i),"-",TRIM(a_n) 4172 WRITE(ipslout,*) " copied to file ",f_i_o,"-",TRIM(v_n_o) 4173 4173 ENDIF 4174 4174 !- … … 4216 4216 !- 4217 4217 IF (l_dbg) THEN 4218 WRITE( *,*) "<-fliocpya"4218 WRITE(ipslout,*) "<-fliocpya" 4219 4219 ENDIF 4220 4220 !---------------------- … … 4238 4238 !- 4239 4239 IF (l_dbg) THEN 4240 WRITE( *,*) "->flioqstc ",TRIM(c_type)4240 WRITE(ipslout,*) "->flioqstc ",TRIM(c_type) 4241 4241 ENDIF 4242 4242 !- … … 4260 4260 !- 4261 4261 IF (l_dbg) THEN 4262 WRITE( *,*) "<-flioqstc"4262 WRITE(ipslout,*) "<-flioqstc" 4263 4263 ENDIF 4264 4264 !---------------------- … … 4276 4276 !- 4277 4277 IF (l_dbg) THEN 4278 WRITE( *,*) "->fliosync"4278 WRITE(ipslout,*) "->fliosync" 4279 4279 ENDIF 4280 4280 !- … … 4302 4302 IF (f_e > 0) THEN 4303 4303 IF (l_dbg) THEN 4304 WRITE( *,*) ' fliosync - synchronising file number ',i_f4304 WRITE(ipslout,*) ' fliosync - synchronising file number ',i_f 4305 4305 ENDIF 4306 4306 i_rc = NF90_SYNC(f_e) … … 4312 4312 !- 4313 4313 IF (l_dbg) THEN 4314 WRITE( *,*) "<-fliosync"4314 WRITE(ipslout,*) "<-fliosync" 4315 4315 ENDIF 4316 4316 !---------------------- … … 4328 4328 !- 4329 4329 IF (l_dbg) THEN 4330 WRITE( *,*) "->flioclo"4330 WRITE(ipslout,*) "->flioclo" 4331 4331 ENDIF 4332 4332 !- … … 4350 4350 IF (f_e > 0) THEN 4351 4351 IF (l_dbg) THEN 4352 WRITE( *,*) ' flioclo - closing file number ',i_f4352 WRITE(ipslout,*) ' flioclo - closing file number ',i_f 4353 4353 ENDIF 4354 4354 i_rc = NF90_CLOSE(f_e) 4355 !- error case added : explicit the message and stop with a fatal error 4356 IF (i_rc /= NF90_NOERR) THEN 4357 CALL ipslerr (3,'flioclo', & 4358 & 'Could not close file','Try again and contact your local administrator ', & 4359 & TRIM(NF90_STRERROR(i_rc))//' (Netcdf)') 4360 ENDIF 4355 4361 nw_id(i_f) = -1 4356 4362 ELSE IF (PRESENT(f_i)) THEN … … 4361 4367 !- 4362 4368 IF (l_dbg) THEN 4363 WRITE( *,*) "<-flioclo"4369 WRITE(ipslout,*) "<-flioclo" 4364 4370 ENDIF 4365 4371 !--------------------- … … 4392 4398 ENDIF 4393 4399 !- 4394 WRITE ( *,*) "---"4395 WRITE ( *,*) "--- File '",TRIM(f_n),"'"4396 WRITE ( *,*) "---"4400 WRITE (ipslout,*) "---" 4401 WRITE (ipslout,*) "--- File '",TRIM(f_n),"'" 4402 WRITE (ipslout,*) "---" 4397 4403 !- 4398 4404 CALL flio_inf & … … 4401 4407 & nn_idm=n_idim,nn_ldm=n_ldim,cc_ndm=c_ndim,nn_aid=n_ai) 4402 4408 !- 4403 WRITE ( *,*) 'External model identifier : ',f_e4404 WRITE ( *,*) 'Number of dimensions : ',n_dims4405 WRITE ( *,*) 'Number of variables : ',n_vars4406 WRITE ( *,*) 'ID unlimited : ',i_unlm4407 !- 4408 WRITE ( *,*) "---"4409 WRITE ( *,*) 'Presumed axis dimensions identifiers :'4409 WRITE (ipslout,*) 'External model identifier : ',f_e 4410 WRITE (ipslout,*) 'Number of dimensions : ',n_dims 4411 WRITE (ipslout,*) 'Number of variables : ',n_vars 4412 WRITE (ipslout,*) 'ID unlimited : ',i_unlm 4413 !- 4414 WRITE (ipslout,*) "---" 4415 WRITE (ipslout,*) 'Presumed axis dimensions identifiers :' 4410 4416 IF (n_ai(k_lon) > 0) THEN 4411 WRITE ( *,*) 'x axis : ',n_ai(k_lon)4417 WRITE (ipslout,*) 'x axis : ',n_ai(k_lon) 4412 4418 ELSE 4413 WRITE ( *,*) 'x axis : NONE'4419 WRITE (ipslout,*) 'x axis : NONE' 4414 4420 ENDIF 4415 4421 IF (n_ai(k_lat) > 0) THEN 4416 WRITE ( *,*) 'y axis : ',n_ai(k_lat)4422 WRITE (ipslout,*) 'y axis : ',n_ai(k_lat) 4417 4423 ELSE 4418 WRITE ( *,*) 'y axis : NONE'4424 WRITE (ipslout,*) 'y axis : NONE' 4419 4425 ENDIF 4420 4426 IF (n_ai(k_lev) > 0) THEN 4421 WRITE ( *,*) 'z axis : ',n_ai(k_lev)4427 WRITE (ipslout,*) 'z axis : ',n_ai(k_lev) 4422 4428 ELSE 4423 WRITE ( *,*) 'z axis : NONE'4429 WRITE (ipslout,*) 'z axis : NONE' 4424 4430 ENDIF 4425 4431 IF (n_ai(k_tim) > 0) THEN 4426 WRITE ( *,*) 't axis : ',n_ai(k_tim)4432 WRITE (ipslout,*) 't axis : ',n_ai(k_tim) 4427 4433 ELSE 4428 WRITE ( *,*) 't axis : NONE'4429 ENDIF 4430 !- 4431 WRITE ( *,*) "---"4432 WRITE ( *,*) 'Number of global attributes : ',n_atts4434 WRITE (ipslout,*) 't axis : NONE' 4435 ENDIF 4436 !- 4437 WRITE (ipslout,*) "---" 4438 WRITE (ipslout,*) 'Number of global attributes : ',n_atts 4433 4439 DO k_n=1,n_atts 4434 4440 i_rc = NF90_INQ_ATTNAME(f_e,NF90_GLOBAL,k_n,c_name) … … 4440 4446 ALLOCATE(tma_i(l_ea)) 4441 4447 i_rc = NF90_GET_ATT(f_e,NF90_GLOBAL,c_name,tma_i) 4442 WRITE ( *,'(" ",A," :",/,(5(1X,I10),:))') &4448 WRITE (ipslout,'(" ",A," :",/,(5(1X,I10),:))') & 4443 4449 & TRIM(c_name),tma_i(1:l_ea) 4444 4450 DEALLOCATE(tma_i) 4445 4451 ELSE 4446 4452 i_rc = NF90_GET_ATT(f_e,NF90_GLOBAL,c_name,tmp_i) 4447 WRITE( *,*) ' ',TRIM(c_name),' : ',tmp_i4453 WRITE(ipslout,*) ' ',TRIM(c_name),' : ',tmp_i 4448 4454 ENDIF 4449 4455 ELSE IF ( (t_ea == NF90_REAL4).OR.(t_ea == NF90_REAL8) ) THEN … … 4451 4457 ALLOCATE(tma_r(l_ea)) 4452 4458 i_rc = NF90_GET_ATT(f_e,NF90_GLOBAL,c_name,tma_r) 4453 WRITE ( *,'(" ",A," :",/,(5(1X,1PE11.3),:))') &4459 WRITE (ipslout,'(" ",A," :",/,(5(1X,1PE11.3),:))') & 4454 4460 & TRIM(c_name),tma_r(1:l_ea) 4455 4461 DEALLOCATE(tma_r) 4456 4462 ELSE 4457 4463 i_rc = NF90_GET_ATT(f_e,NF90_GLOBAL,c_name,tmp_r) 4458 WRITE( *,*) ' ',TRIM(c_name),' : ',tmp_r4464 WRITE(ipslout,*) ' ',TRIM(c_name),' : ',tmp_r 4459 4465 ENDIF 4460 4466 ELSE 4461 4467 tmp_c = '' 4462 4468 i_rc = NF90_GET_ATT(f_e,NF90_GLOBAL,c_name,tmp_c) 4463 WRITE( *,*) ' ',TRIM(c_name),' : "',TRIM(tmp_c),'"'4469 WRITE(ipslout,*) ' ',TRIM(c_name),' : "',TRIM(tmp_c),'"' 4464 4470 ENDIF 4465 4471 ENDDO … … 4467 4473 DO i_n=1,nb_fd_mx 4468 4474 IF (n_idim(i_n) > 0) THEN 4469 WRITE ( *,*) "---"4470 WRITE ( *,*) 'Dimension id : ',n_idim(i_n)4471 WRITE ( *,*) 'Dimension name : ',TRIM(c_ndim(i_n))4472 WRITE ( *,*) 'Dimension size : ',n_ldim(i_n)4475 WRITE (ipslout,*) "---" 4476 WRITE (ipslout,*) 'Dimension id : ',n_idim(i_n) 4477 WRITE (ipslout,*) 'Dimension name : ',TRIM(c_ndim(i_n)) 4478 WRITE (ipslout,*) 'Dimension size : ',n_ldim(i_n) 4473 4479 ENDIF 4474 4480 ENDDO … … 4477 4483 i_rc = NF90_INQUIRE_VARIABLE(f_e,i_n, & 4478 4484 & name=c_name,ndims=n_dims,dimids=idimid,nAtts=n_atts) 4479 WRITE ( *,*) "---"4480 WRITE ( *,*) "Variable name : ",TRIM(c_name)4481 WRITE ( *,*) "Variable identifier : ",i_n4482 WRITE ( *,*) "Number of dimensions : ",n_dims4485 WRITE (ipslout,*) "---" 4486 WRITE (ipslout,*) "Variable name : ",TRIM(c_name) 4487 WRITE (ipslout,*) "Variable identifier : ",i_n 4488 WRITE (ipslout,*) "Number of dimensions : ",n_dims 4483 4489 IF (n_dims > 0) THEN 4484 WRITE ( *,*) "Dimensions ID's : ",idimid(1:n_dims)4485 ENDIF 4486 WRITE ( *,*) "Number of attributes : ",n_atts4490 WRITE (ipslout,*) "Dimensions ID's : ",idimid(1:n_dims) 4491 ENDIF 4492 WRITE (ipslout,*) "Number of attributes : ",n_atts 4487 4493 DO k_n=1,n_atts 4488 4494 i_rc = NF90_INQ_ATTNAME(f_e,i_n,k_n,c_name) … … 4494 4500 ALLOCATE(tma_i(l_ea)) 4495 4501 i_rc = NF90_GET_ATT(f_e,i_n,c_name,tma_i) 4496 WRITE ( *,'(" ",A," :",/,(5(1X,I10),:))') &4502 WRITE (ipslout,'(" ",A," :",/,(5(1X,I10),:))') & 4497 4503 & TRIM(c_name),tma_i(1:l_ea) 4498 4504 DEALLOCATE(tma_i) 4499 4505 ELSE 4500 4506 i_rc = NF90_GET_ATT(f_e,i_n,c_name,tmp_i) 4501 WRITE( *,*) ' ',TRIM(c_name),' : ',tmp_i4507 WRITE(ipslout,*) ' ',TRIM(c_name),' : ',tmp_i 4502 4508 ENDIF 4503 4509 ELSE IF ( (t_ea == NF90_REAL4).OR.(t_ea == NF90_REAL8) ) THEN … … 4505 4511 ALLOCATE(tma_r(l_ea)) 4506 4512 i_rc = NF90_GET_ATT(f_e,i_n,c_name,tma_r) 4507 WRITE ( *,'(" ",A," :",/,(5(1X,1PE11.3),:))') &4513 WRITE (ipslout,'(" ",A," :",/,(5(1X,1PE11.3),:))') & 4508 4514 & TRIM(c_name),tma_r(1:l_ea) 4509 4515 DEALLOCATE(tma_r) 4510 4516 ELSE 4511 4517 i_rc = NF90_GET_ATT(f_e,i_n,c_name,tmp_r) 4512 WRITE( *,*) ' ',TRIM(c_name),' : ',tmp_r4518 WRITE(ipslout,*) ' ',TRIM(c_name),' : ',tmp_r 4513 4519 ENDIF 4514 4520 ELSE 4515 4521 tmp_c = '' 4516 4522 i_rc = NF90_GET_ATT(f_e,i_n,c_name,tmp_c) 4517 WRITE( *,*) ' ',TRIM(c_name),' : "',TRIM(tmp_c),'"'4523 WRITE(ipslout,*) ' ',TRIM(c_name),' : "',TRIM(tmp_c),'"' 4518 4524 ENDIF 4519 4525 ENDDO 4520 4526 ENDDO 4521 WRITE ( *,*) "---"4527 WRITE (ipslout,*) "---" 4522 4528 !- 4523 4529 i_rc = NF90_CLOSE(f_e) … … 4937 4943 !- 4938 4944 IF (l_dbg) THEN 4939 WRITE( *,*) "->flio_inf"4945 WRITE(ipslout,*) "->flio_inf" 4940 4946 ENDIF 4941 4947 !- … … 4960 4966 !--- 4961 4967 IF (l_dbg) THEN 4962 WRITE( *,*) " flio_inf ",kv,ml," ",TRIM(f_d_n)4968 WRITE(ipslout,*) " flio_inf ",kv,ml," ",TRIM(f_d_n) 4963 4969 ENDIF 4964 4970 !--- … … 5005 5011 !- 5006 5012 IF (l_dbg) THEN 5007 WRITE( *,*) "<-flio_inf"5013 WRITE(ipslout,*) "<-flio_inf" 5008 5014 ENDIF 5009 5015 !---------------------- -
dynamico_lmdz/aquaplanet/IOIPSL/src/getincom.f90
r3847 r3907 1 1 MODULE getincom 2 2 !- 3 !$Id: getincom.f90 963 2010-03-31 15:26:11Z bellier$3 !$Id: getincom.f90 1574 2011-11-10 08:21:23Z mmaipsl $ 4 4 !- 5 5 ! This software is governed by the CeCILL license 6 6 ! See IOIPSL/IOIPSL_License_CeCILL.txt 7 7 !--------------------------------------------------------------------- 8 USE errioipsl, ONLY : ipslerr 8 USE errioipsl, ONLY : ipslerr,ipsldbg,ipslout 9 9 USE stringop, & 10 10 & ONLY : nocomma,cmpblank,strlowercase … … 13 13 !- 14 14 PRIVATE 15 PUBLIC :: getin_name, getin, getin_dump 15 PUBLIC :: getin_name, getin, getin_dump, getin_dump_para 16 16 !- 17 17 !!-------------------------------------------------------------------- … … 35 35 !! and if not we get it from the definition file. 36 36 !! 37 !! SUBROUTINE getin (target ,ret_val)37 !! SUBROUTINE getin (targetname,ret_val) 38 38 !! 39 39 !! INPUT 40 40 !! 41 !! (C) target : Name of the variable41 !! (C) targetname : Name of the variable 42 42 !! 43 43 !! OUTPUT … … 67 67 !!-------------------------------------------------------------------- 68 68 !- 69 !!------------------------------------------------------------------------ 70 !! Parallel version of getin_dump : user must give a fileprefix and a rank. 71 !! It may be usefull to verify that only the root proc is reading the input 72 !! def files. 73 !! 74 !! SUBROUTINE getin_dump_para (fileprefix,rank) 75 !! 76 !! INPUT argument 77 !! 78 !! (C) fileprefix : allows the user to change the name of the file 79 !! in which the data will be archived 80 !! (I) rank : the rank of the parallel process (only 0-999 files will be created) 81 !!-------------------------------------------------------------------- 82 !- 69 83 INTEGER,PARAMETER :: max_files=100 70 84 CHARACTER(LEN=100),DIMENSION(max_files),SAVE :: filelist … … 98 112 ! keystatus = 2 : Default value is used 99 113 ! keystatus = 3 : Some vector elements were taken from default 114 INTEGER,PARAMETER :: nondefault=1, default=2, vectornondefault=3 100 115 !- 101 116 ! keytype definition … … 150 165 !=== INTEGER INTERFACE 151 166 !- 152 SUBROUTINE getinis (target ,ret_val)153 !--------------------------------------------------------------------- 154 IMPLICIT NONE 155 !- 156 CHARACTER(LEN=*) :: target 167 SUBROUTINE getinis (targetname,ret_val) 168 !--------------------------------------------------------------------- 169 IMPLICIT NONE 170 !- 171 CHARACTER(LEN=*) :: targetname 157 172 INTEGER :: ret_val 158 173 !- 159 174 INTEGER,DIMENSION(1) :: tmp_ret_val 160 INTEGER :: pos,status=0,fileorig 161 !--------------------------------------------------------------------- 162 !- 163 ! Do we have this target in our database ?164 !- 165 CALL get_findkey (1,target ,pos)175 INTEGER :: pos,status=0,fileorig, size_of_in 176 !--------------------------------------------------------------------- 177 !- 178 ! Do we have this targetname in our database ? 179 !- 180 CALL get_findkey (1,targetname,pos) 166 181 !- 167 182 tmp_ret_val(1) = ret_val 183 size_of_in = SIZE(tmp_ret_val) 184 168 185 !- 169 186 IF (pos < 0) THEN 170 187 !-- Get the information out of the file 171 CALL get_fil (target ,status,fileorig,i_val=tmp_ret_val)188 CALL get_fil (targetname,status,fileorig,size_of_in,i_val=tmp_ret_val) 172 189 !-- Put the data into the database 173 190 CALL get_wdb & 174 & (target ,status,fileorig,1,i_val=tmp_ret_val)191 & (targetname,status,fileorig,1,i_val=tmp_ret_val) 175 192 ELSE 176 193 !-- Get the value out of the database 177 CALL get_rdb (pos,1,target ,i_val=tmp_ret_val)194 CALL get_rdb (pos,1,targetname,i_val=tmp_ret_val) 178 195 ENDIF 179 196 ret_val = tmp_ret_val(1) … … 181 198 END SUBROUTINE getinis 182 199 !=== 183 SUBROUTINE getini1d (target ,ret_val)184 !--------------------------------------------------------------------- 185 IMPLICIT NONE 186 !- 187 CHARACTER(LEN=*) :: target 200 SUBROUTINE getini1d (targetname,ret_val) 201 !--------------------------------------------------------------------- 202 IMPLICIT NONE 203 !- 204 CHARACTER(LEN=*) :: targetname 188 205 INTEGER,DIMENSION(:) :: ret_val 189 206 !- … … 193 210 !--------------------------------------------------------------------- 194 211 !- 195 ! Do we have this target in our database ?196 !- 197 CALL get_findkey (1,target ,pos)212 ! Do we have this targetname in our database ? 213 !- 214 CALL get_findkey (1,targetname,pos) 198 215 !- 199 216 size_of_in = SIZE(ret_val) … … 209 226 IF (pos < 0) THEN 210 227 !-- Get the information out of the file 211 CALL get_fil (target ,status,fileorig,i_val=tmp_ret_val)228 CALL get_fil (targetname,status,fileorig,size_of_in,i_val=tmp_ret_val) 212 229 !-- Put the data into the database 213 230 CALL get_wdb & 214 & (target ,status,fileorig,size_of_in,i_val=tmp_ret_val)231 & (targetname,status,fileorig,size_of_in,i_val=tmp_ret_val) 215 232 ELSE 216 233 !-- Get the value out of the database 217 CALL get_rdb (pos,size_of_in,target ,i_val=tmp_ret_val)234 CALL get_rdb (pos,size_of_in,targetname,i_val=tmp_ret_val) 218 235 ENDIF 219 236 ret_val(1:size_of_in) = tmp_ret_val(1:size_of_in) … … 221 238 END SUBROUTINE getini1d 222 239 !=== 223 SUBROUTINE getini2d (target ,ret_val)224 !--------------------------------------------------------------------- 225 IMPLICIT NONE 226 !- 227 CHARACTER(LEN=*) :: target 240 SUBROUTINE getini2d (targetname,ret_val) 241 !--------------------------------------------------------------------- 242 IMPLICIT NONE 243 !- 244 CHARACTER(LEN=*) :: targetname 228 245 INTEGER,DIMENSION(:,:) :: ret_val 229 246 !- … … 234 251 !--------------------------------------------------------------------- 235 252 !- 236 ! Do we have this target in our database ?237 !- 238 CALL get_findkey (1,target ,pos)253 ! Do we have this targetname in our database ? 254 !- 255 CALL get_findkey (1,targetname,pos) 239 256 !- 240 257 size_of_in = SIZE(ret_val) … … 259 276 IF (pos < 0) THEN 260 277 !-- Get the information out of the file 261 CALL get_fil (target ,status,fileorig,i_val=tmp_ret_val)278 CALL get_fil (targetname,status,fileorig,size_of_in,i_val=tmp_ret_val) 262 279 !-- Put the data into the database 263 280 CALL get_wdb & 264 & (target ,status,fileorig,size_of_in,i_val=tmp_ret_val)281 & (targetname,status,fileorig,size_of_in,i_val=tmp_ret_val) 265 282 ELSE 266 283 !-- Get the value out of the database 267 CALL get_rdb (pos,size_of_in,target ,i_val=tmp_ret_val)284 CALL get_rdb (pos,size_of_in,targetname,i_val=tmp_ret_val) 268 285 ENDIF 269 286 !- … … 280 297 !=== REAL INTERFACE 281 298 !- 282 SUBROUTINE getinrs (target ,ret_val)283 !--------------------------------------------------------------------- 284 IMPLICIT NONE 285 !- 286 CHARACTER(LEN=*) :: target 299 SUBROUTINE getinrs (targetname,ret_val) 300 !--------------------------------------------------------------------- 301 IMPLICIT NONE 302 !- 303 CHARACTER(LEN=*) :: targetname 287 304 REAL :: ret_val 288 305 !- 289 306 REAL,DIMENSION(1) :: tmp_ret_val 290 INTEGER :: pos,status=0,fileorig 291 !--------------------------------------------------------------------- 292 !- 293 ! Do we have this target in our database ?294 !- 295 CALL get_findkey (1,target ,pos)307 INTEGER :: pos,status=0,fileorig, size_of_in 308 !--------------------------------------------------------------------- 309 !- 310 ! Do we have this targetname in our database ? 311 !- 312 CALL get_findkey (1,targetname,pos) 296 313 !- 297 314 tmp_ret_val(1) = ret_val 315 size_of_in = SIZE(tmp_ret_val) 298 316 !- 299 317 IF (pos < 0) THEN 300 318 !-- Get the information out of the file 301 CALL get_fil (target ,status,fileorig,r_val=tmp_ret_val)319 CALL get_fil (targetname,status,fileorig,size_of_in,r_val=tmp_ret_val) 302 320 !-- Put the data into the database 303 321 CALL get_wdb & 304 & (target ,status,fileorig,1,r_val=tmp_ret_val)322 & (targetname,status,fileorig,1,r_val=tmp_ret_val) 305 323 ELSE 306 324 !-- Get the value out of the database 307 CALL get_rdb (pos,1,target ,r_val=tmp_ret_val)325 CALL get_rdb (pos,1,targetname,r_val=tmp_ret_val) 308 326 ENDIF 309 327 ret_val = tmp_ret_val(1) … … 311 329 END SUBROUTINE getinrs 312 330 !=== 313 SUBROUTINE getinr1d (target ,ret_val)314 !--------------------------------------------------------------------- 315 IMPLICIT NONE 316 !- 317 CHARACTER(LEN=*) :: target 331 SUBROUTINE getinr1d (targetname,ret_val) 332 !--------------------------------------------------------------------- 333 IMPLICIT NONE 334 !- 335 CHARACTER(LEN=*) :: targetname 318 336 REAL,DIMENSION(:) :: ret_val 319 337 !- … … 323 341 !--------------------------------------------------------------------- 324 342 !- 325 ! Do we have this target in our database ?326 !- 327 CALL get_findkey (1,target ,pos)343 ! Do we have this targetname in our database ? 344 !- 345 CALL get_findkey (1,targetname,pos) 328 346 !- 329 347 size_of_in = SIZE(ret_val) … … 339 357 IF (pos < 0) THEN 340 358 !-- Get the information out of the file 341 CALL get_fil (target ,status,fileorig,r_val=tmp_ret_val)359 CALL get_fil (targetname,status,fileorig,size_of_in,r_val=tmp_ret_val) 342 360 !-- Put the data into the database 343 361 CALL get_wdb & 344 & (target ,status,fileorig,size_of_in,r_val=tmp_ret_val)362 & (targetname,status,fileorig,size_of_in,r_val=tmp_ret_val) 345 363 ELSE 346 364 !-- Get the value out of the database 347 CALL get_rdb (pos,size_of_in,target ,r_val=tmp_ret_val)365 CALL get_rdb (pos,size_of_in,targetname,r_val=tmp_ret_val) 348 366 ENDIF 349 367 ret_val(1:size_of_in) = tmp_ret_val(1:size_of_in) … … 351 369 END SUBROUTINE getinr1d 352 370 !=== 353 SUBROUTINE getinr2d (target ,ret_val)354 !--------------------------------------------------------------------- 355 IMPLICIT NONE 356 !- 357 CHARACTER(LEN=*) :: target 371 SUBROUTINE getinr2d (targetname,ret_val) 372 !--------------------------------------------------------------------- 373 IMPLICIT NONE 374 !- 375 CHARACTER(LEN=*) :: targetname 358 376 REAL,DIMENSION(:,:) :: ret_val 359 377 !- … … 364 382 !--------------------------------------------------------------------- 365 383 !- 366 ! Do we have this target in our database ?367 !- 368 CALL get_findkey (1,target ,pos)384 ! Do we have this targetname in our database ? 385 !- 386 CALL get_findkey (1,targetname,pos) 369 387 !- 370 388 size_of_in = SIZE(ret_val) … … 389 407 IF (pos < 0) THEN 390 408 !-- Get the information out of the file 391 CALL get_fil (target ,status,fileorig,r_val=tmp_ret_val)409 CALL get_fil (targetname,status,fileorig,size_of_in,r_val=tmp_ret_val) 392 410 !-- Put the data into the database 393 411 CALL get_wdb & 394 & (target ,status,fileorig,size_of_in,r_val=tmp_ret_val)412 & (targetname,status,fileorig,size_of_in,r_val=tmp_ret_val) 395 413 ELSE 396 414 !-- Get the value out of the database 397 CALL get_rdb (pos,size_of_in,target ,r_val=tmp_ret_val)415 CALL get_rdb (pos,size_of_in,targetname,r_val=tmp_ret_val) 398 416 ENDIF 399 417 !- … … 410 428 !=== CHARACTER INTERFACE 411 429 !- 412 SUBROUTINE getincs (target ,ret_val)413 !--------------------------------------------------------------------- 414 IMPLICIT NONE 415 !- 416 CHARACTER(LEN=*) :: target 430 SUBROUTINE getincs (targetname,ret_val) 431 !--------------------------------------------------------------------- 432 IMPLICIT NONE 433 !- 434 CHARACTER(LEN=*) :: targetname 417 435 CHARACTER(LEN=*) :: ret_val 418 436 !- 419 437 CHARACTER(LEN=100),DIMENSION(1) :: tmp_ret_val 420 INTEGER :: pos,status=0,fileorig 421 !--------------------------------------------------------------------- 422 !- 423 ! Do we have this target in our database ?424 !- 425 CALL get_findkey (1,target ,pos)438 INTEGER :: pos,status=0,fileorig,size_of_in 439 !--------------------------------------------------------------------- 440 !- 441 ! Do we have this targetname in our database ? 442 !- 443 CALL get_findkey (1,targetname,pos) 426 444 !- 427 445 tmp_ret_val(1) = ret_val 446 size_of_in = SIZE(tmp_ret_val) 428 447 !- 429 448 IF (pos < 0) THEN 430 449 !-- Get the information out of the file 431 CALL get_fil (target ,status,fileorig,c_val=tmp_ret_val)450 CALL get_fil (targetname,status,fileorig,size_of_in,c_val=tmp_ret_val) 432 451 !-- Put the data into the database 433 452 CALL get_wdb & 434 & (target ,status,fileorig,1,c_val=tmp_ret_val)453 & (targetname,status,fileorig,1,c_val=tmp_ret_val) 435 454 ELSE 436 455 !-- Get the value out of the database 437 CALL get_rdb (pos,1,target ,c_val=tmp_ret_val)456 CALL get_rdb (pos,1,targetname,c_val=tmp_ret_val) 438 457 ENDIF 439 458 ret_val = tmp_ret_val(1) … … 441 460 END SUBROUTINE getincs 442 461 !=== 443 SUBROUTINE getinc1d (target ,ret_val)444 !--------------------------------------------------------------------- 445 IMPLICIT NONE 446 !- 447 CHARACTER(LEN=*) :: target 462 SUBROUTINE getinc1d (targetname,ret_val) 463 !--------------------------------------------------------------------- 464 IMPLICIT NONE 465 !- 466 CHARACTER(LEN=*) :: targetname 448 467 CHARACTER(LEN=*),DIMENSION(:) :: ret_val 449 468 !- … … 453 472 !--------------------------------------------------------------------- 454 473 !- 455 ! Do we have this target in our database ?456 !- 457 CALL get_findkey (1,target ,pos)474 ! Do we have this targetname in our database ? 475 !- 476 CALL get_findkey (1,targetname,pos) 458 477 !- 459 478 size_of_in = SIZE(ret_val) … … 469 488 IF (pos < 0) THEN 470 489 !-- Get the information out of the file 471 CALL get_fil (target ,status,fileorig,c_val=tmp_ret_val)490 CALL get_fil (targetname,status,fileorig,size_of_in,c_val=tmp_ret_val) 472 491 !-- Put the data into the database 473 492 CALL get_wdb & 474 & (target ,status,fileorig,size_of_in,c_val=tmp_ret_val)493 & (targetname,status,fileorig,size_of_in,c_val=tmp_ret_val) 475 494 ELSE 476 495 !-- Get the value out of the database 477 CALL get_rdb (pos,size_of_in,target ,c_val=tmp_ret_val)496 CALL get_rdb (pos,size_of_in,targetname,c_val=tmp_ret_val) 478 497 ENDIF 479 498 ret_val(1:size_of_in) = tmp_ret_val(1:size_of_in) … … 481 500 END SUBROUTINE getinc1d 482 501 !=== 483 SUBROUTINE getinc2d (target ,ret_val)484 !--------------------------------------------------------------------- 485 IMPLICIT NONE 486 !- 487 CHARACTER(LEN=*) :: target 502 SUBROUTINE getinc2d (targetname,ret_val) 503 !--------------------------------------------------------------------- 504 IMPLICIT NONE 505 !- 506 CHARACTER(LEN=*) :: targetname 488 507 CHARACTER(LEN=*),DIMENSION(:,:) :: ret_val 489 508 !- … … 494 513 !--------------------------------------------------------------------- 495 514 !- 496 ! Do we have this target in our database ?497 !- 498 CALL get_findkey (1,target ,pos)515 ! Do we have this targetname in our database ? 516 !- 517 CALL get_findkey (1,targetname,pos) 499 518 !- 500 519 size_of_in = SIZE(ret_val) … … 519 538 IF (pos < 0) THEN 520 539 !-- Get the information out of the file 521 CALL get_fil (target ,status,fileorig,c_val=tmp_ret_val)540 CALL get_fil (targetname,status,fileorig,size_of_in,c_val=tmp_ret_val) 522 541 !-- Put the data into the database 523 542 CALL get_wdb & 524 & (target ,status,fileorig,size_of_in,c_val=tmp_ret_val)543 & (targetname,status,fileorig,size_of_in,c_val=tmp_ret_val) 525 544 ELSE 526 545 !-- Get the value out of the database 527 CALL get_rdb (pos,size_of_in,target ,c_val=tmp_ret_val)546 CALL get_rdb (pos,size_of_in,targetname,c_val=tmp_ret_val) 528 547 ENDIF 529 548 !- … … 540 559 !=== LOGICAL INTERFACE 541 560 !- 542 SUBROUTINE getinls (target ,ret_val)543 !--------------------------------------------------------------------- 544 IMPLICIT NONE 545 !- 546 CHARACTER(LEN=*) :: target 561 SUBROUTINE getinls (targetname,ret_val) 562 !--------------------------------------------------------------------- 563 IMPLICIT NONE 564 !- 565 CHARACTER(LEN=*) :: targetname 547 566 LOGICAL :: ret_val 548 567 !- 549 568 LOGICAL,DIMENSION(1) :: tmp_ret_val 550 INTEGER :: pos,status=0,fileorig 551 !--------------------------------------------------------------------- 552 !- 553 ! Do we have this target in our database ?554 !- 555 CALL get_findkey (1,target ,pos)569 INTEGER :: pos,status=0,fileorig,size_of_in 570 !--------------------------------------------------------------------- 571 !- 572 ! Do we have this targetname in our database ? 573 !- 574 CALL get_findkey (1,targetname,pos) 556 575 !- 557 576 tmp_ret_val(1) = ret_val 577 size_of_in = SIZE(tmp_ret_val) 558 578 !- 559 579 IF (pos < 0) THEN 560 580 !-- Get the information out of the file 561 CALL get_fil (target ,status,fileorig,l_val=tmp_ret_val)581 CALL get_fil (targetname,status,fileorig,size_of_in,l_val=tmp_ret_val) 562 582 !-- Put the data into the database 563 583 CALL get_wdb & 564 & (target ,status,fileorig,1,l_val=tmp_ret_val)584 & (targetname,status,fileorig,1,l_val=tmp_ret_val) 565 585 ELSE 566 586 !-- Get the value out of the database 567 CALL get_rdb (pos,1,target ,l_val=tmp_ret_val)587 CALL get_rdb (pos,1,targetname,l_val=tmp_ret_val) 568 588 ENDIF 569 589 ret_val = tmp_ret_val(1) … … 571 591 END SUBROUTINE getinls 572 592 !=== 573 SUBROUTINE getinl1d (target ,ret_val)574 !--------------------------------------------------------------------- 575 IMPLICIT NONE 576 !- 577 CHARACTER(LEN=*) :: target 593 SUBROUTINE getinl1d (targetname,ret_val) 594 !--------------------------------------------------------------------- 595 IMPLICIT NONE 596 !- 597 CHARACTER(LEN=*) :: targetname 578 598 LOGICAL,DIMENSION(:) :: ret_val 579 599 !- … … 583 603 !--------------------------------------------------------------------- 584 604 !- 585 ! Do we have this target in our database ?586 !- 587 CALL get_findkey (1,target ,pos)605 ! Do we have this targetname in our database ? 606 !- 607 CALL get_findkey (1,targetname,pos) 588 608 !- 589 609 size_of_in = SIZE(ret_val) … … 599 619 IF (pos < 0) THEN 600 620 !-- Get the information out of the file 601 CALL get_fil (target ,status,fileorig,l_val=tmp_ret_val)621 CALL get_fil (targetname,status,fileorig,size_of_in,l_val=tmp_ret_val) 602 622 !-- Put the data into the database 603 623 CALL get_wdb & 604 & (target ,status,fileorig,size_of_in,l_val=tmp_ret_val)624 & (targetname,status,fileorig,size_of_in,l_val=tmp_ret_val) 605 625 ELSE 606 626 !-- Get the value out of the database 607 CALL get_rdb (pos,size_of_in,target ,l_val=tmp_ret_val)627 CALL get_rdb (pos,size_of_in,targetname,l_val=tmp_ret_val) 608 628 ENDIF 609 629 ret_val(1:size_of_in) = tmp_ret_val(1:size_of_in) … … 611 631 END SUBROUTINE getinl1d 612 632 !=== 613 SUBROUTINE getinl2d (target ,ret_val)614 !--------------------------------------------------------------------- 615 IMPLICIT NONE 616 !- 617 CHARACTER(LEN=*) :: target 633 SUBROUTINE getinl2d (targetname,ret_val) 634 !--------------------------------------------------------------------- 635 IMPLICIT NONE 636 !- 637 CHARACTER(LEN=*) :: targetname 618 638 LOGICAL,DIMENSION(:,:) :: ret_val 619 639 !- … … 624 644 !--------------------------------------------------------------------- 625 645 !- 626 ! Do we have this target in our database ?627 !- 628 CALL get_findkey (1,target ,pos)646 ! Do we have this targetname in our database ? 647 !- 648 CALL get_findkey (1,targetname,pos) 629 649 !- 630 650 size_of_in = SIZE(ret_val) … … 649 669 IF (pos < 0) THEN 650 670 !-- Get the information out of the file 651 CALL get_fil (target ,status,fileorig,l_val=tmp_ret_val)671 CALL get_fil (targetname,status,fileorig,size_of_in,l_val=tmp_ret_val) 652 672 !-- Put the data into the database 653 673 CALL get_wdb & 654 & (target ,status,fileorig,size_of_in,l_val=tmp_ret_val)674 & (targetname,status,fileorig,size_of_in,l_val=tmp_ret_val) 655 675 ELSE 656 676 !-- Get the value out of the database 657 CALL get_rdb (pos,size_of_in,target ,l_val=tmp_ret_val)677 CALL get_rdb (pos,size_of_in,targetname,l_val=tmp_ret_val) 658 678 ENDIF 659 679 !- … … 670 690 !=== Generic file/database INTERFACE 671 691 !- 672 SUBROUTINE get_fil (target ,status,fileorig,i_val,r_val,c_val,l_val)692 SUBROUTINE get_fil (targetname,status,fileorig,nb_to_ret,i_val,r_val,c_val,l_val) 673 693 !--------------------------------------------------------------------- 674 694 !- Subroutine that will extract from the file the values 675 !- attributed to the keyword target 676 !- 677 !- (C) target : target for which we will look in the file695 !- attributed to the keyword targetname 696 !- 697 !- (C) targetname : target for which we will look in the file 678 698 !- (I) status : tells us from where we obtained the data 679 699 !- (I) fileorig : index of the file from which the key comes 700 !- (I) nb_to_ret : size of output vector 680 701 !- (I) i_val(:) : INTEGER(nb_to_ret) values 681 702 !- (R) r_val(:) : REAL(nb_to_ret) values … … 685 706 IMPLICIT NONE 686 707 !- 687 CHARACTER(LEN=*) :: target 708 CHARACTER(LEN=*) :: targetname 709 INTEGER,INTENT(IN) :: nb_to_ret 688 710 INTEGER,INTENT(OUT) :: status,fileorig 689 711 INTEGER,DIMENSION(:),OPTIONAL :: i_val … … 692 714 CHARACTER(LEN=*),DIMENSION(:),OPTIONAL :: c_val 693 715 !- 694 INTEGER :: k_typ, nb_to_ret,it,pos,len_str,status_cnt,io_err716 INTEGER :: k_typ,it,pos,len_str,status_cnt,io_err 695 717 CHARACTER(LEN=n_d_fmt) :: cnt 696 718 CHARACTER(LEN=80) :: str_READ,str_READ_lower … … 702 724 REAL :: r_cmpval 703 725 INTEGER :: ipos_tr,ipos_fl 726 LOGICAL :: l_dbg 727 !--------------------------------------------------------------------- 728 CALL ipsldbg (old_status=l_dbg) 704 729 !--------------------------------------------------------------------- 705 730 !- 706 731 ! Get the type of the argument 707 732 CALL get_qtyp (k_typ,c_vtyp,i_val,r_val,c_val,l_val) 708 SELECT CASE (k_typ) 709 CASE(k_i) 710 nb_to_ret = SIZE(i_val) 711 CASE(k_r) 712 nb_to_ret = SIZE(r_val) 713 CASE(k_c) 714 nb_to_ret = SIZE(c_val) 715 CASE(k_l) 716 nb_to_ret = SIZE(l_val) 717 CASE DEFAULT 733 IF ( (k_typ.NE.k_i) .AND. (k_typ.NE.k_r) .AND. (k_typ.NE.k_c) .AND. (k_typ.NE.k_l) ) THEN 718 734 CALL ipslerr (3,'get_fil', & 719 735 & 'Internal error','Unknown type of data',' ') 720 END SELECT736 ENDIF 721 737 !- 722 738 ! Read the file(s) … … 728 744 !- 729 745 ! See what we find in the files read 746 !--- 747 !-- We dont know from which file the target could come. 748 !-- Thus by default we attribute it to the first file : 749 fileorig = 1 750 !- 730 751 DO it=1,nb_to_ret 731 752 !--- 732 753 !-- First try the target as it is 733 CALL get_findkey (2,target ,pos)754 CALL get_findkey (2,targetname,pos) 734 755 !--- 735 756 !-- Another try … … 737 758 IF (pos < 0) THEN 738 759 WRITE(UNIT=cnt,FMT=c_i_fmt) it 739 CALL get_findkey (2,TRIM(target)//'__'//cnt,pos) 740 ENDIF 741 !--- 742 !-- We dont know from which file the target could come. 743 !-- Thus by default we attribute it to the first file : 744 fileorig = 1 760 CALL get_findkey (2,TRIM(targetname)//'__'//cnt,pos) 761 ENDIF 745 762 !--- 746 763 IF (pos > 0) THEN … … 748 765 found(it) = .TRUE. 749 766 fileorig = fromfile(pos) 767 ! 768 IF (l_dbg) THEN 769 WRITE(*,*) & 770 & 'getin_fil : read key ',targetname,' from file ',fileorig,' has type ',k_typ 771 ENDIF 750 772 !----- 751 773 !---- DECODE … … 754 776 str_READ_lower = str_READ 755 777 CALL strlowercase (str_READ_lower) 778 IF (l_dbg) THEN 779 WRITE(*,*) & 780 & ' value ',str_READ_lower 781 ENDIF 756 782 !----- 757 783 IF ( (TRIM(str_READ_lower) == 'def') & … … 789 815 IF (io_err /= 0) THEN 790 816 CALL ipslerr (3,'get_fil', & 791 & 'Target '//TRIM(target ), &817 & 'Target '//TRIM(targetname), & 792 818 & 'is not of '//TRIM(c_vtyp)//' type',' ') 793 819 ENDIF … … 801 827 IF (compline(pos) /= nb_to_ret) THEN 802 828 CALL ipslerr (2,'get_fil', & 803 & 'For key '//TRIM(target )//' we have a compressed field', &829 & 'For key '//TRIM(targetname)//' we have a compressed field', & 804 830 & 'which does not have the right size.', & 805 831 & 'We will try to fix that.') … … 828 854 i_val(it) = i_cmpval 829 855 ELSE IF (k_typ == k_r) THEN 856 r_val(it) = r_cmpval 830 857 ENDIF 831 858 found(it) = .TRUE. … … 837 864 ! Now we set the status for what we found 838 865 IF (def_beha) THEN 839 status = 2 840 WRITE(*,*) 'USING DEFAULT BEHAVIOUR FOR ',TRIM(target) 866 status = default 867 CALL ipslerr (1,'USING DEFAULT BEHAVIOUR FOR', & 868 & TRIM(targetname),' ',' ') 869 WRITE(ipslout,*) 'USING DEFAULT BEHAVIOUR FOR ',TRIM(targetname) 841 870 ELSE 842 871 status_cnt = 0 … … 845 874 status_cnt = status_cnt+1 846 875 IF (status_cnt <= max_msgs) THEN 847 WRITE (UNIT= *,FMT='(" USING DEFAULTS : ",A)', &848 & ADVANCE='NO') TRIM(target )876 WRITE (UNIT=ipslout,FMT='(" USING DEFAULTS : ",A)', & 877 & ADVANCE='NO') TRIM(targetname) 849 878 IF (nb_to_ret > 1) THEN 850 WRITE (UNIT= *,FMT='("__")',ADVANCE='NO')851 WRITE (UNIT= *,FMT=c_i_fmt,ADVANCE='NO') it879 WRITE (UNIT=ipslout,FMT='("__")',ADVANCE='NO') 880 WRITE (UNIT=ipslout,FMT=c_i_fmt,ADVANCE='NO') it 852 881 ENDIF 853 882 SELECT CASE (k_typ) 854 883 CASE(k_i) 855 WRITE (UNIT= *,FMT=*) "=",i_val(it)884 WRITE (UNIT=ipslout,FMT=*) "=",i_val(it) 856 885 CASE(k_r) 857 WRITE (UNIT= *,FMT=*) "=",r_val(it)886 WRITE (UNIT=ipslout,FMT=*) "=",r_val(it) 858 887 CASE(k_c) 859 WRITE (UNIT= *,FMT=*) "=",c_val(it)888 WRITE (UNIT=ipslout,FMT=*) "=",c_val(it) 860 889 CASE(k_l) 861 WRITE (UNIT= *,FMT=*) "=",l_val(it)890 WRITE (UNIT=ipslout,FMT=*) "=",l_val(it) 862 891 END SELECT 863 892 ELSE IF (status_cnt == max_msgs+1) THEN 864 WRITE (UNIT= *,FMT='(" USING DEFAULTS ... ",A)')893 WRITE (UNIT=ipslout,FMT='(" USING DEFAULTS ... ",A)') 865 894 ENDIF 866 895 ENDIF … … 868 897 !--- 869 898 IF (status_cnt == 0) THEN 870 status = 1899 status = nondefault 871 900 ELSE IF (status_cnt == nb_to_ret) THEN 872 status = 2901 status = default 873 902 ELSE 874 status = 3903 status = vectornondefault 875 904 ENDIF 876 905 ENDIF … … 880 909 END SUBROUTINE get_fil 881 910 !=== 882 SUBROUTINE get_rdb (pos,size_of_in,target ,i_val,r_val,c_val,l_val)911 SUBROUTINE get_rdb (pos,size_of_in,targetname,i_val,r_val,c_val,l_val) 883 912 !--------------------------------------------------------------------- 884 913 !- Read the required variable in the database … … 887 916 !- 888 917 INTEGER :: pos,size_of_in 889 CHARACTER(LEN=*) :: target 918 CHARACTER(LEN=*) :: targetname 890 919 INTEGER,DIMENSION(:),OPTIONAL :: i_val 891 920 REAL,DIMENSION(:),OPTIONAL :: r_val … … 907 936 IF (key_tab(pos)%keytype /= k_typ) THEN 908 937 CALL ipslerr (3,'get_rdb', & 909 & 'Wrong data type for keyword '//TRIM(target ), &938 & 'Wrong data type for keyword '//TRIM(targetname), & 910 939 & '(NOT '//TRIM(c_vtyp)//')',' ') 911 940 ENDIF … … 915 944 & .OR.(key_tab(pos)%keymemlen /= 1) ) THEN 916 945 CALL ipslerr (3,'get_rdb', & 917 & 'Wrong compression length','for keyword '//TRIM(target ),' ')946 & 'Wrong compression length','for keyword '//TRIM(targetname),' ') 918 947 ELSE 919 948 SELECT CASE (k_typ) … … 927 956 IF (key_tab(pos)%keymemlen /= size_of_in) THEN 928 957 CALL ipslerr (3,'get_rdb', & 929 & 'Wrong array length','for keyword '//TRIM(target ),' ')958 & 'Wrong array length','for keyword '//TRIM(targetname),' ') 930 959 ELSE 931 960 k_beg = key_tab(pos)%keymemstart … … 947 976 !=== 948 977 SUBROUTINE get_wdb & 949 & (target ,status,fileorig,size_of_in, &978 & (targetname,status,fileorig,size_of_in, & 950 979 & i_val,r_val,c_val,l_val) 951 980 !--------------------------------------------------------------------- … … 954 983 IMPLICIT NONE 955 984 !- 956 CHARACTER(LEN=*) :: target 985 CHARACTER(LEN=*) :: targetname 957 986 INTEGER :: status,fileorig,size_of_in 958 987 INTEGER,DIMENSION(:),OPTIONAL :: i_val … … 965 994 INTEGER :: k_mempos,k_memsize,k_beg,k_end 966 995 LOGICAL :: l_cmp 996 LOGICAL :: l_dbg 997 !--------------------------------------------------------------------- 998 CALL ipsldbg (old_status=l_dbg) 967 999 !--------------------------------------------------------------------- 968 1000 !- … … 999 1031 ! Fill out the items of the data base 1000 1032 nb_keys = nb_keys+1 1001 key_tab(nb_keys)%keystr = target (1:MIN(LEN_TRIM(target),l_n))1033 key_tab(nb_keys)%keystr = targetname(1:MIN(LEN_TRIM(targetname),l_n)) 1002 1034 key_tab(nb_keys)%keystatus = status 1003 1035 key_tab(nb_keys)%keytype = k_typ … … 1011 1043 key_tab(nb_keys)%keymemlen = size_of_in 1012 1044 ENDIF 1045 IF (l_dbg) THEN 1046 WRITE(*,*) & 1047 & "get_wdb : nb_keys ",nb_keys," key_tab keystr ",key_tab(nb_keys)%keystr,& 1048 & ",keystatus ",key_tab(nb_keys)%keystatus,& 1049 & ",keytype ",key_tab(nb_keys)%keytype,& 1050 & ",keycompress ",key_tab(nb_keys)%keycompress,& 1051 & ",keyfromfile ",key_tab(nb_keys)%keyfromfile,& 1052 & ",keymemstart ",key_tab(nb_keys)%keymemstart 1053 ENDIF 1054 1013 1055 !- 1014 1056 ! Before writing the actual size lets see if we have the space … … 1086 1128 !- 1087 1129 INTEGER :: eof,ptn,len_str,i,it,iund,io_err 1088 LOGICAL :: check = .FALSE. 1130 LOGICAL :: l_dbg 1131 !--------------------------------------------------------------------- 1132 CALL ipsldbg (old_status=l_dbg) 1089 1133 !--------------------------------------------------------------------- 1090 1134 eof = 0 … … 1092 1136 nb_lastkey = 0 1093 1137 !- 1094 IF ( check) THEN1095 WRITE( *,*) 'getin_readdef : Open file ',TRIM(filelist(current))1138 IF (l_dbg) THEN 1139 WRITE(ipslout,*) 'getin_readdef : Open file ',TRIM(filelist(current)) 1096 1140 ENDIF 1097 1141 !- … … 1133 1177 CALL cmpblank (NEW_str) 1134 1178 NEW_str = TRIM(ADJUSTL(NEW_str)) 1135 IF ( check) THEN1136 WRITE( *,*) &1179 IF (l_dbg) THEN 1180 WRITE(ipslout,*) & 1137 1181 & '--> getin_readdef : ',TRIM(key_str),' :: ',TRIM(NEW_str) 1138 1182 ENDIF … … 1171 1215 !---- If we have an empty line then the keyword finishes 1172 1216 nb_lastkey = 0 1173 IF ( check) THEN1174 WRITE( *,*) 'getin_readdef : Have found an emtpy line '1217 IF (l_dbg) THEN 1218 WRITE(ipslout,*) 'getin_readdef : Have found an emtpy line ' 1175 1219 ENDIF 1176 1220 ENDIF … … 1179 1223 CLOSE(UNIT=22) 1180 1224 !- 1181 IF ( check) THEN1225 IF (l_dbg) THEN 1182 1226 OPEN (UNIT=22,file=TRIM(def_file)//'.test') 1183 1227 DO i=1,nb_lines … … 1186 1230 CLOSE(UNIT=22) 1187 1231 ENDIF 1232 !- 1233 IF (l_dbg) THEN 1234 WRITE(ipslout,*) "nb_lines ",nb_lines,"nb_keys ",nb_keys 1235 WRITE(ipslout,*) "fichier ",fichier(1:nb_lines) 1236 WRITE(ipslout,*) "targetlist ",targetlist(1:nb_lines) 1237 WRITE(ipslout,*) "fromfile ",fromfile(1:nb_lines) 1238 WRITE(ipslout,*) "compline ",compline(1:nb_lines) 1239 WRITE(ipslout,*) '<-getin_readdef' 1240 ENDIF 1188 1241 !--------------------------- 1189 1242 END SUBROUTINE getin_readdef … … 1202 1255 !- 1203 1256 INTEGER :: current,nb_lastkey 1204 CHARACTER(LEN=*) :: key_str,NEW_str,last_key 1257 CHARACTER(LEN=*) :: key_str,NEW_str 1258 CHARACTER(LEN=*),INTENT(out) :: last_key 1205 1259 !- 1206 1260 ! LOCAL … … 1210 1264 CHARACTER(LEN=n_d_fmt) :: cnt 1211 1265 CHARACTER(LEN=10) :: c_fmt 1266 LOGICAL :: l_dbg 1267 !--------------------------------------------------------------------- 1268 CALL ipsldbg (old_status=l_dbg) 1212 1269 !--------------------------------------------------------------------- 1213 1270 len_str = LEN_TRIM(NEW_str) … … 1347 1404 nbve = nbve+1 1348 1405 WRITE(UNIT=cnt,FMT=c_i_fmt) nbve 1406 compline(nb_lines)=compline(nb_lines-1) 1349 1407 !- 1350 1408 ENDDO … … 1365 1423 !- 1366 1424 ENDIF 1425 1426 IF (l_dbg) THEN 1427 WRITE(ipslout,*) "getin_decrypt ->",TRIM(NEW_str), " : " 1428 WRITE(ipslout,*) "getin_decrypt ->", nb_lines,& 1429 & SIZE(fichier), & 1430 & SIZE(fromfile), & 1431 & SIZE(filelist) 1432 IF (nb_lines > 0) THEN 1433 WRITE(ipslout,*) "getin_decrypt ->", & 1434 & TRIM(fichier(nb_lines)), & 1435 & fromfile(nb_lines), & 1436 & TRIM(filelist(fromfile(nb_lines))) 1437 WRITE(ipslout,*) " compline : ",compline(nb_lines) 1438 WRITE(ipslout,*) " targetlist : ",TRIM(targetlist(nb_lines)) 1439 ENDIF 1440 WRITE(ipslout,*) " last_key : ",last_key 1441 ENDIF 1367 1442 !--------------------------- 1368 1443 END SUBROUTINE getin_decrypt … … 1391 1466 !--- 1392 1467 IF (n_k > 0) THEN 1393 WRITE( *,*) 'COUNT : ',n_k1394 WRITE( *,*) &1468 WRITE(ipslout,*) 'COUNT : ',n_k 1469 WRITE(ipslout,*) & 1395 1470 & 'getin_checkcohe : Found a problem on key ',TRIM(targetlist(line)) 1396 WRITE( *,*) &1471 WRITE(ipslout,*) & 1397 1472 & 'getin_checkcohe : The following values were encoutered :' 1398 WRITE( *,*) &1473 WRITE(ipslout,*) & 1399 1474 & ' ',TRIM(targetlist(line)),' == ',fichier(line) 1400 WRITE( *,*) &1475 WRITE(ipslout,*) & 1401 1476 & ' ',TRIM(targetlist(k)),' == ',fichier(k) 1402 WRITE( *,*) &1477 WRITE(ipslout,*) & 1403 1478 & 'getin_checkcohe : We will keep only the last value' 1479 CALL ipslerr (2,'getin_checkcohe','Found a problem on key ', & 1480 & TRIM(targetlist(line)), fichier(line)//" "//fichier(k)) 1404 1481 targetlist(line) = ' ' 1405 1482 ENDIF … … 1416 1493 INTEGER :: unit,eof,nb_lastkey 1417 1494 CHARACTER(LEN=100) :: dummy 1418 CHARACTER(LEN=100) :: out_string1495 CHARACTER(LEN=100),INTENT(out) :: out_string 1419 1496 CHARACTER(LEN=1) :: first 1420 1497 !--------------------------------------------------------------------- … … 1780 1857 CHARACTER(LEN=20) :: c_tmp 1781 1858 CHARACTER(LEN=100) :: tmp_str,used_filename 1782 LOGICAL :: check = .FALSE. 1859 INTEGER :: io_err 1860 LOGICAL :: l_dbg 1861 !--------------------------------------------------------------------- 1862 CALL ipsldbg (old_status=l_dbg) 1783 1863 !--------------------------------------------------------------------- 1784 1864 IF (PRESENT(fileprefix)) THEN … … 1791 1871 !--- 1792 1872 used_filename = TRIM(usedfileprefix)//'_'//TRIM(filelist(if)) 1793 IF (check) THEN 1794 WRITE(*,*) & 1795 & 'GETIN_DUMP : opens file : ',TRIM(used_filename),' if = ',if 1796 WRITE(*,*) 'GETIN_DUMP : NUMBER OF KEYS : ',nb_keys 1797 ENDIF 1798 OPEN (UNIT=22,FILE=used_filename) 1873 IF (l_dbg) THEN 1874 WRITE(ipslout,*) & 1875 & 'getin_dump : opens file : ',TRIM(used_filename),' if = ',if 1876 WRITE(ipslout,*) 'GETIN_DUMP : NUMBER OF KEYS : ',nb_keys 1877 ENDIF 1878 OPEN (UNIT=22,FILE=used_filename,iostat=io_err) 1879 IF (io_err /= 0) THEN 1880 CALL ipslerr (3,'getin_dump', & 1881 & 'Could not open file :',TRIM(used_filename), & 1882 & '') 1883 ENDIF 1799 1884 !--- 1800 1885 !-- If this is the first file we need to add the list … … 1808 1893 ENDDO 1809 1894 WRITE(22,*) '# ' 1895 IF (l_dbg) THEN 1896 WRITE(ipslout,*) '# ' 1897 WRITE(ipslout,*) '# This file is linked to the following files :' 1898 WRITE(ipslout,*) '# ' 1899 DO iff=2,nbfiles 1900 WRITE(ipslout,*) 'INCLUDEDEF = ',TRIM(filelist(iff)) 1901 ENDDO 1902 WRITE(ipslout,*) '# ' 1903 ENDIF 1810 1904 ENDIF 1811 1905 !--- … … 1818 1912 WRITE(22,*) '#' 1819 1913 SELECT CASE (key_tab(ikey)%keystatus) 1820 CASE( 1)1914 CASE(nondefault) 1821 1915 WRITE(22,*) '# Values of ', & 1822 1916 & TRIM(key_tab(ikey)%keystr),' comes from ',TRIM(def_file) 1823 CASE( 2)1917 CASE(default) 1824 1918 WRITE(22,*) '# Values of ', & 1825 1919 & TRIM(key_tab(ikey)%keystr),' are all defaults.' 1826 CASE( 3)1920 CASE(vectornondefault) 1827 1921 WRITE(22,*) '# Values of ', & 1828 1922 & TRIM(key_tab(ikey)%keystr), & … … 1833 1927 END SELECT 1834 1928 WRITE(22,*) '#' 1929 !- 1930 IF (l_dbg) THEN 1931 WRITE(ipslout,*) '#' 1932 WRITE(ipslout,*) '# Status of key ', ikey, ' : ',& 1933 & TRIM(key_tab(ikey)%keystr),key_tab(ikey)%keystatus 1934 ENDIF 1835 1935 !------- 1836 1936 !------ Write the values … … 1925 2025 END SUBROUTINE getin_dump 1926 2026 !=== 2027 SUBROUTINE getin_dump_para (fileprefix,rank) 2028 !--------------------------------------------------------------------- 2029 IMPLICIT NONE 2030 !- 2031 CHARACTER(*) :: fileprefix 2032 INTEGER,INTENT(IN) :: rank 2033 !- 2034 CHARACTER(LEN=80) :: usedfileprefix 2035 LOGICAL :: l_dbg 2036 INTEGER :: isize 2037 !--------------------------------------------------------------------- 2038 CALL ipsldbg (old_status=l_dbg) 2039 !--------------------------------------------------------------------- 2040 IF ( rank < 1000 ) THEN 2041 isize=MIN(LEN_TRIM(fileprefix),75) 2042 usedfileprefix = fileprefix(1:isize) 2043 usedfileprefix((isize+1):(isize+1))='_' 2044 WRITE(usedfileprefix((isize+2):(isize+5)),'(I4.4)') rank 2045 IF (l_dbg) & 2046 WRITE(ipslout,*) 'Dump getin to file ',usedfileprefix 2047 CALL getin_dump(usedfileprefix) 2048 ENDIF 2049 !------------------------ 2050 END SUBROUTINE getin_dump_para 2051 2052 !=== 1927 2053 SUBROUTINE get_qtyp (k_typ,c_vtyp,i_v,r_v,c_v,l_v) 1928 2054 !--------------------------------------------------------------------- -
dynamico_lmdz/aquaplanet/IOIPSL/src/histcom.f90
r3847 r3907 1 1 MODULE histcom 2 2 !- 3 !$Id: histcom.f90 1028 2010-05-20 15:17:30Z bellier$3 !$Id: histcom.f90 2350 2014-10-08 12:21:30Z acosce $ 4 4 !- 5 5 ! This software is governed by the CeCILL license … … 9 9 !- 10 10 USE stringop, ONLY : nocomma,cmpblank,findpos,find_str,strlowercase 11 USE mathelp, ONLY : mathop,moycum, buildop11 USE mathelp, ONLY : mathop,moycum,moycum_index,buildop 12 12 USE fliocom, ONLY : flio_dom_file,flio_dom_att 13 13 USE calendar 14 USE errioipsl, ONLY : ipslerr,ipsldbg 14 USE errioipsl, ONLY : ipslerr,ipsldbg,ipslout 15 15 !- 16 16 IMPLICIT NONE … … 18 18 PRIVATE 19 19 PUBLIC :: histbeg,histdef,histhori,histvert,histend, & 20 & histwrite,histclo,histsync,ioconf_modname 20 & histwrite,histclo,histsync,ioconf_modname, histglobal_attr 21 21 !--------------------------------------------------------------------- 22 22 !- Some confusing vocabulary in this code ! … … 74 74 ! Fixed parameter 75 75 !- 76 INTEGER,PARAMETER :: nb_files_max=20,nb_var_max= 2000, &76 INTEGER,PARAMETER :: nb_files_max=20,nb_var_max=1000, & 77 77 & nb_hax_max=5,nb_zax_max=10,nbopp_max=10 78 78 REAL,PARAMETER :: missing_val=nf90_fill_real … … 123 123 !-NETCDF IDs for file 124 124 INTEGER :: ncfid=-1 125 !-Name of the file 126 CHARACTER(LEN=120) :: name 125 127 !-Time variables 126 128 INTEGER :: itau0=0 … … 340 342 ENDIF 341 343 !- 342 IF (l_dbg) WRITE( *,*) c_nam//" 0.0"344 IF (l_dbg) WRITE(ipslout,*) c_nam//" 0.0" 343 345 !- 344 346 ! Search for a free index … … 358 360 ! 1.0 Transfering into the common for future use 359 361 !- 360 IF (l_dbg) WRITE( *,*) c_nam//" 1.0"362 IF (l_dbg) WRITE(ipslout,*) c_nam//" 1.0" 361 363 !- 362 364 W_F(idf)%itau0 = pitau0 … … 366 368 ! 2.0 Initializes all variables for this file 367 369 !- 368 IF (l_dbg) WRITE( *,*) c_nam//" 2.0"370 IF (l_dbg) WRITE(ipslout,*) c_nam//" 2.0" 369 371 !- 370 372 W_F(idf)%n_var = 0 … … 383 385 ! 3.0 Opening netcdf file and defining dimensions 384 386 !- 385 IF (l_dbg) WRITE( *,*) c_nam//" 3.0"387 IF (l_dbg) WRITE(ipslout,*) c_nam//" 3.0" 386 388 !- 387 389 ! Add DOMAIN number and ".nc" suffix in file name if needed … … 425 427 ! 4.0 Declaring the geographical coordinates and other attributes 426 428 !- 427 IF (l_dbg) WRITE( *,*) c_nam//" 4.0"429 IF (l_dbg) WRITE(ipslout,*) c_nam//" 4.0" 428 430 !- 429 431 iret = NF90_PUT_ATT(nfid,NF90_GLOBAL,'Conventions','CF-1.1') … … 436 438 ! 5.0 Saving some important information on this file in the common 437 439 !- 438 IF (l_dbg) WRITE( *,*) c_nam//" 5.0"440 IF (l_dbg) WRITE(ipslout,*) c_nam//" 5.0" 439 441 !- 440 442 IF (PRESENT(domain_id)) THEN 441 443 W_F(idf)%dom_id_svg = domain_id 442 444 ENDIF 445 W_F(idf)%name = TRIM(nc_name) 443 446 W_F(idf)%ncfid = nfid 444 447 IF ( (k_typ == 1).OR.(k_typ == 2) ) THEN … … 467 470 !----------------------- 468 471 END SUBROUTINE histb_all 472 !=== 473 SUBROUTINE histglobal_attr & 474 & (idf,string_attr,glob_attr) 475 !--------------------------------------------------------------------- 476 !- Definition of GLOBAL attribute for history files. 477 !- 478 !- INPUT 479 !- 480 !- idf : The id of the file to which the grid should be added 481 !- string_attr : name of the global attribute to be added 482 !- glob_attr : global_attribute to be added 483 !--------------------------------------------------------------------- 484 IMPLICIT NONE 485 !- 486 INTEGER,INTENT(IN) :: idf 487 CHARACTER(len=*),INTENT(IN) :: string_attr 488 CHARACTER(len=*),INTENT(IN) :: glob_attr 489 490 INTEGER :: iret,nfid 491 LOGICAL :: l_dbg 492 !--------------------------------------------------------------------- 493 CALL ipsldbg (old_status=l_dbg) 494 495 nfid = W_F(idf)%ncfid 496 IF (l_dbg) WRITE(ipslout,*) "New global attribute : ",glob_attr 497 iret = NF90_PUT_ATT(nfid,NF90_GLOBAL,string_attr,glob_attr) 498 !----------------------- 499 END SUBROUTINE histglobal_attr 469 500 !=== 470 501 SUBROUTINE histh_reg1d & … … 612 643 ! 1.1 Create all the variables needed 613 644 !- 614 IF (l_dbg) WRITE( *,*) c_nam//" 1.0"645 IF (l_dbg) WRITE(ipslout,*) c_nam//" 1.0" 615 646 !- 616 647 nfid = W_F(idf)%ncfid … … 671 702 ! 2.0 Longitude 672 703 !- 673 IF (l_dbg) WRITE( *,*) c_nam//" 2.0"704 IF (l_dbg) WRITE(ipslout,*) c_nam//" 2.0" 674 705 !- 675 706 i_s = 1; … … 702 733 ! 3.0 Latitude 703 734 !- 704 IF (l_dbg) WRITE( *,*) c_nam//" 3.0"735 IF (l_dbg) WRITE(ipslout,*) c_nam//" 3.0" 705 736 !- 706 737 i_e = 2; … … 736 767 ! 4.0 storing the geographical coordinates 737 768 !- 738 IF (l_dbg) WRITE( *,*) c_nam//" 4.0"769 IF (l_dbg) WRITE(ipslout,*) c_nam//" 4.0" 739 770 !- 740 771 IF ( (k_typ == 1).OR.(k_typ == 2) ) THEN … … 833 864 ! Is the name already in use ? 834 865 !- 835 IF (l_dbg) WRITE( *,*) "histvert : 1.0 Verifications", &866 IF (l_dbg) WRITE(ipslout,*) "histvert : 1.0 Verifications", & 836 867 & pzaxname,'---',pzaxunit,'---',pzaxtitle 837 868 !- … … 883 914 !- 884 915 IF (l_dbg) & 885 & WRITE( *,*) "histvert : 2.0 Add the information to the file"916 & WRITE(ipslout,*) "histvert : 2.0 Add the information to the file" 886 917 !- 887 918 nfid = W_F(idf)%ncfid … … 918 949 !- 919 950 IF (l_dbg) & 920 & WRITE( *,*) "histvert : 3.0 add the information to the common"951 & WRITE(ipslout,*) "histvert : 3.0 add the information to the common" 921 952 !- 922 953 W_F(idf)%n_zax = iv … … 1016 1047 ! and verify that it does not already exist 1017 1048 !- 1018 IF (l_dbg) WRITE( *,*) "histdef : 1.0"1049 IF (l_dbg) WRITE(ipslout,*) "histdef : 1.0" 1019 1050 !- 1020 1051 IF (iv > 1) THEN … … 1070 1101 !- 1071 1102 IF (l_dbg) THEN 1072 WRITE( *,*) "histdef : 2.0",idf,iv,W_F(idf)%W_V(iv)%nbopp, &1103 WRITE(ipslout,*) "histdef : 2.0",idf,iv,W_F(idf)%W_V(iv)%nbopp, & 1073 1104 & W_F(idf)%W_V(iv)%sopp(1:W_F(idf)%W_V(iv)%nbopp), & 1074 1105 & W_F(idf)%W_V(iv)%scal(1:W_F(idf)%W_V(iv)%nbopp) … … 1164 1195 !- 1165 1196 IF (l_dbg) THEN 1166 WRITE( *,*) "histdef : 3.0"1197 WRITE(ipslout,*) "histdef : 3.0" 1167 1198 ENDIF 1168 1199 !- … … 1175 1206 & .AND.(TRIM(W_F(idf)%W_V(iv)%topp) /= "never") )THEN 1176 1207 ALLOCATE(W_F(idf)%W_V(iv)%t_bf(buff_sz)) 1177 W_F(idf)%W_V(iv)%t_bf(:) = 0.1208 W_F(idf)%W_V(iv)%t_bf(:) = missing_val 1178 1209 IF (l_dbg) THEN 1179 WRITE( *,*) "histdef : 3.0 allocating time_buffer for", &1210 WRITE(ipslout,*) "histdef : 3.0 allocating time_buffer for", & 1180 1211 & " idf = ",idf," iv = ",iv," size = ",buff_sz 1181 1212 ENDIF … … 1187 1218 ! The strategy is to bring it back to seconds for the tests 1188 1219 !- 1189 IF (l_dbg) WRITE( *,*) "histdef : 4.0"1220 IF (l_dbg) WRITE(ipslout,*) "histdef : 4.0" 1190 1221 !- 1191 1222 W_F(idf)%W_V(iv)%freq_opp = pfreq_opp … … 1272 1303 ! 5.0 Initialize other variables of the common 1273 1304 !- 1274 IF (l_dbg) WRITE( *,*) "histdef : 5.0"1305 IF (l_dbg) WRITE(ipslout,*) "histdef : 5.0" 1275 1306 !- 1276 1307 W_F(idf)%W_V(iv)%hist_wrt_rng = (PRESENT(var_range)) … … 1298 1329 ! 6.0 Get the time axis for this variable 1299 1330 !- 1300 IF (l_dbg) WRITE( *,*) "histdef : 6.0"1331 IF (l_dbg) WRITE(ipslout,*) "histdef : 6.0" 1301 1332 !- 1302 1333 ! No time axis for once, l_max, l_min or never operation … … 1331 1362 ELSE 1332 1363 IF (l_dbg) THEN 1333 WRITE( *,*) "histdef : 7.0 ",TRIM(W_F(idf)%W_V(iv)%topp),'----'1364 WRITE(ipslout,*) "histdef : 7.0 ",TRIM(W_F(idf)%W_V(iv)%topp),'----' 1334 1365 ENDIF 1335 1366 W_F(idf)%W_V(iv)%t_axid = -99 … … 1385 1416 ! 1.0 Create the time axes 1386 1417 !- 1387 IF (l_dbg) WRITE( *,*) "histend : 1.0"1418 IF (l_dbg) WRITE(ipslout,*) "histend : 1.0" 1388 1419 !- 1389 1420 ! 1.1 Define the time dimensions needed for this file … … 1473 1504 ! 2.0 declare the variables 1474 1505 !- 1475 IF (l_dbg) WRITE( *,*) "histend : 2.0"1506 IF (l_dbg) WRITE(ipslout,*) "histend : 2.0" 1476 1507 !- 1477 1508 DO iv=1,W_F(idf)%n_var … … 1575 1606 !- 1576 1607 IF (l_dbg) THEN 1577 WRITE( *,*) "histend : 2.0.n, freq_opp, freq_wrt", &1608 WRITE(ipslout,*) "histend : 2.0.n, freq_opp, freq_wrt", & 1578 1609 & W_F(idf)%W_V(iv)%freq_opp,W_F(idf)%W_V(iv)%freq_wrt 1579 1610 ENDIF … … 1596 1627 ! 3.0 Put the netcdf file into write mode 1597 1628 !- 1598 IF (l_dbg) WRITE( *,*) "histend : 3.0"1629 IF (l_dbg) WRITE(ipslout,*) "histend : 3.0" 1599 1630 !- 1600 1631 iret = NF90_ENDDEF (nfid) … … 1602 1633 ! 4.0 Give some informations to the user 1603 1634 !- 1604 IF (l_dbg) WRITE( *,*) "histend : 4.0"1635 IF (l_dbg) WRITE(ipslout,*) "histend : 4.0" 1605 1636 !- 1606 1637 WRITE(str70,'("All variables have been initialized on file :",I3)') idf … … 1682 1713 !- 1683 1714 IF (l_dbg) THEN 1684 WRITE( *,*) "histwrite : ",c_nam1715 WRITE(ipslout,*) "histwrite : ",c_nam 1685 1716 ENDIF 1686 1717 !- … … 1791 1822 IF (.NOT.ALLOCATED(tbf_1)) THEN 1792 1823 IF (l_dbg) THEN 1793 WRITE( *,*) &1824 WRITE(ipslout,*) & 1794 1825 & c_nam//" : allocate tbf_1 for size = ", & 1795 1826 & W_F(idf)%W_V(iv)%datasz_max … … 1798 1829 ELSE IF (W_F(idf)%W_V(iv)%datasz_max > SIZE(tbf_1)) THEN 1799 1830 IF (l_dbg) THEN 1800 WRITE( *,*) &1831 WRITE(ipslout,*) & 1801 1832 & c_nam//" : re-allocate tbf_1 for size = ", & 1802 1833 & W_F(idf)%W_V(iv)%datasz_max … … 1861 1892 INTEGER,DIMENSION(4) :: corner,edges 1862 1893 INTEGER :: itime 1894 LOGICAL :: flag 1863 1895 !- 1864 1896 REAL :: rtime … … 1871 1903 !- 1872 1904 IF (l_dbg) THEN 1873 WRITE( *,*) "histwrite 0.0 : VAR : ",W_F(idf)%W_V(iv)%v_name1874 WRITE( *,*) "histwrite 0.0 : nbindex :",nbindex1875 WRITE( *,*) "histwrite 0.0 : nindex :",nindex(1:MIN(3,nbindex)),'...'1905 WRITE(ipslout,*) "histwrite 0.0 : VAR : ",W_F(idf)%W_V(iv)%v_name 1906 WRITE(ipslout,*) "histwrite 0.0 : nbindex :",nbindex 1907 WRITE(ipslout,*) "histwrite 0.0 : nindex :",nindex(1:MIN(3,nbindex)),'...' 1876 1908 ENDIF 1877 1909 !- … … 1888 1920 IF (.NOT.ALLOCATED(tbf_2)) THEN 1889 1921 IF (l_dbg) THEN 1890 WRITE( *,*) "histwrite_real 1.1 allocate tbf_2 ",SIZE(tbf_1)1922 WRITE(ipslout,*) "histwrite_real 1.1 allocate tbf_2 ",SIZE(tbf_1) 1891 1923 ENDIF 1892 1924 ALLOCATE(tbf_2(W_F(idf)%W_V(iv)%datasz_max)) 1893 1925 ELSE IF (W_F(idf)%W_V(iv)%datasz_max > SIZE(tbf_2)) THEN 1894 1926 IF (l_dbg) THEN 1895 WRITE( *,*) "histwrite_real 1.2 re-allocate tbf_2 : ", &1927 WRITE(ipslout,*) "histwrite_real 1.2 re-allocate tbf_2 : ", & 1896 1928 & SIZE(tbf_1)," instead of ",SIZE(tbf_2) 1897 1929 ENDIF … … 1906 1938 !- 1907 1939 IF (l_dbg) THEN 1908 WRITE( *,*) "histwrite: 3.0",idf1940 WRITE(ipslout,*) "histwrite: 3.0",idf 1909 1941 ENDIF 1910 1942 !- … … 1924 1956 & nbout,tbf_2) 1925 1957 IF (l_dbg) THEN 1926 WRITE( *,*) &1958 WRITE(ipslout,*) & 1927 1959 & "histwrite: 3.4a nbout : ",nbin,nbout,W_F(idf)%W_V(iv)%sopp(io) 1928 1960 ENDIF … … 1934 1966 & nbout,tbf_1) 1935 1967 IF (l_dbg) THEN 1936 WRITE( *,*) &1968 WRITE(ipslout,*) & 1937 1969 & "histwrite: 3.4b nbout : ",nbin,nbout,W_F(idf)%W_V(iv)%sopp(io+1) 1938 1970 ENDIF … … 1942 1974 !- 1943 1975 IF (l_dbg) THEN 1944 WRITE( *,*) &1976 WRITE(ipslout,*) & 1945 1977 & "histwrite: 3.5 size(tbf_1) : ",SIZE(tbf_1) 1946 WRITE( *,*) &1978 WRITE(ipslout,*) & 1947 1979 & "histwrite: 3.5 slab in X :", & 1948 1980 & W_F(idf)%W_V(iv)%zorig(1),W_F(idf)%W_V(iv)%zsize(1) 1949 WRITE( *,*) &1981 WRITE(ipslout,*) & 1950 1982 & "histwrite: 3.5 slab in Y :", & 1951 1983 & W_F(idf)%W_V(iv)%zorig(2),W_F(idf)%W_V(iv)%zsize(2) 1952 WRITE( *,*) &1984 WRITE(ipslout,*) & 1953 1985 & "histwrite: 3.5 slab in Z :", & 1954 1986 & W_F(idf)%W_V(iv)%zorig(3),W_F(idf)%W_V(iv)%zsize(3) 1955 WRITE( *,*) &1987 WRITE(ipslout,*) & 1956 1988 & "histwrite: 3.5 slab of input:", & 1957 1989 & W_F(idf)%W_V(iv)%scsize(1), & … … 1999 2031 !- 2000 2032 IF (l_dbg) THEN 2001 WRITE( *,*) "histwrite: 4.0 tbf_1",idf,iv, &2033 WRITE(ipslout,*) "histwrite: 4.0 tbf_1",idf,iv, & 2002 2034 & TRIM(tmp_opp),' ---- ',LEN_TRIM(tmp_opp),nbindex 2003 2035 ENDIF … … 2016 2048 !- 2017 2049 IF (l_dbg) THEN 2018 WRITE( *,*) "histwrite: 5.0 idf : ",idf," iv : ",iv," tsz : ",tsz2050 WRITE(ipslout,*) "histwrite: 5.0 idf : ",idf," iv : ",iv," tsz : ",tsz 2019 2051 ENDIF 2020 2052 !- 2021 2053 IF ( (TRIM(tmp_opp) /= "inst") & 2022 2054 & .AND.(TRIM(tmp_opp) /= "once") ) THEN 2023 CALL moycum(tmp_opp,tsz,W_F(idf)%W_V(iv)%t_bf, & 2024 & tbf_2,W_F(idf)%W_V(iv)%nb_opp) 2055 2056 !- 2057 !------ 5.1 Check if scatter operation is performed 2058 !- 2059 flag = .FALSE. 2060 DO io = 1, nbopp_max 2061 IF ( INDEX(TRIM(W_F(idf)%W_V(iv)%sopp(io)),'scatter') > 0 ) THEN 2062 flag = .TRUE. 2063 END IF 2064 END DO 2065 2066 IF ( flag ) THEN 2067 !- 2068 !------ 5.2 Enter moycum_index only if a scatter operation is performed 2069 !- 2070 IF (l_dbg) & 2071 & WRITE(ipslout,*) "histwrite: 5.2 moycum_index",nbindex,nx,ny,nz 2072 CALL moycum_index(tmp_opp, W_F(idf)%W_V(iv)%t_bf, & 2073 & tbf_2, W_F(idf)%W_V(iv)%nb_opp, nbindex, nindex) 2074 ELSE 2075 !- 2076 !------ 5.3 Enter moycum otherwise 2077 !- 2078 IF (l_dbg) & 2079 & WRITE(ipslout,*) "histwrite: 5.3 moycum",nbindex,nx,ny 2080 CALL moycum(tmp_opp,tsz,W_F(idf)%W_V(iv)%t_bf, & 2081 & tbf_2,W_F(idf)%W_V(iv)%nb_opp) 2082 END IF 2083 2025 2084 ENDIF 2026 2085 !- … … 2032 2091 ! 6.0 Write to file if needed 2033 2092 !- 2034 IF (l_dbg) WRITE( *,*) "histwrite: 6.0",idf2093 IF (l_dbg) WRITE(ipslout,*) "histwrite: 6.0",idf 2035 2094 !- 2036 2095 IF (do_write) THEN … … 2041 2100 !-- 6.1 Do the operations that are needed before writting 2042 2101 !- 2043 IF (l_dbg) WRITE( *,*) "histwrite: 6.1",idf2102 IF (l_dbg) WRITE(ipslout,*) "histwrite: 6.1",idf 2044 2103 !- 2045 2104 IF ( (TRIM(tmp_opp) /= "inst") & … … 2055 2114 & .AND.(TRIM(tmp_opp) /= "once") ) THEN 2056 2115 !- 2057 IF (l_dbg) WRITE( *,*) "histwrite: 6.2",idf2116 IF (l_dbg) WRITE(ipslout,*) "histwrite: 6.2",idf 2058 2117 !- 2059 2118 itax = W_F(idf)%W_V(iv)%t_axid … … 2077 2136 !- 2078 2137 IF (l_dbg) THEN 2079 WRITE( *,*) "histwrite: 6.3",idf,nfid,nvid,iv,itime2138 WRITE(ipslout,*) "histwrite: 6.3",idf,nfid,nvid,iv,itime 2080 2139 ENDIF 2081 2140 !- … … 2159 2218 !- 2160 2219 IF (l_dbg) THEN 2161 WRITE( *,*) 'histvar_seq, start of the subroutine :',learning(idf)2220 WRITE(ipslout,*) 'histvar_seq, start of the subroutine :',learning(idf) 2162 2221 ENDIF 2163 2222 !- … … 2203 2262 & 'of your code. Thus if you wish to save time'// & 2204 2263 & ' contact the IOIPSL team. ') 2205 WRITE( *,*) 'The sequence we have found up to now :'2206 WRITE( *,*) varseq(idf,1:sp-1)2264 WRITE(ipslout,*) 'The sequence we have found up to now :' 2265 WRITE(ipslout,*) varseq(idf,1:sp-1) 2207 2266 varseq_err(idf) = -1 2208 2267 ENDIF … … 2249 2308 ENDIF 2250 2309 varseq_err(idf) = varseq_err(idf)+1 2310 IF (l_dbg) & 2311 WRITE(ipslout,*) "Error history file ",W_F(idf)%name," names : ", & 2312 & TRIM(W_F(idf)%W_V(idv)%v_name),TRIM(pvarname)," id : ",idv 2251 2313 ELSE 2252 2314 !- … … 2268 2330 !- 2269 2331 IF (l_dbg) THEN 2270 WRITE( *,*) &2332 WRITE(ipslout,*) & 2271 2333 & 'histvar_seq, end of the subroutine :',TRIM(pvarname),idv 2272 2334 ENDIF … … 2294 2356 !- 2295 2357 IF (l_dbg) THEN 2296 WRITE( *,*) "->histsync"2358 WRITE(ipslout,*) "->histsync" 2297 2359 ENDIF 2298 2360 !- … … 2319 2381 IF (W_F(ifile)%ncfid > 0) THEN 2320 2382 IF (l_dbg) THEN 2321 WRITE( *,*) ' histsync - synchronising file number ',ifile2383 WRITE(ipslout,*) ' histsync - synchronising file number ',ifile 2322 2384 ENDIF 2323 2385 iret = NF90_SYNC(W_F(ifile)%ncfid) … … 2326 2388 !- 2327 2389 IF (l_dbg) THEN 2328 WRITE( *,*) "<-histsync"2390 WRITE(ipslout,*) "<-histsync" 2329 2391 ENDIF 2330 2392 !---------------------- … … 2349 2411 !- 2350 2412 IF (l_dbg) THEN 2351 WRITE( *,*) "->histclo"2413 WRITE(ipslout,*) "->histclo" 2352 2414 ENDIF 2353 2415 !- … … 2374 2436 IF (W_F(ifile)%ncfid > 0) THEN 2375 2437 IF (l_dbg) THEN 2376 WRITE( *,*) ' histclo - closing specified file number :',ifile2438 WRITE(ipslout,*) ' histclo - closing specified file number :',ifile 2377 2439 ENDIF 2378 2440 nfid = W_F(ifile)%ncfid … … 2382 2444 !----- 2383 2445 IF (l_dbg) THEN 2384 WRITE( *,*) ' Entering loop on vars : ',W_F(ifile)%n_var2446 WRITE(ipslout,*) ' Entering loop on vars : ',W_F(ifile)%n_var 2385 2447 ENDIF 2386 2448 DO iv=1,W_F(ifile)%n_var … … 2388 2450 IF (W_F(ifile)%W_V(iv)%hist_wrt_rng) THEN 2389 2451 IF (l_dbg) THEN 2390 WRITE( *,*) 'min value for file :',ifile,' var n. :',iv, &2452 WRITE(ipslout,*) 'min value for file :',ifile,' var n. :',iv, & 2391 2453 & ' is : ',W_F(ifile)%W_V(iv)%hist_minmax(1) 2392 WRITE( *,*) 'max value for file :',ifile,' var n. :',iv, &2454 WRITE(ipslout,*) 'max value for file :',ifile,' var n. :',iv, & 2393 2455 & ' is : ',W_F(ifile)%W_V(iv)%hist_minmax(2) 2394 2456 ENDIF … … 2420 2482 !---- 2. Close the file 2421 2483 !----- 2422 IF (l_dbg) WRITE( *,*) ' close file :',nfid2484 IF (l_dbg) WRITE(ipslout,*) ' close file :',nfid 2423 2485 iret = NF90_CLOSE(nfid) 2424 2486 W_F(ifile)%ncfid = -1 … … 2428 2490 !- 2429 2491 IF (l_dbg) THEN 2430 WRITE( *,*) "<-histclo"2492 WRITE(ipslout,*) "<-histclo" 2431 2493 ENDIF 2432 2494 !--------------------- -
dynamico_lmdz/aquaplanet/IOIPSL/src/mathelp.f90
r3847 r3907 1 1 MODULE mathelp 2 2 !- 3 !$Id: mathelp.f90 845 2009-12-10 16:26:03Z bellier$3 !$Id: mathelp.f90 1927 2012-11-22 13:54:21Z dsolyga $ 4 4 !- 5 5 ! This software is governed by the CeCILL license … … 10 10 !- 11 11 PRIVATE 12 PUBLIC :: mathop,moycum, buildop12 PUBLIC :: mathop,moycum,moycum_index,buildop 13 13 !- 14 14 INTERFACE mathop … … 3119 3119 END SUBROUTINE moycum 3120 3120 !=== 3121 SUBROUTINE moycum_index( opp, px, py, pwx, nbi, ind ) 3122 !--------------------------------------------------------------------- 3123 !- Does time operations on index points 3124 !--------------------------------------------------------------------- 3125 IMPLICIT NONE 3126 !- 3127 3128 !! 0. Parameters and variables declaration 3129 3130 !! 0.1 Input variables 3131 3132 CHARACTER(LEN=7), INTENT(in) :: opp !! Operation performed 3133 INTEGER, INTENT(in) :: nbi !! Size of index vector 3134 INTEGER, DIMENSION(nbi), INTENT(in) :: ind !! Index vector 3135 REAL, DIMENSION(:), INTENT(in) :: py !! Vector containing the 3136 !! previous values of px 3137 !! Warning : due to memory 3138 !! optimization, we have 3139 !! generally SIZE(px) /= SIZE(py) 3140 INTEGER, INTENT(in) :: pwx !! Used to calculate average value 3141 3142 !! 0.3 Modified variables 3143 3144 REAL, DIMENSION(:), INTENT(inout) :: px !! Result 3145 3146 !! 0.4 Local variables 3147 3148 INTEGER :: ig !! Index 3149 3150 !--------------------------------------------------------------------- 3151 3152 !! Perform operations only if the values of ind don't exceed the size of px 3153 3154 IF ( MAXVAL(ind) > SIZE(px) ) THEN 3155 CALL ipslerr(3,"moycum_index", & 3156 & "the index vector is out of range for px", & 3157 & "Indexation vector problem. We stop", " " ) 3158 END IF 3159 3160 IF (pwx /= 0) THEN 3161 IF (opp == 'ave') THEN 3162 DO ig = 1,nbi 3163 px(ind(ig)) = (px(ind(ig))*pwx + py(ind(ig)))/REAL(pwx+1) 3164 END DO 3165 ELSE IF (opp == 't_sum') THEN 3166 DO ig = 1,nbi 3167 px(ind(ig)) = px(ind(ig)) + py(ind(ig)) 3168 END DO 3169 ELSE IF ( (opp == 'l_min').OR.(opp == 't_min') ) THEN 3170 DO ig = 1,nbi 3171 px(ind(ig)) = MIN(px(ind(ig)),py(ind(ig))) 3172 END DO 3173 ELSE IF ( (opp == 'l_max').OR.(opp == 't_max') ) THEN 3174 DO ig = 1,nbi 3175 px(ind(ig)) = MAX(px(ind(ig)),py(ind(ig))) 3176 END DO 3177 ELSE 3178 CALL ipslerr(3,"moycum_index",'Unknown time operation',opp,' ') 3179 END IF 3180 ELSE 3181 IF (opp == 'l_min') THEN 3182 DO ig = 1,nbi 3183 px(ind(ig)) = MIN(px(ind(ig)),py(ind(ig))) 3184 END DO 3185 ELSE IF (opp == 'l_max') THEN 3186 DO ig = 1,nbi 3187 px(ind(ig)) = MAX(px(ind(ig)),py(ind(ig))) 3188 END DO 3189 ELSE 3190 DO ig = 1,nbi 3191 px(ind(ig)) = py(ind(ig)) 3192 END DO 3193 ENDIF 3194 END IF 3195 3196 END SUBROUTINE moycum_index 3197 3198 3121 3199 !----------------- 3122 3200 END MODULE mathelp -
dynamico_lmdz/aquaplanet/IOIPSL/src/restcom.f90
r3847 r3907 1 1 MODULE restcom 2 2 !- 3 !$Id: restcom.f90 430 2008-10-23 14:33:11Z bellier$3 !$Id: restcom.f90 2020 2013-03-07 09:22:15Z jgipsl $ 4 4 !- 5 5 ! This software is governed by the CeCILL license … … 8 8 USE netcdf 9 9 !- 10 USE errioipsl, ONLY : ipslerr,ipsldbg 10 USE errioipsl, ONLY : ipslerr,ipsldbg, ipslout 11 11 USE stringop 12 12 USE calendar … … 49 49 INTEGER,SAVE :: nb_fi = 0 50 50 INTEGER,DIMENSION(max_file,2),SAVE :: netcdf_id = -1 51 CHARACTER(LEN=120),DIMENSION(max_file,2),SAVE :: netcdf_name='NONE' 51 52 !- 52 53 ! Description of the content of the 'in' files and the 'out' files. … … 230 231 !- 231 232 IF (l_dbg) THEN 232 WRITE( *,*) 'restini 0.0 : ',TRIM(fnamein),' , ',TRIM(fnameout)233 WRITE(ipslout,*) 'restini 0.0 : ',TRIM(fnamein),' , ',TRIM(fnameout) 233 234 ENDIF 234 235 !- … … 254 255 !- 255 256 IF (l_dbg) THEN 256 WRITE( *,*) 'restini 0.1 l_fi, l_fo, l_rw : ',l_fi,l_fo,l_rw257 WRITE(ipslout,*) 'restini 0.1 l_fi, l_fo, l_rw : ',l_fi,l_fo,l_rw 257 258 ENDIF 258 259 !- … … 261 262 IF (l_fi) THEN 262 263 !--- 263 IF (l_dbg) WRITE( *,*) 'restini 1.0 : Open input file'264 IF (l_dbg) WRITE(ipslout,*) 'restini 1.0 : Open input file' 264 265 !-- Add DOMAIN number and ".nc" suffix in file names if needed 265 266 fname = fnamein … … 268 269 CALL restopenin (nb_fi,fname,l_rw,iim,jjm,lon,lat,llm,lev,ncfid) 269 270 netcdf_id(nb_fi,1) = ncfid 271 netcdf_name(nb_fi,1) = TRIM(fnamein) 270 272 !--- 271 273 !-- 1.3 Extract the time information … … 284 286 !-- 2.0 The case of a missing restart file is dealt with 285 287 !--- 286 IF (l_dbg) WRITE( *,*) 'restini 2.0'288 IF (l_dbg) WRITE(ipslout,*) 'restini 2.0' 287 289 !--- 288 290 IF ( (ALL(MINLOC(lon(:iim,:jjm)) == MAXLOC(lon(:iim,:jjm)))) & … … 324 326 (nb_fi,fname,iim,jjm,lon,lat,llm,lev,dt,date0,ncfid,domain_id) 325 327 netcdf_id(nb_fi,2) = ncfid 328 netcdf_name(nb_fi,2) = TRIM(fnameout) 326 329 ELSE IF (l_fi.AND.l_fo) THEN 327 330 netcdf_id(nb_fi,2) = netcdf_id(nb_fi,1) 331 netcdf_name(nb_fi,2) = netcdf_name(nb_fi,1) 328 332 varname_out(nb_fi,:) = varname_in(nb_fi,:) 329 333 nbvar_out(nb_fi) = nbvar_in(nb_fi) … … 340 344 !- 341 345 IF (l_dbg) THEN 342 WRITE( *,*) 'restini 2.3 : Configure calendar if needed : ', &346 WRITE(ipslout,*) 'restini 2.3 : Configure calendar if needed : ', & 343 347 calend_str 344 348 ENDIF … … 347 351 CALL ioconf_calendar (calend_str) 348 352 IF (l_dbg) THEN 349 WRITE( *,*) 'restini 2.3b : new calendar : ',calend_str353 WRITE(ipslout,*) 'restini 2.3b : new calendar : ',calend_str 350 354 ENDIF 351 355 ENDIF … … 359 363 fid = nb_fi 360 364 IF (l_dbg) THEN 361 WRITE( *,*) 'SIZE of t_index :',SIZE(t_index), &365 WRITE(ipslout,*) 'SIZE of t_index :',SIZE(t_index), & 362 366 SIZE(t_index,dim=1),SIZE(t_index,dim=2) 363 WRITE( *,*) 't_index = ',t_index(fid,:)367 WRITE(ipslout,*) 't_index = ',t_index(fid,:) 364 368 ENDIF 365 369 itau = t_index(fid,1) 366 370 !- 367 IF (l_dbg) WRITE( *,*) 'restini END'371 IF (l_dbg) WRITE(ipslout,*) 'restini END' 368 372 !--------------------- 369 373 END SUBROUTINE restini … … 502 506 ! 2.0 Get the list of variables 503 507 !- 504 IF (l_dbg) WRITE( *,*) 'restopenin 1.2'508 IF (l_dbg) WRITE(ipslout,*) 'restopenin 1.2' 505 509 !- 506 510 lat_vid = -1 … … 663 667 CALL ioconf_calendar (calendar) 664 668 IF (l_dbg) THEN 665 WRITE( *,*) 'restsett : calendar of the restart ',calendar669 WRITE(ipslout,*) 'restsett : calendar of the restart ',calendar 666 670 ENDIF 667 671 ENDIF … … 669 673 CALL ioget_calendar (one_year,one_day) 670 674 IF (l_dbg) THEN 671 WRITE( *,*) 'one_year,one_day = ',one_year,one_day675 WRITE(ipslout,*) 'one_year,one_day = ',one_year,one_day 672 676 ENDIF 673 677 !- … … 681 685 t_index(nb_fi,:) = itau 682 686 IF (l_dbg) THEN 683 WRITE( *,*) "nb_fi,t_index",nb_fi,t_index(nb_fi,:)687 WRITE(ipslout,*) "nb_fi,t_index",nb_fi,t_index(nb_fi,:) 684 688 ENDIF 685 689 CALL ju2ymds (date0,year0,month0,day0,sec0) … … 691 695 strc=':' 692 696 IF (l_dbg) THEN 693 WRITE( *,*) date0697 WRITE(ipslout,*) date0 694 698 WRITE (UNIT=itau_orig,FMT='(I4.4,5(A,I2.2))') & 695 699 & year0,'-',month0,'-',day0,' ',hours0,':',minutes0,':',seci 696 WRITE( *,*) "itau_orig : ",itau_orig700 WRITE(ipslout,*) "itau_orig : ",itau_orig 697 701 ENDIF 698 702 ELSE 699 703 iret = NF90_GET_VAR(ncfid,tind_varid_in(nb_fi),t_index(nb_fi,:)) 700 704 IF (l_dbg) THEN 701 WRITE( *,*) "restsett, time axis : ",t_index(nb_fi,:)705 WRITE(ipslout,*) "restsett, time axis : ",t_index(nb_fi,:) 702 706 ENDIF 703 707 iret = NF90_GET_ATT(ncfid,tind_varid_in(nb_fi),'units',itau_orig) … … 727 731 iret = NF90_GET_ATT(ncfid,tax_varid_in(nb_fi),'calendar',tmp_cal) 728 732 IF (l_dbg) THEN 729 WRITE( *,*) 'restsett : tmp_calendar of the restart ',tmp_cal733 WRITE(ipslout,*) 'restsett : tmp_calendar of the restart ',tmp_cal 730 734 ENDIF 731 735 !--- … … 744 748 !-- to get ride of the intial date. 745 749 !--- 746 IF (l_dbg) WRITE( *,*) 'tax_orig : ',TRIM(tax_orig)750 IF (l_dbg) WRITE(ipslout,*) 'tax_orig : ',TRIM(tax_orig) 747 751 READ (UNIT=tax_orig,FMT='(I4.4,5(a,I2.2))') & 748 752 year0,strc,month0,strc,day0,strc, & … … 831 835 CALL ipsldbg (old_status=l_dbg) 832 836 !- 833 IF (l_dbg) WRITE( *,*) "restopenout 0.0 ",TRIM(fname)837 IF (l_dbg) WRITE(ipslout,*) "restopenout 0.0 ",TRIM(fname) 834 838 !- 835 839 ! If we use the same file for input and output 836 840 !- we will not even call restopenout 837 841 !- 838 iret = NF90_CREATE(fname, NF90_NOCLOBBER,ncfid)842 iret = NF90_CREATE(fname,cmode=or(NF90_NOCLOBBER,NF90_64BIT_OFFSET),ncid=ncfid) 839 843 IF (iret == -35) THEN 840 844 CALL ipslerr (3,'restopenout',& … … 863 867 ! 1.0 Longitude 864 868 !- 865 IF (l_dbg) WRITE( *,*) "restopenout 1.0"869 IF (l_dbg) WRITE(ipslout,*) "restopenout 1.0" 866 870 !- 867 871 iret = NF90_DEF_VAR(ncfid,"nav_lon",NF90_FLOAT,(/x_id,y_id/),nlonid) … … 873 877 ! 2.0 Latitude 874 878 !- 875 IF (l_dbg) WRITE( *,*) "restopenout 2.0"879 IF (l_dbg) WRITE(ipslout,*) "restopenout 2.0" 876 880 !- 877 881 iret = NF90_DEF_VAR(ncfid,"nav_lat",NF90_FLOAT,(/x_id,y_id/),nlatid) … … 883 887 ! 3.0 Levels 884 888 !- 885 IF (l_dbg) WRITE( *,*) "restopenout 3.0"889 IF (l_dbg) WRITE(ipslout,*) "restopenout 3.0" 886 890 !- 887 891 iret = NF90_DEF_VAR(ncfid,"nav_lev",NF90_FLOAT,z_id,nlevid) … … 895 899 ! 4.0 Time axis, this is the seconds since axis 896 900 !- 897 IF (l_dbg) WRITE( *,*) "restopenout 4.0"901 IF (l_dbg) WRITE(ipslout,*) "restopenout 4.0" 898 902 !- 899 903 iret = NF90_DEF_VAR(ncfid,"time",NF90_FLOAT, & … … 923 927 ! 5.0 Time axis, this is the time steps since axis 924 928 !- 925 IF (l_dbg) WRITE( *,*) "restopenout 5.0"929 IF (l_dbg) WRITE(ipslout,*) "restopenout 5.0" 926 930 !- 927 931 iret = NF90_DEF_VAR(ncfid,"time_steps",NF90_INT, & … … 984 988 iret = NF90_REDEF(ncfid) 985 989 !- 986 IF (l_dbg) WRITE( *,*) "restopenout END"990 IF (l_dbg) WRITE(ipslout,*) "restopenout END" 987 991 !------------------------- 988 992 END SUBROUTINE restopenout … … 1372 1376 CHARACTER(LEN=80) attname 1373 1377 INTEGER,DIMENSION(4) :: corner,edge 1374 !--------------------------------------------------------------------- 1378 LOGICAL :: l_dbg 1379 !--------------------------------------------------------------------- 1380 CALL ipsldbg (old_status=l_dbg) 1381 !--------------------------------------------------------------------- 1382 IF (l_dbg) WRITE(ipslout,*) 'RESTGET 0.0 : ',netcdf_name(fid,2),vname_q,iim,jjm,llm,itau,def_beha 1383 !- 1375 1384 ncfid = netcdf_id(fid,1) 1376 1385 !- … … 1379 1388 ! 1.0 If the variable is not present then ERROR or filled up 1380 1389 ! by default values if allowed 1390 !- 1391 IF (l_dbg) WRITE(ipslout,*) 'RESTGET 1.0 : ',vnb 1381 1392 !- 1382 1393 IF (vnb < 0) THEN … … 1402 1413 !----- 1403 1414 CALL restdefv (fid,vname_q,iim,jjm,llm,.TRUE.) 1415 IF (l_dbg) WRITE(ipslout,*) 'RESTGET 1.1 : ',vnb 1404 1416 !----- 1405 1417 ELSE … … 1416 1428 !--- 1417 1429 vid = varid_in(fid,vnb) 1430 IF (l_dbg) WRITE(ipslout,*) 'RESTGET 2.0 : ',vid 1418 1431 !--- 1419 1432 nbvar_read(fid) = nbvar_read(fid)+1 … … 1437 1450 & str,'is not available in the current file',' ') 1438 1451 ENDIF 1452 IF (l_dbg) WRITE(ipslout,*) 'RESTGET 3.0 : ',index 1439 1453 !--- 1440 1454 !-- 4.0 Read the data. Note that the variables in the restart files … … 1488 1502 iret = NF90_GET_VAR(ncfid,vid,var, & 1489 1503 & start=corner(1:ndim),count=edge(1:ndim)) 1504 IF (l_dbg) WRITE(ipslout,*) 'RESTGET 4.0 : ',iret 1490 1505 !--- 1491 1506 !-- 5.0 The variable we have just read is created … … 1900 1915 CALL ioget_calendar (one_year,one_day) 1901 1916 !- 1917 ! 0.0 show arguments 1918 IF (l_dbg) WRITE(ipslout,*) 'RESTPUT 0.0 : ',netcdf_name(fid,2),vname_q,iim,jjm,llm,itau 1919 !- 1902 1920 ! 1.0 Check if the variable is already present 1903 1921 !- 1904 IF (l_dbg) WRITE( *,*) 'RESTPUT 1.0 : ',TRIM(vname_q)1922 IF (l_dbg) WRITE(ipslout,*) 'RESTPUT 1.0 : ',TRIM(vname_q) 1905 1923 !- 1906 1924 CALL find_str (varname_out(fid,1:nbvar_out(fid)),vname_q,vnb) 1907 1925 !- 1908 1926 IF (l_dbg) THEN 1909 WRITE( *,*) 'RESTPUT 1.1 : ',varname_out(fid,1:nbvar_out(fid)),vnb1927 WRITE(ipslout,*) 'RESTPUT 1.1 : ',varname_out(fid,1:nbvar_out(fid)),vnb 1910 1928 ENDIF 1911 1929 !- … … 1919 1937 vid = varid_out(fid,vnb) 1920 1938 !- 1921 IF (l_dbg) WRITE( *,*) 'RESTPUT 2.0 : ',vnb,vid1939 IF (l_dbg) WRITE(ipslout,*) 'RESTPUT 2.0 : ',vnb,vid 1922 1940 !- 1923 1941 ! 2.1 Is this file already in write mode ? … … 1932 1950 ! If not then check that all variables of previous time is OK. 1933 1951 !- 1934 IF (l_dbg) WRITE( *,*) 'RESTPUT 3.0 : ',itau,itau_out(fid)1952 IF (l_dbg) WRITE(ipslout,*) 'RESTPUT 3.0 : ',itau,itau_out(fid) 1935 1953 !- 1936 1954 IF (itau /= itau_out(fid)) THEN … … 1942 1960 IF (tstp_out(fid) == 0) THEN 1943 1961 IF (nbvar_out(fid) < nbvar_read(fid)) THEN 1944 WRITE( *,*) "ERROR :",tstp_out(fid), &1962 WRITE(ipslout,*) "ERROR :",tstp_out(fid), & 1945 1963 nbvar_out(fid),nbvar_read(fid) 1946 1964 CALL ipslerr (1,'restput', & … … 1955 1973 ENDDO 1956 1974 IF (ierr > 0) THEN 1957 WRITE( *,*) "ERROR :",nbvar_out(fid)1975 WRITE(ipslout,*) "ERROR :",nbvar_out(fid) 1958 1976 CALL ipslerr (1,'restput', & 1959 1977 & 'There are fewer variables in the output file for this', & … … 1971 1989 !--- 1972 1990 IF (l_dbg) THEN 1973 WRITE( *,*) 'RESTPUT 3.1 : ',itau,secsince,corner(1),edge(1)1991 WRITE(ipslout,*) 'RESTPUT 3.1 : ',itau,secsince,corner(1),edge(1) 1974 1992 ENDIF 1975 1993 !--- … … 2053 2071 IF (itau_out(fid) >= 0) THEN 2054 2072 iret = NF90_REDEF(ncfid) 2073 IF (l_dbg) THEN 2074 WRITE(ipslout,*) 'restdefv 0.0 : REDEF',itau_out(fid) 2075 ENDIF 2055 2076 ENDIF 2056 2077 !- … … 2058 2079 !- 2059 2080 IF (l_dbg) THEN 2060 WRITE( *,*) 'restdefv 1.0 :',TRIM(varname),nbvar_out(fid)2081 WRITE(ipslout,*) 'restdefv 1.0 :',TRIM(varname),nbvar_out(fid) 2061 2082 ENDIF 2062 2083 !- … … 2134 2155 !- 2135 2156 IF (l_dbg) THEN 2136 WRITE( *,*) 'restdefv 2.0 :',ndim,' :: ',dims(1:ndim),tdimid_out(fid)2157 WRITE(ipslout,*) 'restdefv 2.0 :',ndim,' :: ',dims(1:ndim),tdimid_out(fid) 2137 2158 ENDIF 2138 2159 !- … … 2169 2190 !- 2170 2191 IF (l_dbg) THEN 2171 WRITE( *,*) &2192 WRITE(ipslout,*) & 2172 2193 & 'restdefv 3.0 : LIST OF VARS ',varname_out(fid,1:nbvar_out(fid)) 2173 2194 ENDIF … … 2193 2214 IF (.NOT.ALLOCATED(t_index) .AND. .NOT.ALLOCATED(t_julian)) THEN 2194 2215 IF (l_msg) THEN 2195 WRITE( *,*) TRIM(c_p)//' : Allocate times axes at :', &2216 WRITE(ipslout,*) TRIM(c_p)//' : Allocate times axes at :', & 2196 2217 & max_file,tax_size_in(nb_fi) 2197 2218 ENDIF … … 2199 2220 ALLOCATE(t_index(max_file,tax_size_in(nb_fi)),STAT=i_err) 2200 2221 IF (i_err/=0) THEN 2201 WRITE( *,*) "ERROR IN ALLOCATION of t_index : ",i_err2222 WRITE(ipslout,*) "ERROR IN ALLOCATION of t_index : ",i_err 2202 2223 CALL ipslerr (3,TRIM(c_p), & 2203 2224 & 'Problem in allocation of t_index','', & … … 2208 2229 ALLOCATE(t_julian(max_file,tax_size_in(nb_fi)),STAT=i_err) 2209 2230 IF (i_err/=0) THEN 2210 WRITE( *,*) "ERROR IN ALLOCATION of t_julian : ",i_err2231 WRITE(ipslout,*) "ERROR IN ALLOCATION of t_julian : ",i_err 2211 2232 CALL ipslerr (3,TRIM(c_p), & 2212 2233 & 'Problem in allocation of max_file,tax_size_in','', & … … 2217 2238 & .OR.(SIZE(t_julian,DIM=2) < tax_size_in(nb_fi)) ) THEN 2218 2239 IF (l_msg) THEN 2219 WRITE( *,*) TRIM(c_p)//' : Reallocate times axes at :', &2240 WRITE(ipslout,*) TRIM(c_p)//' : Reallocate times axes at :', & 2220 2241 & max_file,tax_size_in(nb_fi) 2221 2242 ENDIF … … 2223 2244 ALLOCATE (tmp_index(max_file,tax_size_in(nb_fi)),STAT=i_err) 2224 2245 IF (i_err/=0) THEN 2225 WRITE( *,*) "ERROR IN ALLOCATION of tmp_index : ",i_err2246 WRITE(ipslout,*) "ERROR IN ALLOCATION of tmp_index : ",i_err 2226 2247 CALL ipslerr (3,TRIM(c_p), & 2227 2248 & 'Problem in allocation of tmp_index','', & … … 2233 2254 ALLOCATE (t_index(max_file,tax_size_in(nb_fi)),STAT=i_err) 2234 2255 IF (i_err/=0) THEN 2235 WRITE( *,*) "ERROR IN ALLOCATION of t_index : ",i_err2256 WRITE(ipslout,*) "ERROR IN ALLOCATION of t_index : ",i_err 2236 2257 CALL ipslerr (3,TRIM(c_p), & 2237 2258 & 'Problem in reallocation of t_index','', & … … 2242 2263 ALLOCATE (tmp_julian(max_file,tax_size_in(nb_fi)),STAT=i_err) 2243 2264 IF (i_err/=0) THEN 2244 WRITE( *,*) "ERROR IN ALLOCATION of tmp_julian : ",i_err2265 WRITE(ipslout,*) "ERROR IN ALLOCATION of tmp_julian : ",i_err 2245 2266 CALL ipslerr (3,TRIM(c_p), & 2246 2267 & 'Problem in allocation of tmp_julian','', & … … 2252 2273 ALLOCATE (t_julian(max_file,tax_size_in(nb_fi)),STAT=i_err) 2253 2274 IF (i_err/=0) THEN 2254 WRITE( *,*) "ERROR IN ALLOCATION of t_julian : ",i_err2275 WRITE(ipslout,*) "ERROR IN ALLOCATION of t_julian : ",i_err 2255 2276 CALL ipslerr (3,TRIM(c_p), & 2256 2277 & 'Problem in reallocation of t_julian','', & … … 2308 2329 IF ( (l_alloc1.AND.ALLOCATED(buff_tmp1)) & 2309 2330 & .OR.(l_alloc2.AND.ALLOCATED(buff_tmp2)) ) THEN 2310 WRITE( *,*) TRIM(c_p)//" : re_allocate "//TRIM(cbn)//"=",i_qsz2331 WRITE(ipslout,*) TRIM(c_p)//" : re_allocate "//TRIM(cbn)//"=",i_qsz 2311 2332 ELSE 2312 WRITE( *,*) TRIM(c_p)//" : allocate "//TRIM(cbn)//"=",i_qsz2333 WRITE(ipslout,*) TRIM(c_p)//" : allocate "//TRIM(cbn)//"=",i_qsz 2313 2334 ENDIF 2314 2335 ENDIF … … 2479 2500 !--- 2480 2501 IF (l_dbg) THEN 2481 WRITE( *,*) &2502 WRITE(ipslout,*) & 2482 2503 'restclo : Closing specified restart file number :', & 2483 fid,netcdf_id(fid,1:2) 2504 fid,netcdf_id(fid,1:2),netcdf_name(fid,1:2) 2484 2505 ENDIF 2485 2506 !--- … … 2490 2511 WRITE (n_f,'(I3)') netcdf_id(fid,1) 2491 2512 CALL ipslerr (2,'restclo', & 2492 "Error "//n_e//" in closing file : "//n_f, '',' ')2513 "Error "//n_e//" in closing file : "//n_f,netcdf_name(fid,1),' ') 2493 2514 ENDIF 2494 2515 IF (netcdf_id(fid,1) == netcdf_id(fid,2)) THEN 2495 2516 netcdf_id(fid,2) = -1 2517 netcdf_name(fid,2) = 'NONE' 2496 2518 ENDIF 2497 2519 netcdf_id(fid,1) = -1 2520 netcdf_name(fid,1) = 'NONE' 2498 2521 ENDIF 2499 2522 !--- … … 2504 2527 WRITE (n_f,'(I3)') netcdf_id(fid,2) 2505 2528 CALL ipslerr (2,'restclo', & 2506 "Error "//n_e//" in closing file : "//n_f, '',' ')2529 "Error "//n_e//" in closing file : "//n_f,netcdf_name(fid,2),' ') 2507 2530 ENDIF 2508 2531 netcdf_id(fid,2) = -1 2532 netcdf_name(fid,2) = 'NONE' 2509 2533 ENDIF 2510 2534 !--- 2511 2535 ELSE 2512 2536 !--- 2513 IF (l_dbg) WRITE( *,*) 'restclo : Closing all files'2537 IF (l_dbg) WRITE(ipslout,*) 'restclo : Closing all files' 2514 2538 !--- 2515 2539 DO ifnc=1,nb_fi … … 2520 2544 WRITE (n_f,'(I3)') netcdf_id(ifnc,1) 2521 2545 CALL ipslerr (2,'restclo', & 2522 "Error "//n_e//" in closing file : "//n_f,'',' ') 2546 "Error "//n_e//" in closing file : "//n_f,netcdf_name(ifnc,1),' ') 2547 ENDIF 2548 IF (l_dbg) THEN 2549 WRITE(ipslout,*) & 2550 'restclo : Closing specified restart file number :', & 2551 ifnc,netcdf_id(ifnc,1:2),netcdf_name(ifnc,1:2) 2523 2552 ENDIF 2524 2553 IF (netcdf_id(ifnc,1) == netcdf_id(ifnc,2)) THEN 2525 2554 netcdf_id(ifnc,2) = -1 2555 netcdf_name(ifnc,2) = 'NONE' 2526 2556 ENDIF 2527 2557 netcdf_id(ifnc,1) = -1 2558 netcdf_name(ifnc,1) = 'NONE' 2528 2559 ENDIF 2529 2560 !----- … … 2534 2565 WRITE (n_f,'(I3)') netcdf_id(ifnc,2) 2535 2566 CALL ipslerr (2,'restclo', & 2536 "Error "//n_e//" in closing file : "//n_f,'',' ') 2567 "Error "//n_e//" in closing file : "//n_f,netcdf_name(ifnc,2),' ') 2568 END IF 2569 IF (l_dbg) THEN 2570 WRITE(ipslout,*) & 2571 'restclo : Closing specified restart file number :', & 2572 ifnc,netcdf_id(ifnc,1:2),netcdf_name(ifnc,1:2) 2537 2573 END IF 2538 2574 netcdf_id(ifnc,2) = -1 2575 netcdf_name(ifnc,2) = 'NONE' 2539 2576 ENDIF 2540 2577 ENDDO
Note: See TracChangeset
for help on using the changeset viewer.