Changeset 2567 for trunk/LMDZ.MARS/util/concatnc.F90
- Timestamp:
- Oct 5, 2021, 8:34:09 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/util/concatnc.F90
r2546 r2567 28 28 include "netcdf.inc" ! NetCDF definitions 29 29 30 character (len= 80), dimension(1000) :: file30 character (len=100), dimension(1000) :: file 31 31 ! file(): input file(s) names(s) 32 32 character (len=30), dimension(16) :: notconcat 33 33 ! notconcat(): names of the (16) variables that won't be concatenated 34 character (len= 50), dimension(:), allocatable :: var34 character (len=100), dimension(:), allocatable :: var 35 35 ! var(): name(s) of variable(s) that will be concatenated 36 36 character (len=100) :: tmpvar,tmpfile,long_name,units … … 153 153 if(nbfile==0) then 154 154 write(*,*) "no file... game over" 155 stop ""155 stop 156 156 endif 157 157 … … 183 183 if (ierr.NE.NF_NOERR) then 184 184 write(*,*) 'ERROR: Pb opening file '//file(1) 185 stop ""185 stop 186 186 endif 187 187 … … 250 250 write(*,*) "(an empty line , i.e: just <Enter>, implies end of list)" 251 251 nbvar=0 252 read(*,'(a 50)') tmpvar252 read(*,'(a100)') tmpvar 253 253 do while ((tmpvar/=' ').AND.(trim(tmpvar)/='all')) 254 254 nbvar=nbvar+1 255 255 var(nbvar)=tmpvar 256 read(*,'(a 50)') tmpvar256 read(*,'(a100)') tmpvar 257 257 enddo 258 258 … … 287 287 else if(nbvar==0) then 288 288 write(*,*) "no variable... game over" 289 stop ""289 stop 290 290 endif ! of if (tmpvar=="all") 291 291 … … 316 316 write(*,*) 'ERROR: Pb opening file '//file(i) 317 317 write(*,*) NF_STRERROR(ierr) 318 stop ""318 stop 319 319 endif 320 320 endif … … 338 338 if (ierr.NE.NF_NOERR) then 339 339 write(*,*) 'ERROR: Field <latitude> or <lat> is missing in file '//file(i) 340 stop ""340 stop 341 341 endif 342 342 ierr=NF_INQ_DIMLEN(nid,latdim,latlen) … … 347 347 ierr=NF_INQ_VARID(nid,"longitude",lonvar) 348 348 if (ierr.NE.NF_NOERR) then 349 350 stop ""349 write(*,*) 'ERROR: Field <longitude> is missing in file '//file(i) 350 stop 351 351 endif 352 352 ierr=NF_INQ_DIMLEN(nid,londim,lonlen) … … 357 357 if (ierr.NE.NF_NOERR) then 358 358 write(*,*) 'ERROR: Field <lon> is missing in file '//file(i) 359 stop ""359 stop 360 360 endif 361 361 ierr=NF_INQ_DIMLEN(nid,londim,lonlen) … … 367 367 if (ierr.NE.NF_NOERR) then 368 368 write(*,*) 'ERROR: Field <altitude> is missing in file '//file(i) 369 stop ""369 stop 370 370 endif 371 371 ierr=NF_INQ_DIMLEN(nid,altdim,altlen) … … 389 389 !============================================================================== 390 390 if (XIOS.EQ.0) then 391 392 393 394 395 396 !stop "" 391 ierr=NF_INQ_DIMID(nid,"index",ctldim) 392 if (ierr.NE.NF_NOERR) then 393 write(*,*) 'Dimension <index> is missing in file '//file(i) 394 write(*,*) "The program continues..." 395 ctllen=0 396 !stop 397 397 else 398 399 400 401 402 403 !stop "" 404 398 ierr=NF_INQ_VARID(nid,"controle",ctlvar) 399 if (ierr.NE.NF_NOERR) then 400 write(*,*) 'Field <controle> is missing in file '//file(i) 401 write(*,*) "The program continues..." 402 ctllen=0 403 !stop 404 else 405 405 ierr=NF_INQ_DIMLEN(nid,ctldim,ctllen) 406 406 endif 407 407 endif 408 408 else … … 412 412 write(*,*) "The program continues..." 413 413 ctllen=0 414 !stop ""414 !stop 415 415 else 416 416 ierr=NF_INQ_VARID(nid,"controle",ctlvar) 417 417 if (ierr.NE.NF_NOERR) then 418 419 420 421 !stop ""418 write(*,*) 'Field <controle> is missing in file '//file(i) 419 write(*,*) "The program continues..." 420 ctllen=0 421 !stop 422 422 else 423 423 ierr=NF_INQ_DIMLEN(nid,ctldim,ctllen) 424 424 endif 425 425 endif … … 439 439 if (ierr.NE.NF_NOERR) then 440 440 write(*,*) 'ERROR: Dimension <Time> is missing in file '//file(i) 441 stop ""441 stop 442 442 endif 443 443 ierr=NF_INQ_VARID(nid,"Time",timevar) 444 444 if (ierr.NE.NF_NOERR) then 445 445 write(*,*) 'ERROR: Field <Time> is missing in file '//file(i) 446 stop ""446 stop 447 447 endif 448 448 ierr=NF_INQ_DIMLEN(nid,timedim,timelen) … … 452 452 if (ierr.NE.NF_NOERR) then 453 453 write(*,*) 'ERROR: Dimension <time_counter> is missing in file '//file(i) 454 stop ""454 stop 455 455 endif 456 456 ierr=NF_INQ_VARID(nid,"time_counter",timevar) 457 457 if (ierr.NE.NF_NOERR) then 458 458 write(*,*) 'ERROR: Field <time_counter> is missing in file '//file(i) 459 stop ""459 stop 460 460 endif 461 461 ierr=NF_INQ_DIMLEN(nid,timedim,timelen) … … 542 542 if (memolatlen/=latlen) then 543 543 write(*,*) "ERROR: Not the same latitude axis" 544 stop ""544 stop 545 545 else if (memolonlen/=lonlen) then 546 546 write(*,*) "ERROR: Not the same longitude axis" 547 stop ""547 stop 548 548 else if (memoaltlen/=altlen) then 549 549 write(*,*) "ERROR: Not the same altitude axis" 550 stop ""550 stop 551 551 else if (memoctllen/=ctllen) then 552 552 write(*,*) "ERROR: Not the same controle axis" 553 stop ""553 stop 554 554 endif 555 555 endif ! of if (i==1) … … 582 582 if (rep.eq.1) write(*,*) "Sol", int(output_time) 583 583 584 ierr= NF_PUT_VARA_REAL(nout,timevarout, k,1,output_time)584 ierr= NF_PUT_VARA_REAL(nout,timevarout,(/k/),(/1/),output_time) 585 585 end do 586 586 ! use the last output_time value to update memotime … … 602 602 if (ierr.NE.NF_NOERR) then 603 603 write(*,*) 'ERROR: Field <',var(j),'> not found in file '//file(i) 604 stop ""604 stop 605 605 endif 606 606 ierr=nf_inq_varndims(nid,varid,ndim) … … 630 630 corner(4)=1 631 631 632 632 ! length (along dimensions) of block of data to be written 633 633 edges(1)=timelen 634 634 edges(2)=1 … … 648 648 corner(4)=1 649 649 650 650 ! length (along dimensions) of block of data to be written 651 651 edges(1)=lonlen 652 652 edges(2)=latlen … … 667 667 corner(4)=reptime+1 668 668 669 669 ! length (along dimensions) of block of data to be written 670 670 edges(1)=lonlen 671 671 edges(2)=latlen … … 699 699 if (ierr.ne.NF_NOERR) then 700 700 write(*,*) 'PUT_VAR ERROR: ',NF_STRERROR(ierr) 701 stop ""701 stop 702 702 endif 703 703 … … 812 812 if (ierr.NE.NF_NOERR) then 813 813 WRITE(*,*)'ERROR: Impossible to create the file.' 814 stop ""814 stop 815 815 endif 816 816 … … 963 963 hybrid=.true. 964 964 if (ierr.ne.NF_NOERR) then 965 stop "init2 Error: Failed reading aps" 965 write(*,*) "init2 Error: Failed reading aps" 966 stop 966 967 endif 967 968 … … 975 976 ierr=NF_INQ_VARID(infid,"bps",tmpvarid) 976 977 if (ierr.ne.NF_NOERR) then 977 stop "init2 Error: Failed to get bps ID." 978 write(*,*) "init2 Error: Failed to get bps ID." 979 stop 978 980 endif 979 981 ierr=NF_GET_VAR_REAL(infid,tmpvarid,bps) 980 982 if (ierr.ne.NF_NOERR) then 981 stop "init2 Error: Failed reading bps" 983 write(*,*) "init2 Error: Failed reading bps" 984 stop 982 985 endif 983 986 endif … … 997 1000 apbp=.true. 998 1001 if (ierr.ne.NF_NOERR) then 999 stop "Error: Failed reading ap" 1002 write(*,*) "Error: Failed reading ap" 1003 stop 1000 1004 endif 1001 1005 endif … … 1015 1019 apbp=.true. 1016 1020 if (ierr.ne.NF_NOERR) then 1017 stop "Error: Failed reading bp" 1021 write(*,*) "Error: Failed reading bp" 1022 stop 1018 1023 endif 1019 1024 endif … … 1034 1039 sig=.true. 1035 1040 if (ierr.ne.NF_NOERR) then 1036 stop "init2 Error: Failed reading sigma" 1041 write(*,*) "init2 Error: Failed reading sigma" 1042 stop 1037 1043 endif 1038 1044 endif … … 1052 1058 ierr=NF_GET_VAR_REAL(infid,tmpvarid,aire) 1053 1059 if (ierr.ne.NF_NOERR) then 1054 stop "init2 Error: Failed reading aire" 1060 write(*,*) "init2 Error: Failed reading aire" 1061 stop 1055 1062 endif 1056 1063 area = .true. … … 1070 1077 ierr=NF_GET_VAR_REAL(infid,tmpvarid,phisinit) 1071 1078 if (ierr.ne.NF_NOERR) then 1072 stop "init2 Error: Failed reading phisinit" 1079 write(*,*) "init2 Error: Failed reading phisinit" 1080 stop 1073 1081 endif 1074 1082 phis = .true. … … 1087 1095 (/layerdimout/),apsid,ierr) 1088 1096 if (ierr.ne.NF_NOERR) then 1089 stop "init2 Error: Failed to def_var aps" 1097 write(*,*) "init2 Error: Failed to def_var aps" 1098 stop 1090 1099 endif 1091 1100 … … 1093 1102 ierr=NF_PUT_VAR_REAL(outfid,apsid,aps) 1094 1103 if (ierr.ne.NF_NOERR) then 1095 stop "init2 Error: Failed to write aps" 1104 write(*,*) "init2 Error: Failed to write aps" 1105 stop 1096 1106 endif 1097 1107 … … 1100 1110 (/layerdimout/),bpsid,ierr) 1101 1111 if (ierr.ne.NF_NOERR) then 1102 stop "init2 Error: Failed to def_var bps" 1112 write(*,*) "init2 Error: Failed to def_var bps" 1113 stop 1103 1114 endif 1104 1115 … … 1106 1117 ierr=NF_PUT_VAR_REAL(outfid,bpsid,bps) 1107 1118 if (ierr.ne.NF_NOERR) then 1108 stop "init2 Error: Failed to write bps" 1119 write(*,*) "init2 Error: Failed to write bps" 1120 stop 1109 1121 endif 1110 1122 … … 1114 1126 (/interlayerdimout/),apid,ierr) 1115 1127 if (ierr.ne.NF_NOERR) then 1116 stop "Error: Failed to def_var ap" 1128 write(*,*) "Error: Failed to def_var ap" 1129 stop 1117 1130 endif 1118 1131 … … 1120 1133 ierr=NF_PUT_VAR_REAL(outfid,apid,ap) 1121 1134 if (ierr.ne.NF_NOERR) then 1122 stop "Error: Failed to write ap" 1135 write(*,*) "Error: Failed to write ap" 1136 stop 1123 1137 endif 1124 1138 … … 1127 1141 (/interlayerdimout/),bpid,ierr) 1128 1142 if (ierr.ne.NF_NOERR) then 1129 stop "Error: Failed to def_var bp" 1143 write(*,*) "Error: Failed to def_var bp" 1144 stop 1130 1145 endif 1131 1146 … … 1133 1148 ierr=NF_PUT_VAR_REAL(outfid,bpid,bp) 1134 1149 if (ierr.ne.NF_NOERR) then 1135 stop "Error: Failed to write bp" 1150 write(*,*) "Error: Failed to write bp" 1151 stop 1136 1152 endif 1137 1153 endif ! of if (apbp) … … 1142 1158 (/layerdimout/),sigmaid,ierr) 1143 1159 if (ierr.ne.NF_NOERR) then 1144 stop "init2 Error: Failed to def_var sigma" 1160 write(*,*) "init2 Error: Failed to def_var sigma" 1161 stop 1145 1162 endif 1146 1163 ! write sigma 1147 1164 ierr=NF_PUT_VAR_REAL(outfid,sigmaid,sigma) 1148 1165 if (ierr.ne.NF_NOERR) then 1149 stop "init2 Error: Failed to write sigma" 1166 write(*,*) "init2 Error: Failed to write sigma" 1167 stop 1150 1168 endif 1151 1169 endif ! of if (hybrid) … … 1160 1178 (/londimout,latdimout/),tmpvarid,ierr) 1161 1179 if (ierr.ne.NF_NOERR) then 1162 stop "init2 Error: Failed to def_var aire" 1180 write(*,*) "init2 Error: Failed to def_var aire" 1181 stop 1163 1182 endif 1164 1183 … … 1166 1185 ierr=NF_PUT_VAR_REAL(outfid,tmpvarid,aire) 1167 1186 if (ierr.ne.NF_NOERR) then 1168 stop "init2 Error: Failed to write aire" 1187 write(*,*) "init2 Error: Failed to write aire" 1188 stop 1169 1189 endif 1170 1190 endif ! of if (area) … … 1176 1196 (/londimout,latdimout/),phisinitid,ierr) 1177 1197 if (ierr.ne.NF_NOERR) then 1178 stop "init2 Error: Failed to def_var phisinit" 1198 write(*,*) "init2 Error: Failed to def_var phisinit" 1199 stop 1179 1200 endif 1180 1201 … … 1182 1203 ierr=NF_PUT_VAR_REAL(outfid,phisinitid,phisinit) 1183 1204 if (ierr.ne.NF_NOERR) then 1184 stop "init2 Error: Failed to write phisinit" 1205 write(*,*) "init2 Error: Failed to write phisinit" 1206 stop 1185 1207 endif 1186 1208 … … 1296 1318 write(*,*) 'ERROR in change_time_axis: Field <Time> not found' 1297 1319 print*, NF_STRERROR(ierr) 1298 stop ""1320 stop 1299 1321 endif 1300 1322 … … 1494 1516 !write(*,*) 'NF_NOERR', NF_NOERR 1495 1517 !CALL abort 1496 stop ""1518 stop 1497 1519 endif 1498 1520 … … 1505 1527 ! WRITE(*,*) 'NF_NOERR', NF_NOERR 1506 1528 ! CALL abort 1507 stop ""1529 stop 1508 1530 endif 1509 1531
Note: See TracChangeset
for help on using the changeset viewer.