- Timestamp:
- 07/25/08 12:58:01 (16 years ago)
- Location:
- IOIPSL/trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
IOIPSL/trunk/src/fliocom.f90
r329 r362 171 171 !! Attributes Values 172 172 !! 'axis' "Z" 173 !! 'standard_name' " level"173 !! 'standard_name' "model_level_number" 174 174 !! 'units' "sigma_level" 175 175 !! 'long_name' "Sigma Levels" … … 613 613 !! which are spatio-temporal coordinates (x/y/z/t). 614 614 !! 615 !!-- Rule 1 : we look for a correct "axis" attribute 615 !!-- Rule 1 : we look for a variable with one dimension 616 !!-- and which has the same name as its dimension 617 !! 618 !!-- Rule 2 : we look for a correct "axis" attribute 616 619 !! 617 620 !! Axis Axis attribute Number of dimensions … … 623 626 !! t T 1 624 627 !! 625 !!-- Rule 2 : we look for a specific name 626 !! 627 !! Axis Names 628 !! 629 !! x 'nav_lon' 'lon' 'longitude' 630 !! y 'nav_lat' 'lat' 'latitude' 631 !! z 'depth' 'deptht' 'height' 'level' 632 !! 'lev' 'plev' 'sigma_level' 'layer' 633 !! t 'time' 'tstep' 'timesteps' 634 !! 635 !!-- Rule 3 : we look for a variable with one dimension 636 !!-- and which has the same name as its dimension 628 !!-- Rule 3 : we look for a correct "standard_name" attribute 629 !! 630 !! Axis Axis attribute Number of dimensions 631 !! (case insensitive) 632 !! 633 !! x longitude 1/2 634 !! y latitude 1/2 635 !! z model_level_number 1 636 !! t time 1 637 !! 638 !!-- Rule 4 : we look for a specific name 639 !! 640 !! Axis Names 641 !! 642 !! x 'nav_lon' 'lon' 'longitude' 643 !! y 'nav_lat' 'lat' 'latitude' 644 !! z 'depth' 'deptht' 'height' 'level' 645 !! 'lev' 'plev' 'sigma_level' 'layer' 646 !! t 'time' 'tstep' 'timesteps' 647 !! 637 648 !!-------------------------------------------------------------------- 638 649 !- … … 921 932 !- 922 933 ! Define "Conventions" global attribute 923 i_rc = NF90_PUT_ATT(f_e,NF90_GLOBAL,'Conventions',"CF-1. 0")934 i_rc = NF90_PUT_ATT(f_e,NF90_GLOBAL,'Conventions',"CF-1.1") 924 935 !- 925 936 ! Add the DOMAIN attributes if needed … … 1111 1122 & nw_di(k_1,f_i),levid) 1112 1123 i_rc = NF90_PUT_ATT(f_e,levid,"axis","Z") 1113 i_rc = NF90_PUT_ATT(f_e,levid,'standard_name',' level')1124 i_rc = NF90_PUT_ATT(f_e,levid,'standard_name','model_level_number') 1114 1125 i_rc = NF90_PUT_ATT(f_e,levid,'units','sigma_level') 1115 1126 i_rc = NF90_PUT_ATT(f_e,levid,'long_name','Sigma Levels') … … 4879 4890 INTEGER :: kv,k,n_r,l_d,n_d,i_rc,dimnb 4880 4891 CHARACTER(LEN=1) :: c_ax 4892 CHARACTER(LEN=9) :: c_sn 4881 4893 CHARACTER(LEN=15),DIMENSION(10) :: c_r 4882 4894 CHARACTER(LEN=40) :: c_t1,c_t2 … … 4899 4911 CASE('x') 4900 4912 l_d = 2 4913 c_sn = 'longitude' 4901 4914 CASE('y') 4902 4915 l_d = 2 4916 c_sn = 'latitude' 4903 4917 CASE('z') 4904 4918 l_d = 1 4919 c_sn = 'model_level_number' 4905 4920 CASE('t') 4906 4921 l_d = 1 4922 c_sn = 'time' 4907 4923 END SELECT 4908 4924 !--- 4909 !-- Rule 1 : we look for a correct "axis" attribute 4910 !--- 4911 IF (i_v < 0) THEN 4912 L_R1: DO kv=1,nw_nv(f_i) 4913 i_rc = NF90_GET_ATT(nw_id(f_i),kv,'axis',c_t1) 4914 IF (i_rc == NF90_NOERR) THEN 4915 CALL strlowercase (c_t1) 4916 IF (TRIM(c_t1) == c_ax) THEN 4917 i_rc = NF90_INQUIRE_VARIABLE(nw_id(f_i),kv,ndims=n_d) 4918 IF (n_d <= l_d) THEN 4919 i_v = kv; nbd = n_d; 4920 EXIT L_R1 4921 ENDIF 4922 ENDIF 4923 ENDIF 4924 ENDDO L_R1 4925 ENDIF 4926 !--- 4927 !-- Rule 2 : we look for a specific name 4928 !--- 4929 IF (i_v < 0) THEN 4930 SELECT CASE (c_ax) 4931 CASE('x') 4932 n_r = 3 4933 c_r(1)='nav_lon'; c_r(2)='lon'; c_r(3)='longitude'; 4934 CASE('y') 4935 n_r = 3 4936 c_r(1)='nav_lat'; c_r(2)='lat'; c_r(3)='latitude'; 4937 CASE('z') 4938 n_r = 8 4939 c_r(1)='depth'; c_r(2)='deptht'; c_r(3)='height'; 4940 c_r(4)='level'; c_r(5)='lev'; c_r(6)='plev'; 4941 c_r(7)='sigma_level'; c_r(8)='layer'; 4942 CASE('t') 4943 n_r = 3 4944 c_r(1)='time'; c_r(2)='tstep'; c_r(3)='timesteps'; 4945 END SELECT 4946 !----- 4947 L_R2: DO kv=1,nw_nv(f_i) 4948 i_rc = NF90_INQUIRE_VARIABLE & 4949 & (nw_id(f_i),kv,name=c_t1,ndims=n_d) 4950 IF (i_rc == NF90_NOERR) THEN 4951 CALL strlowercase (c_t1) 4952 IF (n_d <= l_d) THEN 4953 DO k=1,n_r 4954 IF (TRIM(c_t1) == TRIM(c_r(k))) THEN 4955 i_v = kv; nbd = n_d; 4956 EXIT L_R2 4957 ENDIF 4958 ENDDO 4959 ENDIF 4960 ENDIF 4961 ENDDO L_R2 4962 ENDIF 4963 !--- 4964 !-- Rule 3 : we look for a variable with one dimension 4965 !-- and which has the same name as its dimension 4925 !-- Rule 1 : we look for a variable with one dimension 4926 !-- and which has the same name as its dimension (NUG) 4966 4927 !--- 4967 4928 IF (i_v < 0) THEN … … 4985 4946 IF (i_rc == NF90_NOERR) THEN 4986 4947 CALL strlowercase (c_t1) 4987 L_R 3: DO kv=1,nw_nv(f_i)4948 L_R1: DO kv=1,nw_nv(f_i) 4988 4949 i_rc = NF90_INQUIRE_VARIABLE & 4989 4950 & (nw_id(f_i),kv,name=c_t2,ndims=n_d) … … 4992 4953 IF (TRIM(c_t1) == TRIM(c_t2)) THEN 4993 4954 i_v = kv; nbd = n_d; 4955 EXIT L_R1 4956 ENDIF 4957 ENDIF 4958 ENDDO L_R1 4959 ENDIF 4960 ENDIF 4961 !--- 4962 !-- Rule 2 : we look for a correct "axis" attribute (CF) 4963 !--- 4964 IF (i_v < 0) THEN 4965 L_R2: DO kv=1,nw_nv(f_i) 4966 i_rc = NF90_GET_ATT(nw_id(f_i),kv,'axis',c_t1) 4967 IF (i_rc == NF90_NOERR) THEN 4968 CALL strlowercase (c_t1) 4969 IF (TRIM(c_t1) == c_ax) THEN 4970 i_rc = NF90_INQUIRE_VARIABLE(nw_id(f_i),kv,ndims=n_d) 4971 IF (n_d <= l_d) THEN 4972 i_v = kv; nbd = n_d; 4973 EXIT L_R2 4974 ENDIF 4975 ENDIF 4976 ENDIF 4977 ENDDO L_R2 4978 ENDIF 4979 !--- 4980 !-- Rule 3 : we look for a correct "standard_name" attribute (CF) 4981 !--- 4982 IF (i_v < 0) THEN 4983 L_R3: DO kv=1,nw_nv(f_i) 4984 i_rc = NF90_GET_ATT(nw_id(f_i),kv,'standard_name',c_t1) 4985 IF (i_rc == NF90_NOERR) THEN 4986 CALL strlowercase (c_t1) 4987 IF (TRIM(c_t1) == TRIM(c_sn)) THEN 4988 i_rc = NF90_INQUIRE_VARIABLE(nw_id(f_i),kv,ndims=n_d) 4989 IF (n_d <= l_d) THEN 4990 i_v = kv; nbd = n_d; 4994 4991 EXIT L_R3 4995 4992 ENDIF 4996 4993 ENDIF 4997 ENDDO L_R3 4998 ENDIF 4994 ENDIF 4995 ENDDO L_R3 4996 ENDIF 4997 !--- 4998 !-- Rule 4 : we look for a specific name (IOIPSL) 4999 !--- 5000 IF (i_v < 0) THEN 5001 SELECT CASE (c_ax) 5002 CASE('x') 5003 n_r = 3 5004 c_r(1)='nav_lon'; c_r(2)='lon'; c_r(3)='longitude'; 5005 CASE('y') 5006 n_r = 3 5007 c_r(1)='nav_lat'; c_r(2)='lat'; c_r(3)='latitude'; 5008 CASE('z') 5009 n_r = 8 5010 c_r(1)='depth'; c_r(2)='deptht'; c_r(3)='height'; 5011 c_r(4)='level'; c_r(5)='lev'; c_r(6)='plev'; 5012 c_r(7)='sigma_level'; c_r(8)='layer'; 5013 CASE('t') 5014 n_r = 3 5015 c_r(1)='time'; c_r(2)='tstep'; c_r(3)='timesteps'; 5016 END SELECT 5017 !----- 5018 L_R4: DO kv=1,nw_nv(f_i) 5019 i_rc = NF90_INQUIRE_VARIABLE & 5020 & (nw_id(f_i),kv,name=c_t1,ndims=n_d) 5021 IF (i_rc == NF90_NOERR) THEN 5022 CALL strlowercase (c_t1) 5023 IF (n_d <= l_d) THEN 5024 DO k=1,n_r 5025 IF (TRIM(c_t1) == TRIM(c_r(k))) THEN 5026 i_v = kv; nbd = n_d; 5027 EXIT L_R4 5028 ENDIF 5029 ENDDO 5030 ENDIF 5031 ENDIF 5032 ENDDO L_R4 4999 5033 ENDIF 5000 5034 !--- -
IOIPSL/trunk/src/histcom.f90
r358 r362 5 5 USE netcdf 6 6 !- 7 USE stringop, 8 USE mathelp, 9 USE fliocom, 7 USE stringop, ONLY : nocomma,cmpblank,findpos,find_str,strlowercase 8 USE mathelp, ONLY : mathop,moycum,trans_buff,buildop 9 USE fliocom, ONLY : flio_dom_file,flio_dom_att 10 10 USE calendar 11 11 USE errioipsl, ONLY : ipslerr … … 14 14 !- 15 15 PRIVATE 16 PUBLIC :: histbeg, histdef, histhori, histvert,histend, &17 & histwrite, histclo, histsync,ioconf_modname16 PUBLIC :: histbeg,histdef,histhori,histvert,histend, & 17 & histwrite,histclo,histsync,ioconf_modname 18 18 !--------------------------------------------------------------------- 19 19 !- Some confusing vocabulary in this code ! … … 70 70 ! Fixed parameter 71 71 !- 72 INTEGER,PARAMETER :: nb_files_max=20, 73 & nb_hax_max=5, nb_zax_max=10,nbopp_max=1072 INTEGER,PARAMETER :: nb_files_max=20,nb_var_max=400, & 73 & nb_hax_max=5,nb_zax_max=10,nbopp_max=10 74 74 REAL,PARAMETER :: missing_val=nf90_fill_real 75 75 !- … … 145 145 INTEGER,SAVE :: buff_pos=0 146 146 REAL,ALLOCATABLE,SAVE :: buffer(:) 147 LOGICAL,SAVE :: & 148 & zoom(nb_files_max)=.FALSE., regular(nb_files_max)=.TRUE. 147 LOGICAL,DIMENSION(nb_files_max),SAVE :: zoom=.FALSE.,regular=.TRUE. 149 148 !- 150 149 ! Book keeping of the axes … … 170 169 !=== 171 170 !- 172 SUBROUTINE histbeg_totreg 173 & (pfilename, pim, plon, pjm,plat, &174 & par_orix, par_szx, par_oriy, par_szy,&175 & pitau0, pdate0, pdeltat, phoriid, pfileid,domain_id)171 SUBROUTINE histbeg_totreg & 172 & (pfilename,pim,plon,pjm,plat, & 173 & par_orix,par_szx,par_oriy,par_szy, & 174 & pitau0,pdate0,pdeltat,phoriid,pfileid,domain_id) 176 175 !--------------------------------------------------------------------- 177 176 !- This is just an interface for histbeg_regular in case when … … 200 199 !- pdate0 : The Julian date at which the itau was equal to 0 201 200 !- pdeltat : Time step in seconds. Time step of the counter itau 202 !- used in histwrt for instance201 !- used in histwrte for instance 203 202 !- 204 203 !- OUTPUT … … 251 250 & .TRUE.,domain_id) 252 251 !- 253 DEALLOCATE (lon_tmp, 252 DEALLOCATE (lon_tmp,lat_tmp) 254 253 !---------------------------- 255 254 END SUBROUTINE histbeg_totreg 256 255 !=== 257 256 SUBROUTINE histbeg_regular & 258 & (pfilename, pim, plon, pjm, plat,&259 & par_orix, par_szx, par_oriy, par_szy,&260 & pitau0, pdate0, pdeltat, phoriid,pfileid, &261 & opt_rectilinear, 257 & (pfilename,pim,plon,pjm,plat, & 258 & par_orix,par_szx,par_oriy,par_szy, & 259 & pitau0,pdate0,pdeltat,phoriid,pfileid, & 260 & opt_rectilinear,domain_id) 262 261 !--------------------------------------------------------------------- 263 262 !- This subroutine initializes a netcdf file and returns the ID. … … 287 286 !- pdate0 : The Julian date at which the itau was equal to 0 288 287 !- pdeltat : Time step in seconds. Time step of the counter itau 289 !- used in histwrt for instance288 !- used in histwrte for instance 290 289 !- 291 290 !- OUTPUT … … 353 352 CALL ipslerr (3,"histbeg", & 354 353 & 'Table of files too small. You should increase nb_files_max', & 355 & 'in histcom.f90 in order to accomodate all these files', 354 & 'in histcom.f90 in order to accomodate all these files',' ') 356 355 ENDIF 357 356 !- … … 361 360 nb_zax(pfileid) = 0 362 361 !- 363 slab_ori(pfileid,1:2) = (/ par_orix, 364 slab_sz(pfileid,1:2) = (/ par_szx, 362 slab_ori(pfileid,1:2) = (/ par_orix,par_oriy /) 363 slab_sz(pfileid,1:2) = (/ par_szx, par_szy /) 365 364 !- 366 365 ! 3.0 Opening netcdf file and defining dimensions … … 389 388 ! 4.3 Global attributes 390 389 !- 391 iret = NF90_PUT_ATT (ncid,NF90_GLOBAL,'Conventions','CF-1. 3')390 iret = NF90_PUT_ATT (ncid,NF90_GLOBAL,'Conventions','CF-1.1') 392 391 iret = NF90_PUT_ATT (ncid,NF90_GLOBAL,'file_name',TRIM(file)) 393 392 iret = NF90_PUT_ATT (ncid,NF90_GLOBAL,'production',TRIM(model_name)) … … 404 403 ENDIF 405 404 ncdf_ids(pfileid) = ncid 406 full_size(pfileid,1:2) = (/ pim, 405 full_size(pfileid,1:2) = (/ pim,pjm /) 407 406 !- 408 407 ! 6.0 storing the geographical coordinates … … 411 410 regular(pfileid)=.TRUE. 412 411 !- 413 CALL histhori_regular (pfileid, pim, plon, pjm,plat, &414 & ' ' , 'Default grid', phoriid,rectilinear)412 CALL histhori_regular (pfileid,pim,plon,pjm,plat, & 413 & ' ' ,'Default grid',phoriid,rectilinear) 415 414 !----------------------------- 416 415 END SUBROUTINE histbeg_regular 417 416 !=== 418 417 SUBROUTINE histbeg_irregular & 419 & (pfilename, pim, plon, plon_bounds, plat,plat_bounds, &420 & pitau0, pdate0, pdeltat, phoriid, pfileid,domain_id)418 & (pfilename,pim,plon,plon_bounds,plat,plat_bounds, & 419 & pitau0,pdate0,pdeltat,phoriid,pfileid,domain_id) 421 420 !--------------------------------------------------------------------- 422 421 !- This subroutine initializes a netcdf file and returns the ID. … … 438 437 !- pdate0 : The Julian date at which the itau was equal to 0 439 438 !- pdeltat : Time step in seconds. Time step of the counter itau 440 !- used in histwrt for instance439 !- used in histwrte for instance 441 440 !- 442 441 !- OUTPUT … … 503 502 nb_zax(pfileid) = 0 504 503 !- 505 slab_ori(pfileid,1:2) = (/ 1, 506 slab_sz(pfileid,1:2) = (/ pim, 504 slab_ori(pfileid,1:2) = (/ 1,1 /) 505 slab_sz(pfileid,1:2) = (/ pim,1 /) 507 506 !- 508 507 ! 3.0 Opening netcdf file and defining dimensions … … 520 519 yid(nb_files) = 0 521 520 !- 522 ! -4.0 Declaring the geographical coordinates and other attributes523 !- 524 521 ! 4.0 Declaring the geographical coordinates and other attributes 522 !- 523 IF (check) WRITE(*,*) "histbeg_irregular 4.0" 525 524 !- 526 525 ! 4.3 Global attributes 527 526 !- 528 iret = NF90_PUT_ATT (ncid,NF90_GLOBAL,'Conventions','CF-1. 3')527 iret = NF90_PUT_ATT (ncid,NF90_GLOBAL,'Conventions','CF-1.1') 529 528 iret = NF90_PUT_ATT (ncid,NF90_GLOBAL,'file_name',TRIM(file)) 530 529 iret = NF90_PUT_ATT (ncid,NF90_GLOBAL,'production',TRIM(model_name)) … … 541 540 ENDIF 542 541 ncdf_ids(pfileid) = ncid 543 full_size(pfileid,1:2) = (/ pim, 542 full_size(pfileid,1:2) = (/ pim,1 /) 544 543 !- 545 544 ! 6.0 storing the geographical coordinates … … 549 548 !- 550 549 CALL histhori_irregular & 551 & (pfileid, pim, plon, plon_bounds, plat,plat_bounds, &552 & ' ' , 'Default grid',phoriid)550 & (pfileid,pim,plon,plon_bounds,plat,plat_bounds, & 551 & ' ' ,'Default grid',phoriid) 553 552 !------------------------------- 554 553 END SUBROUTINE histbeg_irregular … … 586 585 IMPLICIT NONE 587 586 !- 588 INTEGER,INTENT(IN) :: pfileid, pim,pjm589 REAL,INTENT(IN),DIMENSION(pim,pjm) :: plon, 590 CHARACTER(LEN=*),INTENT(IN) :: phname, 587 INTEGER,INTENT(IN) :: pfileid,pim,pjm 588 REAL,INTENT(IN),DIMENSION(pim,pjm) :: plon,plat 589 CHARACTER(LEN=*),INTENT(IN) :: phname,phtitle 591 590 INTEGER,INTENT(OUT) :: phid 592 591 LOGICAL,INTENT(IN),OPTIONAL :: opt_rectilinear 593 592 !- 594 CHARACTER(LEN=25) :: lon_name, 595 CHARACTER(LEN=80) :: tmp_title, 593 CHARACTER(LEN=25) :: lon_name,lat_name 594 CHARACTER(LEN=80) :: tmp_title,tmp_name 596 595 INTEGER :: ndim 597 596 INTEGER,DIMENSION(2) :: dims 598 INTEGER :: nlonid, 599 INTEGER :: orix, oriy, par_szx,par_szy600 INTEGER :: iret, 597 INTEGER :: nlonid,nlatid 598 INTEGER :: orix,oriy,par_szx,par_szy 599 INTEGER :: iret,ncid 601 600 LOGICAL :: rectilinear 602 601 !- … … 627 626 !- 628 627 ndim = 2 629 dims(1:2) = (/ xid(pfileid), 628 dims(1:2) = (/ xid(pfileid),yid(pfileid) /) 630 629 !- 631 630 tmp_name = phname … … 653 652 nb_hax(pfileid) = phid 654 653 !- 655 hax_name(pfileid,phid,1:2) = (/ lon_name, 654 hax_name(pfileid,phid,1:2) = (/ lon_name,lat_name /) 656 655 tmp_title = phtitle 657 656 !- … … 665 664 ENDIF 666 665 iret = NF90_DEF_VAR (ncid,lon_name,NF90_FLOAT,dims(1:ndim),nlonid) 667 iret = NF90_PUT_ATT (ncid,nlonid,'axis',"X") 666 IF (rectilinear) THEN 667 iret = NF90_PUT_ATT (ncid,nlonid,'axis',"X") 668 ENDIF 669 iret = NF90_PUT_ATT (ncid,nlonid,'standard_name',"longitude") 668 670 iret = NF90_PUT_ATT (ncid,nlonid,'units',"degrees_east") 669 671 iret = NF90_PUT_ATT (ncid,nlonid,'valid_min', & … … 683 685 ENDIF 684 686 iret = NF90_DEF_VAR (ncid,lat_name,NF90_FLOAT,dims(1:ndim),nlatid) 685 iret = NF90_PUT_ATT (ncid,nlatid,'axis',"Y") 687 IF (rectilinear) THEN 688 iret = NF90_PUT_ATT (ncid,nlatid,'axis',"Y") 689 ENDIF 690 iret = NF90_PUT_ATT (ncid,nlatid,'standard_name',"latitude") 686 691 iret = NF90_PUT_ATT (ncid,nlatid,'units',"degrees_north") 687 692 iret = NF90_PUT_ATT (ncid,nlatid,'valid_min', & … … 726 731 !=== 727 732 SUBROUTINE histhori_irregular & 728 & (pfileid, pim, plon, plon_bounds, plat,plat_bounds, &729 & phname, phtitle,phid)733 & (pfileid,pim,plon,plon_bounds,plat,plat_bounds, & 734 & phname,phtitle,phid) 730 735 !--------------------------------------------------------------------- 731 736 !- This subroutine is made to declare a new horizontale grid. … … 754 759 IMPLICIT NONE 755 760 !- 756 INTEGER,INTENT(IN) :: pfileid, 757 REAL,DIMENSION(pim),INTENT(IN) :: plon, 758 REAL,DIMENSION(:,:),INTENT(IN) :: plon_bounds, 759 CHARACTER(LEN=*), INTENT(IN) :: phname,phtitle761 INTEGER,INTENT(IN) :: pfileid,pim 762 REAL,DIMENSION(pim),INTENT(IN) :: plon,plat 763 REAL,DIMENSION(:,:),INTENT(IN) :: plon_bounds,plat_bounds 764 CHARACTER(LEN=*),INTENT(IN) :: phname,phtitle 760 765 INTEGER,INTENT(OUT) :: phid 761 766 !- 762 CHARACTER(LEN=25) :: lon_name, 763 CHARACTER(LEN=30) :: lonbound_name, 764 CHARACTER(LEN=80) :: tmp_title, tmp_name,longname765 INTEGER :: ndim, 766 INTEGER :: ndimb, 767 CHARACTER(LEN=25) :: lon_name,lat_name 768 CHARACTER(LEN=30) :: lonbound_name,latbound_name 769 CHARACTER(LEN=80) :: tmp_title,tmp_name,longname 770 INTEGER :: ndim,dims(2) 771 INTEGER :: ndimb,dimsb(2) 767 772 INTEGER :: nbbounds 768 INTEGER :: nlonid, nlatid, nlonidb,nlatidb769 INTEGER :: iret, ncid,twoid773 INTEGER :: nlonid,nlatid,nlonidb,nlatidb 774 INTEGER :: iret,ncid,twoid 770 775 LOGICAL :: transp = .FALSE. 771 REAL, ALLOCATABLE,DIMENSION(:,:) :: bounds_trans776 REAL,ALLOCATABLE,DIMENSION(:,:) :: bounds_trans 772 777 !- 773 778 LOGICAL :: check = .FALSE. … … 807 812 ENDIF 808 813 !- 809 iret = NF90_DEF_DIM (ncid, 'nbnd', nbbounds,twoid)814 iret = NF90_DEF_DIM (ncid,'nbnd',nbbounds,twoid) 810 815 ndim = 1 811 816 dims(1) = xid(pfileid) 812 817 ndimb = 2 813 dimsb(1:2) = (/ twoid, 818 dimsb(1:2) = (/ twoid,xid(pfileid) /) 814 819 !- 815 820 tmp_name = phname … … 829 834 nb_hax(pfileid) = phid 830 835 !- 831 hax_name(pfileid,phid,1:2) = (/ lon_name, 836 hax_name(pfileid,phid,1:2) = (/ lon_name,lat_name /) 832 837 tmp_title = phtitle 833 838 !- … … 837 842 !- 838 843 iret = NF90_DEF_VAR (ncid,lon_name,NF90_FLOAT,dims(1:ndim),nlonid) 839 iret = NF90_PUT_ATT (ncid,nlonid,' axis',"X")844 iret = NF90_PUT_ATT (ncid,nlonid,'standard_name',"longitude") 840 845 iret = NF90_PUT_ATT (ncid,nlonid,'units',"degrees_east") 841 846 iret = NF90_PUT_ATT (ncid,nlonid,'valid_min', & … … 859 864 !- 860 865 iret = NF90_DEF_VAR (ncid,lat_name,NF90_FLOAT,dims(1:ndim),nlatid) 861 iret = NF90_PUT_ATT (ncid,nlatid,' axis',"Y")866 iret = NF90_PUT_ATT (ncid,nlatid,'standard_name',"latitude") 862 867 iret = NF90_PUT_ATT (ncid,nlatid,'units',"degrees_north") 863 868 iret = NF90_PUT_ATT (ncid,nlatid,'valid_min', & … … 884 889 ! 4.1 Write the longitude 885 890 !- 886 iret = NF90_PUT_VAR (ncid, nlonid,plon(1:pim))891 iret = NF90_PUT_VAR (ncid,nlonid,plon(1:pim)) 887 892 !- 888 893 ! 4.2 Write the longitude bounds … … 893 898 bounds_trans = plon_bounds 894 899 ENDIF 895 iret = NF90_PUT_VAR (ncid, nlonidb,bounds_trans(1:nbbounds,1:pim))900 iret = NF90_PUT_VAR (ncid,nlonidb,bounds_trans(1:nbbounds,1:pim)) 896 901 !- 897 902 ! 4.3 Write the latitude 898 903 !- 899 iret = NF90_PUT_VAR (ncid, nlatid,plat(1:pim))904 iret = NF90_PUT_VAR (ncid,nlatid,plat(1:pim)) 900 905 !- 901 906 ! 4.4 Write the latitude bounds … … 944 949 CHARACTER(LEN=*),INTENT(IN) :: pzaxname,pzaxunit,pzaxtitle 945 950 REAL,INTENT(IN) :: pzvalues(pzsize) 946 INTEGER, 951 INTEGER,INTENT(OUT) :: pzaxid 947 952 CHARACTER(LEN=*),INTENT(IN),OPTIONAL :: pdirect 948 953 !- … … 951 956 CHARACTER(LEN=80) :: str80 952 957 CHARACTER(LEN=20) :: direction 953 INTEGER :: iret, leng,ncid958 INTEGER :: iret,leng,ncid 954 959 LOGICAL :: check = .FALSE. 955 960 !--------------------------------------------------------------------- … … 981 986 CALL ipslerr (2,"histvert",& 982 987 & "The specified direction for the vertical axis is not possible.",& 983 & "it is replaced by : unknown", 988 & "it is replaced by : unknown",str80) 984 989 ENDIF 985 990 !- … … 1020 1025 & zaxid_tmp,zdimid) 1021 1026 iret = NF90_PUT_ATT (ncid,zdimid,'axis',"Z") 1027 iret = NF90_PUT_ATT (ncid,zdimid,'standard_name',"model_level_number") 1022 1028 leng = MIN(LEN_TRIM(pzaxunit),20) 1023 1029 IF (leng > 0) THEN … … 1046 1052 !- 1047 1053 nb_zax(pfileid) = iv 1048 zax_size(pfileid, 1049 zax_name(pfileid, 1050 zax_ids(pfileid, 1054 zax_size(pfileid,iv) = pzsize 1055 zax_name(pfileid,iv) = pzaxname 1056 zax_ids(pfileid,iv) = zaxid_tmp 1051 1057 pzaxid = iv 1052 1058 !---------------------- 1053 1059 END SUBROUTINE histvert 1054 1060 !=== 1055 SUBROUTINE histdef (pfileid, pvarname, ptitle,punit, &1056 & pxsize, pysize, phoriid,pzsize, &1057 & par_oriz, par_szz, pzid,&1058 & pnbbyt, popp, pfreq_opp, pfreq_wrt,var_range)1061 SUBROUTINE histdef (pfileid,pvarname,ptitle,punit, & 1062 & pxsize,pysize,phoriid,pzsize, & 1063 & par_oriz,par_szz,pzid, & 1064 & pnbbyt,popp,pfreq_opp,pfreq_wrt,var_range) 1059 1065 !--------------------------------------------------------------------- 1060 1066 !- With this subroutine each variable to be archived on the history … … 1107 1113 IMPLICIT NONE 1108 1114 !- 1109 INTEGER,INTENT(IN) :: pfileid, pxsize, pysize, pzsize, pzid 1110 INTEGER,INTENT(IN) :: par_oriz, par_szz, pnbbyt, phoriid 1111 CHARACTER(LEN=*),INTENT(IN) :: pvarname, punit, popp 1112 CHARACTER(LEN=*),INTENT(IN) :: ptitle 1113 REAL,INTENT(IN) :: pfreq_opp, pfreq_wrt 1115 INTEGER,INTENT(IN) :: pfileid,pxsize,pysize,pzsize,pzid 1116 INTEGER,INTENT(IN) :: par_oriz,par_szz,pnbbyt,phoriid 1117 CHARACTER(LEN=*),INTENT(IN) :: pvarname,punit,popp,ptitle 1118 REAL,INTENT(IN) :: pfreq_opp,pfreq_wrt 1114 1119 REAL,DIMENSION(2),OPTIONAL,INTENT(IN) :: var_range 1115 1120 !- 1116 1121 INTEGER :: iv,i 1117 CHARACTER(LEN=70) :: str70, str71,str721122 CHARACTER(LEN=70) :: str70,str71,str72 1118 1123 CHARACTER(LEN=20) :: tmp_name 1119 1124 CHARACTER(LEN=40) :: str40 1120 1125 CHARACTER(LEN=10) :: str10 1121 1126 CHARACTER(LEN=80) :: tmp_str80 1122 CHARACTER(LEN=7) :: tmp_topp, 1127 CHARACTER(LEN=7) :: tmp_topp,tmp_sopp(nbopp_max) 1123 1128 CHARACTER(LEN=120) :: ex_topps 1124 REAL :: tmp_scal(nbopp_max), un_an, un_jour, test_fopp,test_fwrt1125 INTEGER :: pos, 1129 REAL :: tmp_scal(nbopp_max),un_an,un_jour,test_fopp,test_fwrt 1130 INTEGER :: pos,buff_sz 1126 1131 !- 1127 1132 LOGICAL :: check = .FALSE. … … 1155 1160 & TRIM(pvarname),pfileid 1156 1161 str72 = "Can also be a wrong file ID in another declaration" 1157 CALL ipslerr (3,"histdef", str70, str71,str72)1162 CALL ipslerr (3,"histdef",str70,str71,str72) 1158 1163 ENDIF 1159 1164 !- … … 1168 1173 tmp_str80 = popp 1169 1174 CALL buildop & 1170 & (tmp_str80, ex_topps, tmp_topp, nbopp_max,missing_val, &1171 & tmp_sopp, tmp_scal,nbopp(pfileid,iv))1175 & (tmp_str80,ex_topps,tmp_topp,nbopp_max,missing_val, & 1176 & tmp_sopp,tmp_scal,nbopp(pfileid,iv)) 1172 1177 !- 1173 1178 topp(pfileid,iv) = tmp_topp … … 1189 1194 !- 1190 1195 IF (check) & 1191 & WRITE(*,*) "histdef : 2.0", 1196 & WRITE(*,*) "histdef : 2.0",pfileid,iv,nbopp(pfileid,iv), & 1192 1197 & sopps(pfileid,iv,1:nbopp(pfileid,iv)), & 1193 1198 & scal(pfileid,iv,1:nbopp(pfileid,iv)) 1194 1199 !- 1195 scsize(pfileid,iv,1:3) = (/ pxsize, pysize,pzsize /)1200 scsize(pfileid,iv,1:3) = (/ pxsize,pysize,pzsize /) 1196 1201 !- 1197 1202 zorig(pfileid,iv,1:3) = & 1198 & (/ slab_ori(pfileid,1), slab_ori(pfileid,2),par_oriz /)1203 & (/ slab_ori(pfileid,1),slab_ori(pfileid,2),par_oriz /) 1199 1204 !- 1200 1205 zsize(pfileid,iv,1:3) = & 1201 & (/ slab_sz(pfileid,1), slab_sz(pfileid,2),par_szz /)1206 & (/ slab_sz(pfileid,1),slab_sz(pfileid,2),par_szz /) 1202 1207 !- 1203 1208 ! Is the size of the full array the same as that of the coordinates ? … … 1208 1213 str70 = "The size of the variable is different "// & 1209 1214 & "from the one of the coordinates" 1210 WRITE(str71,'("Size of coordinates :", 1211 & full_size(pfileid,1), 1215 WRITE(str71,'("Size of coordinates :",2I4)') & 1216 & full_size(pfileid,1),full_size(pfileid,2) 1212 1217 WRITE(str72,'("Size declared for variable ",a," :",2I4)') & 1213 & TRIM(tmp_name), pxsize,pysize1214 CALL ipslerr (3,"histdef", str70, str71,str72)1218 & TRIM(tmp_name),pxsize,pysize 1219 CALL ipslerr (3,"histdef",str70,str71,str72) 1215 1220 ENDIF 1216 1221 !- … … 1221 1226 str70 = & 1222 1227 & "Size of variable should be greater or equal to those of the zoom" 1223 WRITE(str71,'("Size of XY zoom :", 1228 WRITE(str71,'("Size of XY zoom :",2I4)') & 1224 1229 & slab_sz(pfileid,1),slab_sz(pfileid,1) 1225 1230 WRITE(str72,'("Size declared for variable ",a," :",2I4)') & 1226 & TRIM(tmp_name), pxsize,pysize1227 CALL ipslerr (3,"histdef", str70, str71,str72)1231 & TRIM(tmp_name),pxsize,pysize 1232 CALL ipslerr (3,"histdef",str70,str71,str72) 1228 1233 ENDIF 1229 1234 !- … … 1237 1242 CALL ipslerr (2,"histdef", & 1238 1243 & 'We use the default grid for variable as an invalide',& 1239 & 'ID was provided for variable : ', pvarname)1244 & 'ID was provided for variable : ',TRIM(pvarname)) 1240 1245 ENDIF 1241 1246 !- … … 1251 1256 & TRIM(tmp_name) 1252 1257 str71 = " Does not exist." 1253 CALL ipslerr (3,"histdef",str70,str71, 1258 CALL ipslerr (3,"histdef",str70,str71," ") 1254 1259 ENDIF 1255 1260 !- … … 1259 1264 str70 = "The size of the zoom does not correspond "// & 1260 1265 & "to the size of the chosen vertical axis" 1261 WRITE(str71,'("Size of zoom in z :", 1266 WRITE(str71,'("Size of zoom in z :",I4)') par_szz 1262 1267 WRITE(str72,'("Size declared for axis ",A," :",I4)') & 1263 1268 & TRIM(zax_name(pfileid,pzid)),zax_size(pfileid,pzid) 1264 CALL ipslerr (3,"histdef", str70, str71,str72)1269 CALL ipslerr (3,"histdef",str70,str71,str72) 1265 1270 ENDIF 1266 1271 !- … … 1270 1275 str70 = "The vertical size of variable "// & 1271 1276 & "is smaller than that of the zoom." 1272 WRITE(str71,'("Declared vertical size of data :", 1277 WRITE(str71,'("Declared vertical size of data :",I5)') pzsize 1273 1278 WRITE(str72,'("Size of zoom for variable ",a," = ",I5)') & 1274 1279 & TRIM(tmp_name),par_szz 1275 CALL ipslerr (3,"histdef", str70, str71,str72)1280 CALL ipslerr (3,"histdef",str70,str71,str72) 1276 1281 ENDIF 1277 1282 var_zaxid(pfileid,iv) = pzid … … 1314 1319 freq_wrt(pfileid,iv) = pfreq_wrt 1315 1320 !- 1316 CALL ioget_calendar(un_an, 1321 CALL ioget_calendar(un_an,un_jour) 1317 1322 IF (pfreq_opp < 0) THEN 1318 1323 CALL ioget_calendar(un_an) … … 1336 1341 str72 = "PATCH : frequency set to deltat" 1337 1342 !- 1338 CALL ipslerr (2,"histdef", str70, str71,str72)1343 CALL ipslerr (2,"histdef",str70,str71,str72) 1339 1344 !- 1340 1345 freq_opp(pfileid,iv) = deltat(pfileid) … … 1347 1352 str72 = "PATCH : frequency set to deltat" 1348 1353 !- 1349 CALL ipslerr (2,"histdef", str70, str71,str72)1354 CALL ipslerr (2,"histdef",str70,str71,str72) 1350 1355 !- 1351 1356 freq_wrt(pfileid,iv) = deltat(pfileid) … … 1363 1368 & TRIM(tmp_name) 1364 1369 str72 = "PATCH : The smalest frequency of both is used" 1365 CALL ipslerr (2,"histdef", str70, str71,str72)1370 CALL ipslerr (2,"histdef",str70,str71,str72) 1366 1371 IF (test_fopp < test_fwrt) THEN 1367 1372 freq_opp(pfileid,iv) = pfreq_opp … … 1380 1385 & TRIM(tmp_name) 1381 1386 str72 = 'PATCH : The output frequency is used for both' 1382 CALL ipslerr (2,"histdef", str70, str71,str72)1387 CALL ipslerr (2,"histdef",str70,str71,str72) 1383 1388 freq_opp(pfileid,iv) = pfreq_wrt 1384 1389 ENDIF … … 1386 1391 WRITE (str70,'("Operation on variable ",a," is unknown")') & 1387 1392 & TRIM(tmp_name) 1388 WRITE (str71, 1389 WRITE (str72, 1390 CALL ipslerr (3,"histdef", str70, str71,str72)1393 WRITE (str71,'("operation requested is :",a)') tmp_topp 1394 WRITE (str72,'("File ID :",I3)') pfileid 1395 CALL ipslerr (3,"histdef",str70,str71,str72) 1391 1396 ENDIF 1392 1397 !- … … 1400 1405 IF (hist_calc_rng(pfileid,iv)) THEN 1401 1406 hist_minmax(pfileid,iv,1:2) = & 1402 & (/ ABS(missing_val), 1407 & (/ ABS(missing_val),-ABS(missing_val) /) 1403 1408 ELSE 1404 1409 hist_minmax(pfileid,iv,1:2) = var_range(1:2) … … 1474 1479 IMPLICIT NONE 1475 1480 !- 1476 INTEGER, INTENT(IN) :: pfileid 1477 !- 1478 INTEGER :: ncid, ncvarid 1479 INTEGER :: iret, ndim, iv, itx, ziv 1480 INTEGER :: itax 1481 INTEGER :: dims(4), dim_cnt 1482 INTEGER :: year, month, day, hours, minutes 1481 INTEGER,INTENT(IN) :: pfileid 1482 !- 1483 INTEGER :: ncid,ncvarid,iret,ndim,iv,itx,ziv,itax,dim_cnt 1484 INTEGER,DIMENSION(4) :: dims 1485 INTEGER :: year,month,day,hours,minutes 1483 1486 REAL :: sec 1484 1487 REAL :: rtime0 1485 CHARACTER(LEN=20) :: tname, tunit1486 1488 CHARACTER(LEN=30) :: str30 1487 CHARACTER(LEN=80) :: ttitle1488 1489 CHARACTER(LEN=120) :: assoc 1489 1490 CHARACTER(LEN=70) :: str70 … … 1514 1515 iret = NF90_DEF_VAR (ncid,str30,NF90_FLOAT, & 1515 1516 & dims(1),tdimid(pfileid,itx)) 1516 iret = NF90_PUT_ATT (ncid,tdimid(pfileid,itx),'axis',"T") 1517 IF (nb_tax(pfileid) <= 1) THEN 1518 iret = NF90_PUT_ATT (ncid,tdimid(pfileid,itx),'axis',"T") 1519 ENDIF 1520 iret = NF90_PUT_ATT (ncid,tdimid(pfileid,itx),'standard_name',"time") 1517 1521 !--- 1518 1522 ! To transform the current itau into a real date and take it … … 1522 1526 ! if there is a ioconf routine to control it. 1523 1527 !--- 1524 !-- rtime0 = itau2date(itau0(pfileid), date0(pfileid),deltat(pfileid))1528 !-- rtime0 = itau2date(itau0(pfileid),date0(pfileid),deltat(pfileid)) 1525 1529 rtime0 = date0(pfileid) 1526 1530 !- 1527 CALL ju2ymds(rtime0, year, month, day,sec)1531 CALL ju2ymds(rtime0,year,month,day,sec) 1528 1532 !--- 1529 1533 ! Catch any error induced by a change in calendar ! … … 1566 1570 itax = var_axid(pfileid,iv) 1567 1571 !--- 1568 tname = name(pfileid,iv)1569 tunit = unit_name(pfileid,iv)1570 ttitle = title(pfileid,iv)1571 !---1572 1572 IF (regular(pfileid) ) THEN 1573 dims(1:2) = (/ xid(pfileid), 1573 dims(1:2) = (/ xid(pfileid),yid(pfileid) /) 1574 1574 dim_cnt = 2 1575 1575 ELSE … … 1589 1589 IF (ziv == -99) THEN 1590 1590 ndim = dim_cnt+1 1591 dims(dim_cnt+1:dim_cnt+2) = (/ tid(pfileid), 1591 dims(dim_cnt+1:dim_cnt+2) = (/ tid(pfileid),0 /) 1592 1592 ELSE 1593 1593 ndim = dim_cnt+2 1594 dims(dim_cnt+1:dim_cnt+2) = (/ zax_ids(pfileid,ziv), 1594 dims(dim_cnt+1:dim_cnt+2) = (/ zax_ids(pfileid,ziv),tid(pfileid) /) 1595 1595 ENDIF 1596 1596 ELSE 1597 1597 IF (ziv == -99) THEN 1598 1598 ndim = dim_cnt 1599 dims(dim_cnt+1:dim_cnt+2) = (/ 0, 1599 dims(dim_cnt+1:dim_cnt+2) = (/ 0,0 /) 1600 1600 ELSE 1601 1601 ndim = dim_cnt+1 1602 dims(dim_cnt+1:dim_cnt+2) = (/ zax_ids(pfileid,ziv), 1602 dims(dim_cnt+1:dim_cnt+2) = (/ zax_ids(pfileid,ziv),0 /) 1603 1603 ENDIF 1604 1604 ENDIF 1605 1605 !- 1606 iret = NF90_DEF_VAR (ncid,TRIM( tname),NF90_FLOAT, &1606 iret = NF90_DEF_VAR (ncid,TRIM(name(pfileid,iv)),NF90_FLOAT, & 1607 1607 & dims(1:ABS(ndim)),ncvarid) 1608 1608 !- 1609 1609 ncvar_ids(pfileid,iv) = ncvarid 1610 1610 !- 1611 IF (LEN_TRIM(tunit) > 0) THEN 1612 iret = NF90_PUT_ATT (ncid,ncvarid,'units',TRIM(tunit)) 1611 IF (LEN_TRIM(unit_name(pfileid,iv)) > 0) THEN 1612 iret = NF90_PUT_ATT (ncid,ncvarid,'units', & 1613 & TRIM(unit_name(pfileid,iv))) 1613 1614 ENDIF 1614 1615 !- 1615 iret = NF90_PUT_ATT (ncid,ncvarid,' missing_value', &1616 iret = NF90_PUT_ATT (ncid,ncvarid,'_Fillvalue', & 1616 1617 & REAL(missing_val,KIND=4)) 1617 1618 IF (hist_wrt_rng(pfileid,iv)) THEN … … 1621 1622 & REAL(hist_minmax(pfileid,iv,2),KIND=4)) 1622 1623 ENDIF 1623 !- 1624 iret = NF90_PUT_ATT (ncid,ncvarid,'long_name',TRIM(ttitle)) 1625 !- 1626 iret = NF90_PUT_ATT (ncid,ncvarid,'short_name',TRIM(tname)) 1627 !- 1624 iret = NF90_PUT_ATT (ncid,ncvarid,'long_name', & 1625 & TRIM(title(pfileid,iv))) 1628 1626 iret = NF90_PUT_ATT (ncid,ncvarid,'online_operation', & 1629 1627 & TRIM(fullop(pfileid,iv))) … … 1637 1635 END SELECT 1638 1636 !- 1639 assoc='nav_lat nav_lon' 1640 ziv = var_zaxid(pfileid, iv) 1637 assoc=TRIM(hax_name(pfileid,var_haxid(pfileid,iv),2)) & 1638 & //' '//TRIM(hax_name(pfileid,var_haxid(pfileid,iv),1)) 1639 !- 1640 ziv = var_zaxid(pfileid,iv) 1641 1641 IF (ziv > 0) THEN 1642 1642 str30 = zax_name(pfileid,ziv) … … 1654 1654 IF (check) THEN 1655 1655 WRITE(*,*) "histend : 2.0.n, freq_opp, freq_wrt", & 1656 & freq_opp(pfileid,iv), 1656 & freq_opp(pfileid,iv),freq_wrt(pfileid,iv) 1657 1657 ENDIF 1658 1658 !- … … 1691 1691 IMPLICIT NONE 1692 1692 !- 1693 INTEGER,INTENT(IN) :: pfileid, pitau, nbindex, nindex(nbindex) 1693 INTEGER,INTENT(IN) :: pfileid,pitau,nbindex 1694 INTEGER,DIMENSION(nbindex),INTENT(IN) :: nindex 1694 1695 REAL,DIMENSION(:),INTENT(IN) :: pdata 1695 1696 CHARACTER(LEN=*),INTENT(IN) :: pvarname 1696 !- 1697 LOGICAL :: do_oper, do_write, largebuf 1698 INTEGER :: varid, io, nbpt_in, nbpt_out 1699 REAL, ALLOCATABLE,SAVE :: buff_tmp(:) 1697 !--------------------------------------------------------------------- 1698 CALL histw_rnd (pfileid,pvarname,pitau,nbindex,nindex,pdata_1d=pdata) 1699 !--------------------------- 1700 END SUBROUTINE histwrite_r1d 1701 !=== 1702 SUBROUTINE histwrite_r2d (pfileid,pvarname,pitau,pdata,nbindex,nindex) 1703 !--------------------------------------------------------------------- 1704 IMPLICIT NONE 1705 !- 1706 INTEGER,INTENT(IN) :: pfileid,pitau,nbindex 1707 INTEGER,DIMENSION(nbindex),INTENT(IN) :: nindex 1708 REAL,DIMENSION(:,:),INTENT(IN) :: pdata 1709 CHARACTER(LEN=*),INTENT(IN) :: pvarname 1710 !--------------------------------------------------------------------- 1711 CALL histw_rnd (pfileid,pvarname,pitau,nbindex,nindex,pdata_2d=pdata) 1712 !--------------------------- 1713 END SUBROUTINE histwrite_r2d 1714 !=== 1715 SUBROUTINE histwrite_r3d (pfileid,pvarname,pitau,pdata,nbindex,nindex) 1716 !--------------------------------------------------------------------- 1717 IMPLICIT NONE 1718 !- 1719 INTEGER,INTENT(IN) :: pfileid,pitau,nbindex 1720 INTEGER,DIMENSION(nbindex),INTENT(IN) :: nindex 1721 REAL,DIMENSION(:,:,:),INTENT(IN) :: pdata 1722 CHARACTER(LEN=*),INTENT(IN) :: pvarname 1723 !--------------------------------------------------------------------- 1724 CALL histw_rnd (pfileid,pvarname,pitau,nbindex,nindex,pdata_3d=pdata) 1725 !--------------------------- 1726 END SUBROUTINE histwrite_r3d 1727 !=== 1728 SUBROUTINE histw_rnd (pfileid,pvarname,pitau,nbindex,nindex, & 1729 & pdata_1d,pdata_2d,pdata_3d) 1730 !--------------------------------------------------------------------- 1731 IMPLICIT NONE 1732 !- 1733 INTEGER,INTENT(IN) :: pfileid,pitau,nbindex 1734 INTEGER,DIMENSION(nbindex),INTENT(IN) :: nindex 1735 CHARACTER(LEN=*),INTENT(IN) :: pvarname 1736 REAL,DIMENSION(:),INTENT(IN),OPTIONAL :: pdata_1d 1737 REAL,DIMENSION(:,:),INTENT(IN),OPTIONAL :: pdata_2d 1738 REAL,DIMENSION(:,:,:),INTENT(IN),OPTIONAL :: pdata_3d 1739 !- 1740 LOGICAL :: do_oper,do_write,largebuf,l1d,l2d,l3d 1741 INTEGER :: varid,io,nbpt_out 1742 INTEGER :: nbpt_in1 1743 INTEGER,DIMENSION(2) :: nbpt_in2 1744 INTEGER,DIMENSION(3) :: nbpt_in3 1745 REAL,ALLOCATABLE,SAVE :: buff_tmp(:) 1700 1746 INTEGER,SAVE :: buff_tmp_sz 1701 1747 CHARACTER(LEN=7) :: tmp_opp 1748 CHARACTER(LEN=13) :: c_nam 1702 1749 !- 1703 1750 LOGICAL :: check = .FALSE. 1704 1751 !--------------------------------------------------------------------- 1752 l1d=PRESENT(pdata_1d); l2d=PRESENT(pdata_2d); l3d=PRESENT(pdata_3d); 1753 IF (l1d) THEN 1754 c_nam = 'histwrite_r1d' 1755 ELSE IF (l2d) THEN 1756 c_nam = 'histwrite_r2d' 1757 ELSE IF (l3d) THEN 1758 c_nam = 'histwrite_r3d' 1759 ENDIF 1705 1760 !- 1706 1761 ! 1.0 Try to catch errors like specifying the wrong file ID. … … 1734 1789 !- 1735 1790 CALL isittime & 1736 & (pitau, date0(pfileid), deltat(pfileid),freq_opp(pfileid,varid), &1737 & last_opp(pfileid,varid), last_opp_chk(pfileid,varid),do_oper)1791 & (pitau,date0(pfileid),deltat(pfileid),freq_opp(pfileid,varid), & 1792 & last_opp(pfileid,varid),last_opp_chk(pfileid,varid),do_oper) 1738 1793 !- 1739 1794 ! 4.0 We check if we need to write the data … … 1746 1801 !- 1747 1802 CALL isittime & 1748 & (pitau, date0(pfileid), deltat(pfileid),freq_wrt(pfileid,varid), &1749 & last_wrt(pfileid,varid), last_wrt_chk(pfileid,varid),do_write)1803 & (pitau,date0(pfileid),deltat(pfileid),freq_wrt(pfileid,varid), & 1804 & last_wrt(pfileid,varid),last_wrt_chk(pfileid,varid),do_write) 1750 1805 !- 1751 1806 ! 5.0 histwrite called … … 1760 1815 !---- In the worst case we will do impossible operations 1761 1816 !---- on part of the data ! 1762 datasz_in(pfileid,varid,1) = SIZE(pdata) 1763 datasz_in(pfileid,varid,2) = -1 1764 datasz_in(pfileid,varid,3) = -1 1817 datasz_in(pfileid,varid,1:3) = -1 1818 IF (l1d) THEN 1819 datasz_in(pfileid,varid,1) = SIZE(pdata_1d) 1820 ELSE IF (l2d) THEN 1821 datasz_in(pfileid,varid,1) = SIZE(pdata_2d,DIM=1) 1822 datasz_in(pfileid,varid,2) = SIZE(pdata_2d,DIM=2) 1823 ELSE IF (l3d) THEN 1824 datasz_in(pfileid,varid,1) = SIZE(pdata_3d,DIM=1) 1825 datasz_in(pfileid,varid,2) = SIZE(pdata_3d,DIM=2) 1826 datasz_in(pfileid,varid,3) = SIZE(pdata_3d,DIM=3) 1827 ENDIF 1765 1828 ENDIF 1766 1829 !- … … 1780 1843 & *scsize(pfileid,varid,3) 1781 1844 ELSE 1782 datasz_max(pfileid,varid) = & 1783 & datasz_in(pfileid,varid,1) 1845 IF (l1d) THEN 1846 datasz_max(pfileid,varid) = & 1847 & datasz_in(pfileid,varid,1) 1848 ELSE IF (l2d) THEN 1849 datasz_max(pfileid,varid) = & 1850 & datasz_in(pfileid,varid,1) & 1851 & *datasz_in(pfileid,varid,2) 1852 ELSE IF (l3d) THEN 1853 datasz_max(pfileid,varid) = & 1854 & datasz_in(pfileid,varid,1) & 1855 & *datasz_in(pfileid,varid,2) & 1856 & *datasz_in(pfileid,varid,3) 1857 ENDIF 1784 1858 ENDIF 1785 1859 ENDIF … … 1788 1862 IF (check) THEN 1789 1863 WRITE(*,*) & 1790 & "histwrite_r1d: allocate buff_tmp for buff_sz = ", &1864 & c_nam//" : allocate buff_tmp for buff_sz = ", & 1791 1865 & datasz_max(pfileid,varid) 1792 1866 ENDIF … … 1796 1870 IF (check) THEN 1797 1871 WRITE(*,*) & 1798 & "histwrite_r1d: re-allocate buff_tmp for buff_sz = ", &1872 & c_nam//" : re-allocate buff_tmp for buff_sz = ", & 1799 1873 & datasz_max(pfileid,varid) 1800 1874 ENDIF … … 1808 1882 !-- of the data at the same time. This should speed up things. 1809 1883 !- 1810 nbpt_in = datasz_in(pfileid,varid,1)1811 1884 nbpt_out = datasz_max(pfileid,varid) 1812 CALL mathop (sopps(pfileid,varid,1), nbpt_in, pdata, & 1813 & missing_val, nbindex, nindex, & 1814 & scal(pfileid,varid,1), nbpt_out, buff_tmp) 1815 CALL histwrite_real (pfileid, varid, pitau, nbpt_out, & 1816 & buff_tmp, nbindex, nindex, do_oper, do_write) 1885 IF (l1d) THEN 1886 nbpt_in1 = datasz_in(pfileid,varid,1) 1887 CALL mathop (sopps(pfileid,varid,1),nbpt_in1,pdata_1d, & 1888 & missing_val,nbindex,nindex, & 1889 & scal(pfileid,varid,1),nbpt_out,buff_tmp) 1890 ELSE IF (l2d) THEN 1891 nbpt_in2(1:2) = datasz_in(pfileid,varid,1:2) 1892 CALL mathop (sopps(pfileid,varid,1),nbpt_in2,pdata_2d, & 1893 & missing_val,nbindex,nindex, & 1894 & scal(pfileid,varid,1),nbpt_out,buff_tmp) 1895 ELSE IF (l3d) THEN 1896 nbpt_in3(1:3) = datasz_in(pfileid,varid,1:3) 1897 CALL mathop (sopps(pfileid,varid,1),nbpt_in3,pdata_3d, & 1898 & missing_val,nbindex,nindex, & 1899 & scal(pfileid,varid,1),nbpt_out,buff_tmp) 1900 ENDIF 1901 CALL histwrite_real (pfileid,varid,pitau,nbpt_out, & 1902 & buff_tmp,nbindex,nindex,do_oper,do_write) 1817 1903 ENDIF 1818 1904 !- … … 1826 1912 last_wrt_chk(pfileid,varid) = -99 1827 1913 ENDIF 1828 !--------------------------- 1829 END SUBROUTINE histwrite_r1d 1830 !=== 1831 SUBROUTINE histwrite_r2d (pfileid,pvarname,pitau,pdata,nbindex,nindex) 1832 !--------------------------------------------------------------------- 1833 IMPLICIT NONE 1834 !- 1835 INTEGER,INTENT(IN) :: pfileid, pitau, nbindex, nindex(nbindex) 1836 REAL,DIMENSION(:,:),INTENT(IN) :: pdata 1837 CHARACTER(LEN=*),INTENT(IN) :: pvarname 1838 !- 1839 LOGICAL :: do_oper, do_write, largebuf 1840 INTEGER :: varid, io, nbpt_in(1:2), nbpt_out 1841 REAL, ALLOCATABLE,SAVE :: buff_tmp(:) 1842 INTEGER,SAVE :: buff_tmp_sz 1843 CHARACTER(LEN=7) :: tmp_opp 1844 !- 1845 LOGICAL :: check = .FALSE. 1846 !--------------------------------------------------------------------- 1847 !- 1848 ! 1.0 Try to catch errors like specifying the wrong file ID. 1849 ! Thanks Marine for showing us what errors users can make ! 1850 !- 1851 IF ( (pfileid < 1).OR.(pfileid > nb_files) ) THEN 1852 CALL ipslerr (3,"histwrite", & 1853 & 'Illegal file ID in the histwrite of variable',pvarname,' ') 1854 ENDIF 1855 !- 1856 ! 1.1 Find the id of the variable to be written and the real time 1857 !- 1858 CALL histvar_seq (pfileid,pvarname,varid) 1859 !- 1860 ! 2.0 do nothing for never operation 1861 !- 1862 tmp_opp = topp(pfileid,varid) 1863 !- 1864 IF (TRIM(tmp_opp) == "never") THEN 1865 last_opp_chk(pfileid,varid) = -99 1866 last_wrt_chk(pfileid,varid) = -99 1867 ENDIF 1868 !- 1869 ! 3.0 We check if we need to do an operation 1870 !- 1871 IF (last_opp_chk(pfileid,varid) == pitau) THEN 1872 CALL ipslerr (3,"histwrite", & 1873 & 'This variable as already been analysed at the present', & 1874 & 'time step',' ') 1875 ENDIF 1876 !- 1877 CALL isittime & 1878 & (pitau, date0(pfileid), deltat(pfileid), freq_opp(pfileid,varid), & 1879 & last_opp(pfileid,varid), last_opp_chk(pfileid,varid), do_oper) 1880 !- 1881 ! 4.0 We check if we need to write the data 1882 !- 1883 IF (last_wrt_chk(pfileid,varid) == pitau) THEN 1884 CALL ipslerr (3,"histwrite", & 1885 & 'This variable as already been written for the present', & 1886 & 'time step',' ') 1887 ENDIF 1888 !- 1889 CALL isittime & 1890 & (pitau, date0(pfileid), deltat(pfileid), freq_wrt(pfileid,varid), & 1891 & last_wrt(pfileid,varid), last_wrt_chk(pfileid,varid), do_write) 1892 !- 1893 ! 5.0 histwrite called 1894 !- 1895 IF (do_oper.OR.do_write) THEN 1896 !- 1897 !-- 5.1 Get the sizes of the data we will handle 1898 !- 1899 IF (datasz_in(pfileid,varid,1) <= 0) THEN 1900 !---- There is the risk here that the user has over-sized the array. 1901 !---- But how can we catch this ? 1902 !---- In the worst case we will do impossible operations 1903 !---- on part of the data ! 1904 datasz_in(pfileid,varid,1) = SIZE(pdata, DIM=1) 1905 datasz_in(pfileid,varid,2) = SIZE(pdata, DIM=2) 1906 datasz_in(pfileid,varid,3) = -1 1907 ENDIF 1908 !- 1909 !-- 5.2 The maximum size of the data will give the size of the buffer 1910 !- 1911 IF (datasz_max(pfileid,varid) <= 0) THEN 1912 largebuf = .FALSE. 1913 DO io=1,nbopp(pfileid,varid) 1914 IF (INDEX(fuchnbout,sopps(pfileid,varid,io)) > 0) THEN 1915 largebuf = .TRUE. 1916 ENDIF 1917 ENDDO 1918 IF (largebuf) THEN 1919 datasz_max(pfileid,varid) = & 1920 & scsize(pfileid,varid,1) & 1921 & *scsize(pfileid,varid,2) & 1922 & *scsize(pfileid,varid,3) 1923 ELSE 1924 datasz_max(pfileid,varid) = & 1925 & datasz_in(pfileid,varid,1) & 1926 & *datasz_in(pfileid,varid,2) 1927 ENDIF 1928 ENDIF 1929 !- 1930 IF (.NOT.ALLOCATED(buff_tmp)) THEN 1931 IF (check) THEN 1932 WRITE(*,*) & 1933 & "histwrite_r2d : allocate buff_tmp for buff_sz = ", & 1934 & datasz_max(pfileid,varid) 1935 ENDIF 1936 ALLOCATE (buff_tmp(datasz_max(pfileid,varid))) 1937 buff_tmp_sz = datasz_max(pfileid,varid) 1938 ELSE IF (datasz_max(pfileid,varid) > buff_tmp_sz) THEN 1939 IF (check) THEN 1940 WRITE(*,*) & 1941 & "histwrite_r2d : re-allocate buff_tmp for buff_sz = ", & 1942 & datasz_max(pfileid,varid) 1943 ENDIF 1944 DEALLOCATE (buff_tmp) 1945 ALLOCATE (buff_tmp(datasz_max(pfileid,varid))) 1946 buff_tmp_sz = datasz_max(pfileid,varid) 1947 ENDIF 1948 !- 1949 !-- We have to do the first operation anyway. 1950 !-- Thus we do it here and change the ranke 1951 !-- of the data at the same time. This should speed up things. 1952 !- 1953 nbpt_in(1:2) = datasz_in(pfileid,varid,1:2) 1954 nbpt_out = datasz_max(pfileid,varid) 1955 CALL mathop (sopps(pfileid,varid,1), nbpt_in, pdata, & 1956 & missing_val, nbindex, nindex, & 1957 & scal(pfileid,varid,1), nbpt_out, buff_tmp) 1958 CALL histwrite_real (pfileid, varid, pitau, nbpt_out, & 1959 & buff_tmp, nbindex, nindex, do_oper, do_write) 1960 ENDIF 1961 !- 1962 ! 6.0 Manage time steps 1963 !- 1964 IF ((TRIM(tmp_opp) /= "once").AND.(TRIM(tmp_opp) /= "never")) THEN 1965 last_opp_chk(pfileid,varid) = pitau 1966 last_wrt_chk(pfileid,varid) = pitau 1967 ELSE 1968 last_opp_chk(pfileid,varid) = -99 1969 last_wrt_chk(pfileid,varid) = -99 1970 ENDIF 1971 !--------------------------- 1972 END SUBROUTINE histwrite_r2d 1973 !=== 1974 SUBROUTINE histwrite_r3d (pfileid,pvarname,pitau,pdata,nbindex,nindex) 1975 !--------------------------------------------------------------------- 1976 IMPLICIT NONE 1977 !- 1978 INTEGER,INTENT(IN) :: pfileid, pitau, nbindex, nindex(nbindex) 1979 REAL,DIMENSION(:,:,:),INTENT(IN) :: pdata 1980 CHARACTER(LEN=*),INTENT(IN) :: pvarname 1981 !- 1982 LOGICAL :: do_oper, do_write, largebuf 1983 INTEGER :: varid, io, nbpt_in(1:3), nbpt_out 1984 REAL, ALLOCATABLE,SAVE :: buff_tmp(:) 1985 INTEGER,SAVE :: buff_tmp_sz 1986 CHARACTER(LEN=7) :: tmp_opp 1987 !- 1988 LOGICAL :: check = .FALSE. 1989 !--------------------------------------------------------------------- 1990 !- 1991 ! 1.0 Try to catch errors like specifying the wrong file ID. 1992 ! Thanks Marine for showing us what errors users can make ! 1993 !- 1994 IF ( (pfileid < 1).OR.(pfileid > nb_files) ) THEN 1995 CALL ipslerr (3,"histwrite", & 1996 & 'Illegal file ID in the histwrite of variable',pvarname,' ') 1997 ENDIF 1998 !- 1999 ! 1.1 Find the id of the variable to be written and the real time 2000 !- 2001 CALL histvar_seq (pfileid,pvarname,varid) 2002 !- 2003 ! 2.0 do nothing for never operation 2004 !- 2005 tmp_opp = topp(pfileid,varid) 2006 !- 2007 IF (TRIM(tmp_opp) == "never") THEN 2008 last_opp_chk(pfileid,varid) = -99 2009 last_wrt_chk(pfileid,varid) = -99 2010 ENDIF 2011 !- 2012 ! 3.0 We check if we need to do an operation 2013 !- 2014 IF (last_opp_chk(pfileid,varid) == pitau) THEN 2015 CALL ipslerr (3,"histwrite", & 2016 & 'This variable as already been analysed at the present', & 2017 & 'time step',' ') 2018 ENDIF 2019 !- 2020 CALL isittime & 2021 & (pitau, date0(pfileid), deltat(pfileid), freq_opp(pfileid,varid), & 2022 & last_opp(pfileid,varid), last_opp_chk(pfileid,varid), do_oper) 2023 !- 2024 ! 4.0 We check if we need to write the data 2025 !- 2026 IF (last_wrt_chk(pfileid,varid) == pitau) THEN 2027 CALL ipslerr (3,"histwrite", & 2028 & 'This variable as already been written for the present', & 2029 & 'time step',' ') 2030 ENDIF 2031 !- 2032 CALL isittime & 2033 & (pitau, date0(pfileid), deltat(pfileid), freq_wrt(pfileid,varid), & 2034 & last_wrt(pfileid,varid), last_wrt_chk(pfileid,varid), do_write) 2035 !- 2036 ! 5.0 histwrite called 2037 !- 2038 IF (do_oper.OR.do_write) THEN 2039 !- 2040 !-- 5.1 Get the sizes of the data we will handle 2041 !- 2042 IF (datasz_in(pfileid,varid,1) <= 0) THEN 2043 !---- There is the risk here that the user has over-sized the array. 2044 !---- But how can we catch this ? 2045 !---- In the worst case we will do impossible operations 2046 !---- on part of the data ! 2047 datasz_in(pfileid,varid,1) = SIZE(pdata, DIM=1) 2048 datasz_in(pfileid,varid,2) = SIZE(pdata, DIM=2) 2049 datasz_in(pfileid,varid,3) = SIZE(pdata, DIM=3) 2050 ENDIF 2051 !- 2052 !-- 5.2 The maximum size of the data will give the size of the buffer 2053 !- 2054 IF (datasz_max(pfileid,varid) <= 0) THEN 2055 largebuf = .FALSE. 2056 DO io =1,nbopp(pfileid,varid) 2057 IF (INDEX(fuchnbout,sopps(pfileid,varid,io)) > 0) THEN 2058 largebuf = .TRUE. 2059 ENDIF 2060 ENDDO 2061 IF (largebuf) THEN 2062 datasz_max(pfileid,varid) = & 2063 & scsize(pfileid,varid,1) & 2064 & *scsize(pfileid,varid,2) & 2065 & *scsize(pfileid,varid,3) 2066 ELSE 2067 datasz_max(pfileid,varid) = & 2068 & datasz_in(pfileid,varid,1) & 2069 & *datasz_in(pfileid,varid,2) & 2070 & *datasz_in(pfileid,varid,3) 2071 ENDIF 2072 ENDIF 2073 !- 2074 IF (.NOT.ALLOCATED(buff_tmp)) THEN 2075 IF (check) THEN 2076 WRITE(*,*) & 2077 & "histwrite_r1d : allocate buff_tmp for buff_sz = ", & 2078 & datasz_max(pfileid,varid) 2079 ENDIF 2080 ALLOCATE (buff_tmp(datasz_max(pfileid,varid))) 2081 buff_tmp_sz = datasz_max(pfileid,varid) 2082 ELSE IF (datasz_max(pfileid,varid) > buff_tmp_sz) THEN 2083 IF (check) THEN 2084 WRITE(*,*) & 2085 & "histwrite_r1d : re-allocate buff_tmp for buff_sz = ", & 2086 & datasz_max(pfileid,varid) 2087 ENDIF 2088 DEALLOCATE (buff_tmp) 2089 ALLOCATE (buff_tmp(datasz_max(pfileid,varid))) 2090 buff_tmp_sz = datasz_max(pfileid,varid) 2091 ENDIF 2092 !- 2093 !-- We have to do the first operation anyway. 2094 !-- Thus we do it here and change the ranke 2095 !-- of the data at the same time. This should speed up things. 2096 !- 2097 nbpt_in(1:3) = datasz_in(pfileid,varid,1:3) 2098 nbpt_out = datasz_max(pfileid,varid) 2099 CALL mathop (sopps(pfileid,varid,1), nbpt_in, pdata, & 2100 & missing_val, nbindex, nindex, & 2101 & scal(pfileid,varid,1), nbpt_out, buff_tmp) 2102 CALL histwrite_real (pfileid, varid, pitau, nbpt_out, & 2103 & buff_tmp, nbindex, nindex, do_oper, do_write) 2104 ENDIF 2105 !- 2106 ! 6.0 Manage time steps 2107 !- 2108 IF ((TRIM(tmp_opp) /= "once").AND.(TRIM(tmp_opp) /= "never")) THEN 2109 last_opp_chk(pfileid,varid) = pitau 2110 last_wrt_chk(pfileid,varid) = pitau 2111 ELSE 2112 last_opp_chk(pfileid,varid) = -99 2113 last_wrt_chk(pfileid,varid) = -99 2114 ENDIF 2115 !--------------------------- 2116 END SUBROUTINE histwrite_r3d 1914 !----------------------- 1915 END SUBROUTINE histw_rnd 2117 1916 !=== 2118 1917 SUBROUTINE histwrite_real & … … 2130 1929 LOGICAL,INTENT(IN) :: do_oper,do_write 2131 1930 !- 2132 INTEGER :: tsz, ncid, ncvarid 2133 INTEGER :: i, iret, ipt, itax 2134 INTEGER :: io, nbin, nbout 2135 INTEGER,DIMENSION(4) :: corner, edges 1931 INTEGER :: tsz,ncid,ncvarid,i,iret,ipt,itax,io,nbin,nbout 1932 INTEGER,DIMENSION(4) :: corner,edges 2136 1933 INTEGER :: itime 2137 1934 !- … … 2146 1943 !--------------------------------------------------------------------- 2147 1944 IF (check) THEN 2148 WRITE(*,*) "histwrite 0.0 : VAR : ", 2149 WRITE(*,*) "histwrite 0.0 : nbindex, 1945 WRITE(*,*) "histwrite 0.0 : VAR : ",name(pfileid,varid) 1946 WRITE(*,*) "histwrite 0.0 : nbindex,nindex :", & 2150 1947 & nbindex,nindex(1:MIN(3,nbindex)),'...',nindex(MAX(1,nbindex-3):nbindex) 2151 1948 ENDIF … … 2208 2005 ! 3.0 Do the operations or transfer the slab of data into buff_tmp 2209 2006 !- 2210 IF (check) WRITE(*,*) "histwrite: 3.0", 2007 IF (check) WRITE(*,*) "histwrite: 3.0",pfileid 2211 2008 !- 2212 2009 ! 3.1 DO the Operations only if needed … … 2219 2016 !-- we started in the interface routine 2220 2017 !- 2221 DO io = 2, 2018 DO io = 2,nbopp(i,varid),2 2222 2019 nbin = nbout 2223 2020 nbout = datasz_max(i,varid) … … 2259 2056 & zorig(i,varid,3),zsize(i,varid,3), & 2260 2057 & scsize(i,varid,1),scsize(i,varid,2),scsize(i,varid,3), & 2261 & buff_tmp, 2058 & buff_tmp,buff_tmp2_sz,buff_tmp2) 2262 2059 !- 2263 2060 !-- 4.0 Get the min and max of the field (buff_tmp) … … 2278 2075 !-- output we do not transfer to the buffer. 2279 2076 !- 2280 IF (check) WRITE(*,*) "histwrite: 5.0", pfileid, "tsz :",tsz2077 IF (check) WRITE(*,*) "histwrite: 5.0",pfileid,"tsz :",tsz 2281 2078 !- 2282 2079 ipt = point(pfileid,varid) 2283 2080 !- 2284 ! WRITE(*,*) 'OPE ipt, buffer :', pvarname, ipt,varid2081 ! WRITE(*,*) 'OPE ipt, buffer :',pvarname,ipt,varid 2285 2082 !- 2286 2083 IF ( (TRIM(tmp_opp) /= "inst") & … … 2297 2094 ! 6.0 Write to file if needed 2298 2095 !- 2299 IF (check) WRITE(*,*) "histwrite: 6.0", 2096 IF (check) WRITE(*,*) "histwrite: 6.0",pfileid 2300 2097 !- 2301 2098 IF (do_write) THEN … … 2306 2103 !-- 6.1 Do the operations that are needed before writting 2307 2104 !- 2308 IF (check) WRITE(*,*) "histwrite: 6.1", 2105 IF (check) WRITE(*,*) "histwrite: 6.1",pfileid 2309 2106 !- 2310 2107 IF ( (TRIM(tmp_opp) /= "inst") & … … 2319 2116 & .AND.(TRIM(tmp_opp) /= "once") ) THEN 2320 2117 !- 2321 IF (check) WRITE(*,*) "histwrite: 6.2", 2118 IF (check) WRITE(*,*) "histwrite: 6.2",pfileid 2322 2119 !- 2323 2120 itax = var_axid(pfileid,varid) 2324 2121 itime = nb_wrt(pfileid,varid)+1 2325 2122 !- 2326 IF (tax_last(pfileid, 2123 IF (tax_last(pfileid,itax) < itime) THEN 2327 2124 iret = NF90_PUT_VAR (ncid,tdimid(pfileid,itax),(/ rtime /), & 2328 2125 & start=(/ itime /),count=(/ 1 /)) 2329 tax_last(pfileid, 2126 tax_last(pfileid,itax) = itime 2330 2127 ENDIF 2331 2128 ELSE … … 2342 2139 IF (scsize(pfileid,varid,3) == 1) THEN 2343 2140 IF (regular(pfileid)) THEN 2344 corner(1:4) = (/ 1, 1, itime,0 /)2141 corner(1:4) = (/ 1,1,itime,0 /) 2345 2142 edges(1:4) = (/ zsize(pfileid,varid,1), & 2346 & zsize(pfileid,varid,2), & 2347 & 1, 0 /) 2143 & zsize(pfileid,varid,2),1,0 /) 2348 2144 ELSE 2349 corner(1:4) = (/ 1, itime, 0,0 /)2350 edges(1:4) = (/ zsize(pfileid,varid,1), 1, 0,0 /)2145 corner(1:4) = (/ 1,itime,0,0 /) 2146 edges(1:4) = (/ zsize(pfileid,varid,1),1,0,0 /) 2351 2147 ENDIF 2352 2148 ELSE 2353 2149 IF (regular(pfileid)) THEN 2354 corner(1:4) = (/ 1, 1, 1,itime /)2150 corner(1:4) = (/ 1,1,1,itime /) 2355 2151 edges(1:4) = (/ zsize(pfileid,varid,1), & 2356 2152 & zsize(pfileid,varid,2), & 2357 & zsize(pfileid,varid,3), 2153 & zsize(pfileid,varid,3),1 /) 2358 2154 ELSE 2359 corner(1:4) = (/ 1, 1, itime,0 /)2155 corner(1:4) = (/ 1,1,itime,0 /) 2360 2156 edges(1:4) = (/ zsize(pfileid,varid,1), & 2361 & zsize(pfileid,varid,3), 1,0 /)2157 & zsize(pfileid,varid,3),1,0 /) 2362 2158 ENDIF 2363 2159 ENDIF … … 2477 2273 !------ from the initialisation of the model. 2478 2274 !- 2479 DO ib = 0, 2275 DO ib = 0,sp-overlap(pfid)*2 2480 2276 IF ( learning(pfid) .AND.& 2481 2277 & SUM(ABS(varseq(pfid,ib+1:ib+overlap(pfid)) -& … … 2554 2350 LOGICAL :: check = .FALSE. 2555 2351 !--------------------------------------------------------------------- 2556 IF (check) WRITE(*,*) 'Entering loop on files :', 2352 IF (check) WRITE(*,*) 'Entering loop on files :',nb_files 2557 2353 !- 2558 2354 ! 1.The loop on files to synchronise … … 2568 2364 IF (file_exists) THEN 2569 2365 IF (check) THEN 2570 WRITE(*,*) 'Synchronising specified file number :', 2366 WRITE(*,*) 'Synchronising specified file number :',file 2571 2367 ENDIF 2572 2368 ncid = ncdf_ids(ifile) … … 2596 2392 LOGICAL :: check=.FALSE. 2597 2393 !--------------------------------------------------------------------- 2598 IF (check) WRITE(*,*) 'Entering loop on files :', 2394 IF (check) WRITE(*,*) 'Entering loop on files :',nb_files 2599 2395 !- 2600 2396 IF (PRESENT(fid)) THEN … … 2607 2403 !- 2608 2404 DO ifile=start_loop,end_loop 2609 IF (check) WRITE(*,*) 'Closing specified file number :', 2405 IF (check) WRITE(*,*) 'Closing specified file number :',ifile 2610 2406 ncid = ncdf_ids(ifile) 2611 2407 iret = NF90_REDEF (ncid) … … 2613 2409 !-- 1. Loop on the number of variables to add some final information 2614 2410 !--- 2615 IF (check) WRITE(*,*) 'Entering loop on vars : ',nb_var(ifile)2411 IF (check) WRITE(*,*) 'Entering loop on vars : ',nb_var(ifile) 2616 2412 DO iv=1,nb_var(ifile) 2617 2413 IF (hist_wrt_rng(ifile,iv)) THEN
Note: See TracChangeset
for help on using the changeset viewer.