Changeset 2567
- Timestamp:
- Oct 5, 2021, 8:34:09 AM (3 years ago)
- Location:
- trunk/LMDZ.MARS/util
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/util/aeroptical.F90
r2443 r2567 1304 1304 hybrid=.true. 1305 1305 if (ierr.ne.nf90_noerr) then 1306 stop "init2 Error: Failed reading aps" 1306 write(*,*) "init2 Error: Failed reading aps" 1307 stop 1307 1308 endif 1308 1309 … … 1316 1317 ierr=nf90_inq_varid(gcmfid,"bps",tmpvarid) 1317 1318 if (ierr.ne.nf90_noerr) then 1318 stop "init2 Error: Failed to get bps ID." 1319 write(*,*) "init2 Error: Failed to get bps ID." 1320 stop 1319 1321 endif 1320 1322 ierr=NF90_GET_VAR(gcmfid,tmpvarid,bps) 1321 1323 if (ierr.ne.nf90_noerr) then 1322 stop "init2 Error: Failed reading bps" 1324 write(*,*) "init2 Error: Failed reading bps" 1325 stop 1323 1326 endif 1324 1327 endif … … 1338 1341 apbp=.true. 1339 1342 if (ierr.ne.nf90_noerr) then 1340 stop "Error: Failed reading ap" 1343 write(*,*) "Error: Failed reading ap" 1344 stop 1341 1345 endif 1342 1346 endif … … 1357 1361 apbp=.true. 1358 1362 if (ierr.ne.nf90_noerr) then 1359 stop "Error: Failed reading bp" 1363 write(*,*) "Error: Failed reading bp" 1364 stop 1360 1365 endif 1361 1366 endif … … 1372 1377 ierr=NF90_GET_VAR(gcmfid,tmpvarid,sigma) 1373 1378 if (ierr.ne.nf90_noerr) then 1374 stop "init2 Error: Failed reading sigma" 1379 write(*,*) "init2 Error: Failed reading sigma" 1380 stop 1375 1381 endif 1376 1382 endif ! of if (.not.hybrid) … … 1389 1395 ierr=NF90_GET_VAR(gcmfid,tmpvarid,aire) 1390 1396 if (ierr.ne.nf90_noerr) then 1391 stop "init2 Error: Failed reading aire" 1397 write(*,*) "init2 Error: Failed reading aire" 1398 stop 1392 1399 endif 1393 1400 area = .true. … … 1407 1414 ierr=NF90_GET_VAR(gcmfid,tmpvarid,phisinit) 1408 1415 if (ierr.ne.nf90_noerr) then 1409 stop "init2 Error: Failed reading phisinit" 1416 write(*,*) "init2 Error: Failed reading phisinit" 1417 stop 1410 1418 endif 1411 1419 phis = .true. … … 1426 1434 ierr=NF90_DEF_VAR(outfid,"aps",nf90_float,(/layerdimout/),tmpvarid) 1427 1435 if (ierr.ne.nf90_noerr) then 1428 stop "init2 Error: Failed to define the variable aps" 1436 write(*,*) "init2 Error: Failed to define the variable aps" 1437 stop 1429 1438 endif 1430 1439 ! Write the attributes … … 1437 1446 ierr=NF90_PUT_VAR(outfid,tmpvarid,aps) 1438 1447 if (ierr.ne.nf90_noerr) then 1439 stop "init2 Error: Failed to write aps" 1448 write(*,*) "init2 Error: Failed to write aps" 1449 stop 1440 1450 endif 1441 1451 … … 1446 1456 ierr=NF90_DEF_VAR(outfid,"bps",nf90_float,(/layerdimout/),tmpvarid) 1447 1457 if (ierr.ne.nf90_noerr) then 1448 stop "init2 Error: Failed to define the variable bps" 1458 write(*,*) "init2 Error: Failed to define the variable bps" 1459 stop 1449 1460 endif 1450 1461 ! Write the attributes … … 1457 1468 ierr=NF90_PUT_VAR(outfid,tmpvarid,bps) 1458 1469 if (ierr.ne.nf90_noerr) then 1459 stop "init2 Error: Failed to write bps" 1470 write(*,*) "init2 Error: Failed to write bps" 1471 stop 1460 1472 endif 1461 1473 … … 1468 1480 ierr=NF90_DEF_VAR(outfid,"ap",nf90_float,(/interlayerdimout/),tmpvarid) 1469 1481 if (ierr.ne.nf90_noerr) then 1470 stop "init2 Error: Failed to define the variable ap" 1482 write(*,*) "init2 Error: Failed to define the variable ap" 1483 stop 1471 1484 endif 1472 1485 ! Write the attributes … … 1479 1492 ierr=NF90_PUT_VAR(outfid,tmpvarid,ap) 1480 1493 if (ierr.ne.nf90_noerr) then 1481 stop "Error: Failed to write ap" 1494 write(*,*) "Error: Failed to write ap" 1495 stop 1482 1496 endif 1483 1497 … … 1489 1503 ierr=NF90_DEF_VAR(outfid,"bp",nf90_float,(/interlayerdimout/),tmpvarid) 1490 1504 if (ierr.ne.nf90_noerr) then 1491 stop "init2 Error: Failed to define the variable bp" 1505 write(*,*) "init2 Error: Failed to define the variable bp" 1506 stop 1492 1507 endif 1493 1508 ! Write the attributes … … 1500 1515 ierr=NF90_PUT_VAR(outfid,tmpvarid,bp) 1501 1516 if (ierr.ne.nf90_noerr) then 1502 stop "Error: Failed to write bp" 1517 write(*,*) "Error: Failed to write bp" 1518 stop 1503 1519 endif 1504 1520 endif ! of if (apbp) … … 1511 1527 ierr=NF90_DEF_VAR(outfid,"sigma",nf90_float,(/layerdimout/),tmpvarid) 1512 1528 if (ierr.ne.nf90_noerr) then 1513 stop "init2 Error: Failed to define the variable sigma" 1529 write(*,*) "init2 Error: Failed to define the variable sigma" 1530 stop 1514 1531 endif 1515 1532 ! Write the attributes … … 1522 1539 ierr=NF90_PUT_VAR(outfid,tmpvarid,sigma) 1523 1540 if (ierr.ne.nf90_noerr) then 1524 stop "init2 Error: Failed to write sigma" 1541 write(*,*) "init2 Error: Failed to write sigma" 1542 stop 1525 1543 endif 1526 1544 endif ! of if (hybrid) … … 1537 1555 ierr=NF90_DEF_VAR(outfid,"aire",nf90_float,(/londimout,latdimout/),tmpvarid) 1538 1556 if (ierr.ne.nf90_noerr) then 1539 stop "init2 Error: Failed to define the variable aire" 1557 write(*,*) "init2 Error: Failed to define the variable aire" 1558 stop 1540 1559 endif 1541 1560 ! Write the attributes … … 1548 1567 ierr=NF90_PUT_VAR(outfid,tmpvarid,aire) 1549 1568 if (ierr.ne.nf90_noerr) then 1550 stop "init2 Error: Failed to write aire" 1569 write(*,*) "init2 Error: Failed to write aire" 1570 stop 1551 1571 endif 1552 1572 endif ! of if (area) … … 1559 1579 ierr=NF90_DEF_VAR(outfid,"phisinit",nf90_float,(/londimout,latdimout/),tmpvarid) 1560 1580 if (ierr.ne.nf90_noerr) then 1561 stop "init2 Error: Failed to define the variable phisinit" 1581 write(*,*) "init2 Error: Failed to define the variable phisinit" 1582 stop 1562 1583 endif 1563 1584 ! Write the attributes … … 1570 1591 ierr=NF90_PUT_VAR(outfid,tmpvarid,phisinit) 1571 1592 if (ierr.ne.nf90_noerr) then 1572 stop "init2 Error: Failed to write phisinit" 1593 write(*,*) "init2 Error: Failed to write phisinit" 1594 stop 1573 1595 endif 1574 1596 -
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 -
trunk/LMDZ.MARS/util/hrecast.F90
r2140 r2567 116 116 if (ierr.ne.NF_NOERR) then 117 117 write(*,*) 'ERROR: Pb opening file ',trim(infile) 118 stop ""118 stop 119 119 endif 120 120 … … 189 189 write(*,*) 'No variables to process !?' 190 190 write(*,*) 'Might as well stop here' 191 stop ""191 stop 192 192 else 193 193 write(*,*) "" … … 209 209 ierr=NF_INQ_DIMID(infid,"latitude",tmpdimid) 210 210 if (ierr.ne.NF_NOERR) then 211 stop "Error: Failed to get latitude dimension ID" 211 write(*,*) "Error: Failed to get latitude dimension ID" 212 stop 212 213 else 213 214 ierr=NF_INQ_VARID(infid,"latitude",tmpvarid) 214 215 if (ierr.ne.NF_NOERR) then 215 stop "Error: Failed to get latitude ID" 216 write(*,*) "Error: Failed to get latitude ID" 217 stop 216 218 else 217 219 ierr=NF_INQ_DIMLEN(infid,tmpdimid,inlatlength) 218 220 if (ierr.ne.NF_NOERR) then 219 stop "Error: Failed to get latitude length" 221 write(*,*) "Error: Failed to get latitude length" 222 stop 220 223 else 221 224 allocate(inlat(inlatlength)) 222 225 ierr=NF_GET_VAR_REAL(infid,tmpvarid,inlat) 223 226 if (ierr.ne.NF_NOERR) then 224 stop "Error: Failed reading latitude" 227 write(*,*) "Error: Failed reading latitude" 228 stop 225 229 endif 226 230 endif … … 244 248 ierr=NF_INQ_DIMID(infid,"longitude",tmpdimid) 245 249 if (ierr.ne.NF_NOERR) then 246 stop "Error: Failed to get longitude dimension ID" 250 write(*,*) "Error: Failed to get longitude dimension ID" 251 stop 247 252 else 248 253 ierr=NF_INQ_VARID(infid,"longitude",tmpvarid) 249 254 if (ierr.ne.NF_NOERR) then 250 stop "Error: Failed to get longitude ID" 255 write(*,*) "Error: Failed to get longitude ID" 256 stop 251 257 else 252 258 ierr=NF_INQ_DIMLEN(infid,tmpdimid,inlonlength) 253 259 if (ierr.ne.NF_NOERR) then 254 stop "Error: Failed to get longitude length" 260 write(*,*) "Error: Failed to get longitude length" 261 stop 255 262 else 256 263 allocate(inlon(inlonlength)) 257 264 ierr=NF_GET_VAR_REAL(infid,tmpvarid,inlon) 258 265 if (ierr.ne.NF_NOERR) then 259 stop "Error: Failed reading longitude" 266 write(*,*) "Error: Failed reading longitude" 267 stop 260 268 endif 261 269 endif … … 279 287 ierr=NF_INQ_DIMID(infid,"altitude",tmpdimid) 280 288 if (ierr.ne.NF_NOERR) then 281 stop "Error: Failed to get altitude dimension ID" 289 write(*,*) "Error: Failed to get altitude dimension ID" 290 stop 282 291 else 283 292 ierr=NF_INQ_VARID(infid,"altitude",tmpvarid) 284 293 if (ierr.ne.NF_NOERR) then 285 stop "Error: Failed to get altitude ID" 294 write(*,*) "Error: Failed to get altitude ID" 295 stop 286 296 else 287 297 ierr=NF_INQ_DIMLEN(infid,tmpdimid,altlength) 288 298 if (ierr.ne.NF_NOERR) then 289 stop "Error: Failed to get altitude length" 299 write(*,*) "Error: Failed to get altitude length" 300 stop 290 301 else 291 302 allocate(alt(altlength)) 292 303 ierr=NF_GET_VAR_REAL(infid,tmpvarid,alt) 293 304 if (ierr.ne.NF_NOERR) then 294 stop "Error: Failed reading altitude" 305 write(*,*) "Error: Failed reading altitude" 306 stop 295 307 endif 296 308 endif … … 301 313 ierr=NF_INQ_DIMID(infid,"Time",tmpdimid) 302 314 if (ierr.ne.NF_NOERR) then 303 stop "Error: Failed to get Time dimension ID" 315 write(*,*) "Error: Failed to get Time dimension ID" 316 stop 304 317 else 305 318 ierr=NF_INQ_VARID(infid,"Time",tmpvarid) 306 319 if (ierr.ne.NF_NOERR) then 307 stop "Error: Failed to get Time ID" 320 write(*,*) "Error: Failed to get Time ID" 321 stop 308 322 else 309 323 ierr=NF_INQ_DIMLEN(infid,tmpdimid,timelength) 310 324 if (ierr.ne.NF_NOERR) then 311 stop "Error: Failed to get Time length" 325 write(*,*) "Error: Failed to get Time length" 326 stop 312 327 else 313 328 allocate(time(timelength)) 314 329 ierr=NF_GET_VAR_REAL(infid,tmpvarid,time) 315 330 if (ierr.ne.NF_NOERR) then 316 stop "Error: Failed reading Time" 331 write(*,*) "Error: Failed reading Time" 332 stop 317 333 endif 318 334 endif … … 332 348 ierr=NF_GET_VAR_REAL(infid,tmpvarid,sigma) 333 349 if (ierr.ne.NF_NOERR) then 334 stop "Error: Failed reading sigma" 350 write(*,*) "Error: Failed reading sigma" 351 stop 335 352 endif 336 353 endif … … 341 358 ierr=NF_INQ_VARID(infid,"aps",tmpvarid) 342 359 if (ierr.ne.NF_NOERR) then 343 stop "Error: Failed to get aps ID" 360 write(*,*) "Error: Failed to get aps ID" 361 stop 344 362 else 345 363 allocate(aps(altlength)) 346 364 ierr=NF_GET_VAR_REAL(infid,tmpvarid,aps) 347 365 if (ierr.ne.NF_NOERR) then 348 stop "Error: Failed reading aps" 366 write(*,*) "Error: Failed reading aps" 367 stop 349 368 endif 350 369 endif … … 353 372 ierr=NF_INQ_VARID(infid,"bps",tmpvarid) 354 373 if (ierr.ne.NF_NOERR) then 355 stop "Error: Failed to get bps ID" 374 write(*,*) "Error: Failed to get bps ID" 375 stop 356 376 else 357 377 allocate(bps(altlength)) 358 378 ierr=NF_GET_VAR_REAL(infid,tmpvarid,bps) 359 379 if (ierr.ne.NF_NOERR) then 360 stop "Error: Failed reading bps" 380 write(*,*) "Error: Failed reading bps" 381 stop 361 382 endif 362 383 endif … … 377 398 ierr=NF_GET_VAR_REAL(infid,tmpvarid,inphisinit) 378 399 if (ierr.ne.NF_NOERR) then 379 stop "Error: Failed reading phisinit" 400 write(*,*) "Error: Failed reading phisinit" 401 stop 380 402 endif 381 403 endif … … 525 547 ierr=NF_DEF_DIM(outfid,"longitude",lonlength,lon_dimid) 526 548 if (ierr.ne.NF_NOERR) then 527 stop "Error: Could not define longitude dimension" 549 write(*,*) "Error: Could not define longitude dimension" 550 stop 528 551 endif 529 552 … … 531 554 ierr=NF_DEF_DIM(outfid,"latitude",latlength,lat_dimid) 532 555 if (ierr.ne.NF_NOERR) then 533 stop "Error: Could not define latitude dimension" 556 write(*,*) "Error: Could not define latitude dimension" 557 stop 534 558 endif 535 559 … … 537 561 ierr=NF_DEF_DIM(outfid,"altitude",altlength,alt_dimid) 538 562 if (ierr.ne.NF_NOERR) then 539 stop "Error: Could not define altitude dimension" 563 write(*,*) "Error: Could not define altitude dimension" 564 stop 540 565 endif 541 566 … … 543 568 ierr=NF_DEF_DIM(outfid,"Time",NF_UNLIMITED,time_dimid) 544 569 if (ierr.ne.NF_NOERR) then 545 stop "Error: Could not define latitude dimension" 570 write(*,*) "Error: Could not define latitude dimension" 571 stop 546 572 endif 547 573 … … 556 582 ierr=NF_DEF_VAR(outfid,"longitude",NF_REAL,1,datashape(1),lon_varid) 557 583 if (ierr.ne.NF_NOERR) then 558 stop "Error: Could not define longitude variable" 584 write(*,*) "Error: Could not define longitude variable" 585 stop 559 586 endif 560 587 … … 563 590 ierr=NF_PUT_ATT_TEXT(outfid,lon_varid,'long_name',len_trim(text),text) 564 591 if (ierr.ne.NF_NOERR) then 565 stop "Error: Problem writing long_name for longitude" 592 write(*,*) "Error: Problem writing long_name for longitude" 593 stop 566 594 endif 567 595 text='degrees_east' 568 596 ierr=NF_PUT_ATT_TEXT(outfid,lon_varid,'units',len_trim(text),text) 569 597 if (ierr.ne.NF_NOERR) then 570 stop "Error: Problem writing units for longitude" 598 write(*,*) "Error: Problem writing units for longitude" 599 stop 571 600 endif 572 601 … … 575 604 ierr=NF_DEF_VAR(outfid,"latitude",NF_REAL,1,datashape(2),lat_varid) 576 605 if (ierr.ne.NF_NOERR) then 577 stop "Error: Could not define latitude variable" 606 write(*,*) "Error: Could not define latitude variable" 607 stop 578 608 endif 579 609 … … 582 612 ierr=NF_PUT_ATT_TEXT(outfid,lat_varid,'long_name',len_trim(text),text) 583 613 if (ierr.ne.NF_NOERR) then 584 stop "Error: Problem writing long_name for latitude" 614 write(*,*) "Error: Problem writing long_name for latitude" 615 stop 585 616 endif 586 617 text='degrees_north' 587 618 ierr=NF_PUT_ATT_TEXT(outfid,lat_varid,'units',len_trim(text),text) 588 619 if (ierr.ne.NF_NOERR) then 589 stop "Error: Problem writing units for latitude" 620 write(*,*) "Error: Problem writing units for latitude" 621 stop 590 622 endif 591 623 … … 594 626 ierr=NF_DEF_VAR(outfid,"altitude",NF_REAL,1,datashape(3),alt_varid) 595 627 if (ierr.ne.NF_NOERR) then 596 stop "Error: Could not define altitude variable" 628 write(*,*) "Error: Could not define altitude variable" 629 stop 597 630 endif 598 631 … … 629 662 ierr=NF_DEF_VAR(outfid,"sigma",NF_REAL,1,alt_dimid,sigma_varid) 630 663 if (ierr.ne.NF_NOERR) then 631 stop "Error: Could not define sigma variable" 664 write(*,*) "Error: Could not define sigma variable" 665 stop 632 666 endif 633 667 else ! hybrid coordinates 634 668 ierr=NF_DEF_VAR(outfid,"aps",NF_REAL,1,alt_dimid,aps_varid) 635 669 if (ierr.ne.NF_NOERR) then 636 stop "Error: Could not define aps variable" 670 write(*,*) "Error: Could not define aps variable" 671 stop 637 672 endif 638 673 ierr=NF_DEF_VAR(outfid,"bps",NF_REAL,1,alt_dimid,bps_varid) 639 674 if (ierr.ne.NF_NOERR) then 640 stop "Error: Could not define bps variable" 675 write(*,*) "Error: Could not define bps variable" 676 stop 641 677 endif 642 678 endif … … 647 683 ierr=NF_PUT_ATT_TEXT(outfid,sigma_varid,'long_name',len_trim(text),text) 648 684 if (ierr.ne.NF_NOERR) then 649 stop "Error: Problem writing long_name for sigma" 685 write(*,*) "Error: Problem writing long_name for sigma" 686 stop 650 687 endif 651 688 else ! hybrid coordinates … … 653 690 ierr=NF_PUT_ATT_TEXT(outfid,aps_varid,'long_name',len_trim(text),text) 654 691 if (ierr.ne.NF_NOERR) then 655 stop "Error: Problem writing long_name for aps" 692 write(*,*) "Error: Problem writing long_name for aps" 693 stop 656 694 endif 657 695 text="hybrid sigma at midlayers" 658 696 ierr=NF_PUT_ATT_TEXT(outfid,bps_varid,'long_name',len_trim(text),text) 659 697 if (ierr.ne.NF_NOERR) then 660 stop "Error: Problem writing long_name for bps" 698 write(*,*) "Error: Problem writing long_name for bps" 699 stop 661 700 endif 662 701 endif ! of if (have_sigma) … … 666 705 ierr=NF_DEF_VAR(outfid,"Time",NF_REAL,1,datashape(4),time_varid) 667 706 if (ierr.ne.NF_NOERR) then 668 stop "Error: Could not define Time variable" 707 write(*,*) "Error: Could not define Time variable" 708 stop 669 709 endif 670 710 … … 683 723 ierr=NF_PUT_ATT_TEXT(outfid,time_varid,'units',len_trim(text),text) 684 724 if (ierr.ne.NF_NOERR) then 685 stop "Error: Problem writing units for Time" 725 write(*,*) "Error: Problem writing units for Time" 726 stop 686 727 endif 687 728 endif … … 694 735 ierr=NF_DEF_VAR(outfid,"phisinit",NF_REAL,2,datashape,phisinit_varid) 695 736 if (ierr.ne.NF_NOERR) then 696 stop "Error: Could not define phisinit variable" 737 write(*,*) "Error: Could not define phisinit variable" 738 stop 697 739 endif 698 740 endif … … 701 743 ierr=NF_PUT_ATT_TEXT(outfid,phisinit_varid,'long_name',len_trim(text),text) 702 744 if (ierr.ne.NF_NOERR) then 703 stop "Error: Problem writing long_name for phisinit" 745 write(*,*) "Error: Problem writing long_name for phisinit" 746 stop 704 747 endif 705 748 endif ! of if (have_geopot) … … 714 757 if (ierr.ne.NF_NOERR) then 715 758 write(*,*) 'Error, failed to get ID for input variable ',trim(var(i)) 716 stop ""759 stop 717 760 endif 718 761 … … 738 781 if (ierr.ne.NF_NOERR) then 739 782 write(*,*) 'Error, could not define variable ',trim(var(i)) 740 stop ""783 stop 741 784 endif 742 785 … … 747 790 write(*,*) 'Error, could not get number of attributes for variable ',& 748 791 trim(var(i)) 749 stop ""792 stop 750 793 endif 751 794 ! inititialize j == number of attributes written to output … … 766 809 if (ierr.ne.NF_NOERR) then 767 810 write(*,*) "Error failed to copy title attribute:",trim(text) 768 stop ""811 stop 769 812 endif 770 813 endif … … 775 818 if (ierr.ne.NF_NOERR) then 776 819 write(*,*) "Error failed to copy long_name attribute:",trim(text) 777 stop ""820 stop 778 821 endif 779 822 endif … … 789 832 if (ierr.ne.NF_NOERR) then 790 833 write(*,*) "Error failed to copy units attribute:",trim(text) 791 stop ""834 stop 792 835 endif 793 836 endif … … 805 848 ierr=NF_PUT_ATT_REAL(outfid,var_id(i),'missing_value',NF_REAL,1,miss_val) 806 849 if (ierr.ne.NF_NOERR) then 807 stop "Error, failed to write missing_value attribute" 850 write(*,*) "Error, failed to write missing_value attribute" 851 stop 808 852 endif 809 853 … … 823 867 ierr=NF_ENDDEF(outfid) 824 868 if (ierr.ne.NF_NOERR) then 825 stop "Error: Could not switch out of define mode" 869 write(*,*) "Error: Could not switch out of define mode" 870 stop 826 871 endif 827 872 … … 829 874 ierr=NF_PUT_VAR_REAL(outfid,lon_varid,lon) 830 875 if (ierr.ne.NF_NOERR) then 831 stop "Error: Could not write longitude data to output file" 876 write(*,*) "Error: Could not write longitude data to output file" 877 stop 832 878 endif 833 879 … … 835 881 ierr=NF_PUT_VAR_REAL(outfid,lat_varid,lat) 836 882 if (ierr.ne.NF_NOERR) then 837 stop "Error: Could not write latitude data to output file" 883 write(*,*) "Error: Could not write latitude data to output file" 884 stop 838 885 endif 839 886 … … 841 888 ierr=NF_PUT_VAR_REAL(outfid,alt_varid,alt) 842 889 if (ierr.ne.NF_NOERR) then 843 stop "Error: Could not write altitude data to output file" 890 write(*,*) "Error: Could not write altitude data to output file" 891 stop 844 892 endif 845 893 … … 848 896 ierr=NF_PUT_VAR_REAL(outfid,sigma_varid,sigma) 849 897 if (ierr.ne.NF_NOERR) then 850 stop "Error: Could not write sigma data to output file" 898 write(*,*) "Error: Could not write sigma data to output file" 899 stop 851 900 endif 852 901 else ! hybrid coordinates 853 902 ierr=NF_PUT_VAR_REAL(outfid,aps_varid,aps) 854 903 if (ierr.ne.NF_NOERR) then 855 stop "Error: Could not write aps data to output file" 904 write(*,*) "Error: Could not write aps data to output file" 905 stop 856 906 endif 857 907 ierr=NF_PUT_VAR_REAL(outfid,bps_varid,bps) 858 908 if (ierr.ne.NF_NOERR) then 859 stop "Error: Could not write bps data to output file" 909 write(*,*) "Error: Could not write bps data to output file" 910 stop 860 911 endif 861 912 endif 862 913 863 914 ! write time 864 ierr=NF_PUT_VARA_REAL(outfid,time_varid,1,timelength,time) 865 if (ierr.ne.NF_NOERR) then 866 stop "Error: Could not write Time data to output file" 915 ierr=NF_PUT_VARA_REAL(outfid,time_varid,(/1/),(/timelength/),time) 916 if (ierr.ne.NF_NOERR) then 917 write(*,*) "Error: Could not write Time data to output file" 918 stop 867 919 endif 868 920 … … 880 932 ierr=NF_INQ_VARID(infid,"phisinit",tmpvarid) 881 933 if (ierr.ne.NF_NOERR) then 882 stop "Error: Failed to get phisinit ID" 934 write(*,*) "Error: Failed to get phisinit ID" 935 stop 883 936 endif 884 937 ! Get physinit 885 938 ierr=NF_GET_VAR_REAL(infid,tmpvarid,in_2d_data) 886 939 if (ierr.ne.NF_NOERR) then 887 stop "Error: Failed reading input phisinit" 940 write(*,*) "Error: Failed reading input phisinit" 941 stop 888 942 endif 889 943 … … 903 957 ierr=NF_PUT_VAR_REAL(outfid,phisinit_varid,out_2d_data) 904 958 if (ierr.ne.NF_NOERR) then 905 stop "Error: Could not write phisinit data to output file" 959 write(*,*) "Error: Could not write phisinit data to output file" 960 stop 906 961 endif 907 962 endif ! of if (have_geopot) … … 1073 1128 1074 1129 REAL airen ((imnmx2+1)*(jmnmx2+1)) ! aire dans la nouvelle grille 1075 REAL airentotn 1076 REAL airentots 1130 REAL airentotn ! aire totale pole nord dans la nouvelle grille 1131 REAL airentots ! aire totale pole sud dans la nouvelle grille 1077 1132 ! Info sur les ktotal intersection entre les cases new/old grille 1078 1133 -
trunk/LMDZ.MARS/util/localtime.F90
r2546 r2567 12 12 include "netcdf.inc" ! NetCDF definitions 13 13 14 character (len= 50) file14 character (len=100) file 15 15 ! file(): input file(s) names(s) 16 16 character (len=30), dimension(16) :: notprocessed 17 17 ! notprocessed(): names of the (16) variables that won't be processed 18 character (len= 50), dimension(:), allocatable :: var18 character (len=100), dimension(:), allocatable :: var 19 19 ! var(): name(s) of variable(s) that will be processed 20 20 character (len=100) :: tmpvar,long_name,units … … 121 121 if (len_trim(file).eq.0) then 122 122 write(*,*) "no file... game over" 123 stop ""123 stop 124 124 endif 125 125 … … 132 132 write(*,*) 'ERROR: Pb opening file '//trim(file) 133 133 write(*,*) NF_STRERROR(ierr) 134 stop ""134 stop 135 135 endif 136 136 … … 140 140 write(*,*) 'ERROR: Pb with NF_INQ_NVARS' 141 141 write(*,*) NF_STRERROR(ierr) 142 stop ""142 stop 143 143 endif 144 144 … … 199 199 write(*,*) "(an empty line , i.e: just <Enter>, implies end of list)" 200 200 nbvar=0 201 read(*,'(a 50)') tmpvar201 read(*,'(a100)') tmpvar 202 202 do while ((tmpvar/=' ').AND.(trim(tmpvar)/='all')) 203 203 nbvar=nbvar+1 204 204 var(nbvar)=tmpvar 205 read(*,'(a 50)') tmpvar205 read(*,'(a100)') tmpvar 206 206 enddo 207 207 … … 219 219 else if(nbvar==0) then 220 220 write(*,*) "no variable... game over" 221 stop ""221 stop 222 222 endif ! of if (tmpvar=="all") 223 223 … … 238 238 write(*,*) 'ERROR: Pb opening file '//trim(file) 239 239 write(*,*) NF_STRERROR(ierr) 240 stop ""240 stop 241 241 endif 242 242 … … 251 251 if (ierr.NE.NF_NOERR) then 252 252 write(*,*) 'ERROR: Dimension <latitude> and <lat> is missing in file '//trim(file) 253 stop ""253 stop 254 254 endif 255 255 endif … … 260 260 if (ierr.NE.NF_NOERR) then 261 261 write(*,*) 'ERROR: Field <latitude> and <lat> is missing in file '//trim(file) 262 stop ""262 stop 263 263 endif 264 264 endif … … 272 272 if (ierr.NE.NF_NOERR) then 273 273 write(*,*) 'ERROR: Dimension <longitude> and <lon> is missing in file '//trim(file) 274 stop ""274 stop 275 275 endif 276 276 endif … … 281 281 if (ierr.NE.NF_NOERR) then 282 282 write(*,*) 'ERROR: Field <longitude> and <lon> is missing in file '//trim(file) 283 stop ""283 stop 284 284 endif 285 285 endif … … 290 290 if (ierr.NE.NF_NOERR) then 291 291 write(*,*) 'ERROR: Dimension <altitude> is missing in file '//trim(file) 292 stop ""292 stop 293 293 endif 294 294 ierr=NF_INQ_VARID(nid,"altitude",altvar) 295 295 if (ierr.NE.NF_NOERR) then 296 296 write(*,*) 'ERROR: Field <altitude> is missing in file '//trim(file) 297 stop ""297 stop 298 298 endif 299 299 ierr=NF_INQ_DIMLEN(nid,altdim,altlen) … … 321 321 ctllen=0 322 322 endif 323 !stop ""323 !stop 324 324 endif 325 325 ! ierr=NF_INQ_DIMID(nid,"controle_axe",ctldim) 326 326 ! if (ierr.NE.NF_NOERR) then 327 ! !stop ""327 ! !stop 328 328 ! endif 329 329 ierr=NF_INQ_VARID(nid,"controle",ctlvar) … … 331 331 write(*,*) 'Field <controle> is missing in file '//trim(file) 332 332 ctllen=0 333 !stop ""333 !stop 334 334 else 335 335 ierr=NF_INQ_DIMLEN(nid,ctldim,ctllen) … … 414 414 if (ierr.NE.NF_NOERR) then 415 415 write(*,*) 'ERROR: Dimension <Time> or is missing in file'//trim(file) 416 stop ""416 stop 417 417 endif 418 418 endif … … 423 423 if (ierr.NE.NF_NOERR) then 424 424 write(*,*) 'ERROR: Field <Time> is missing in file '//trim(file) 425 stop ""425 stop 426 426 endif 427 427 endif … … 556 556 557 557 do it=1,timelen_lt 558 ierr= NF_PUT_VARA_REAL(nout,timevarout, it,1,lt_hour(it))558 ierr= NF_PUT_VARA_REAL(nout,timevarout,(/it/),(/1/),lt_hour(it)) 559 559 enddo 560 560 else 561 561 do it=1,timelen_lt 562 ierr= NF_PUT_VARA_REAL(nout,timevarout, it,1,lt_out(it))562 ierr= NF_PUT_VARA_REAL(nout,timevarout,(/it/),(/1/),lt_out(it)) 563 563 if (ierr.NE.NF_NOERR) then 564 564 write(*,*) "Error , failed to write Time" … … 582 582 if (ierr.NE.NF_NOERR) then 583 583 write(*,*) 'ERROR: Field <',var(j),'> not found in file'//file 584 stop ""584 stop 585 585 endif 586 586 ierr=nf_inq_varndims(nid,varid,ndim) … … 718 718 if (ierr.ne.NF_NOERR) then 719 719 write(*,*) 'PUT_VAR ERROR: ',NF_STRERROR(ierr) 720 stop ""720 stop 721 721 endif 722 722 … … 820 820 WRITE(*,*)'ERROR: Impossible to create the file ',trim(filename) 821 821 write(*,*) NF_STRERROR(ierr) 822 stop ""822 stop 823 823 endif 824 824 … … 831 831 WRITE(*,*)'initiate: error failed to define dimension <latitude>' 832 832 write(*,*) NF_STRERROR(ierr) 833 stop ""833 stop 834 834 endif 835 835 ierr = NF_DEF_DIM(nout, "longitude", lonlen, londimout) … … 837 837 WRITE(*,*)'initiate: error failed to define dimension <longitude>' 838 838 write(*,*) NF_STRERROR(ierr) 839 stop ""839 stop 840 840 endif 841 841 ierr = NF_DEF_DIM(nout, "altitude", altlen, altdimout) … … 843 843 WRITE(*,*)'initiate: error failed to define dimension <altitude>' 844 844 write(*,*) NF_STRERROR(ierr) 845 stop ""845 stop 846 846 endif 847 847 if (size(ctl).ne.0) then … … 850 850 WRITE(*,*)'initiate: error failed to define dimension <index>' 851 851 write(*,*) NF_STRERROR(ierr) 852 stop ""852 stop 853 853 endif 854 854 endif … … 857 857 WRITE(*,*)'initiate: error failed to define dimension <Time>' 858 858 write(*,*) NF_STRERROR(ierr) 859 stop ""859 stop 860 860 endif 861 861 … … 867 867 WRITE(*,*)'initiate: error failed to switch out of define mode' 868 868 write(*,*) NF_STRERROR(ierr) 869 stop ""869 stop 870 870 endif 871 871 … … 888 888 WRITE(*,*)'initiate: error failed writing variable <latitude>' 889 889 write(*,*) NF_STRERROR(ierr) 890 stop ""890 stop 891 891 endif 892 892 … … 903 903 WRITE(*,*)'initiate: error failed writing variable <longitude>' 904 904 write(*,*) NF_STRERROR(ierr) 905 stop ""905 stop 906 906 endif 907 907 … … 926 926 WRITE(*,*)'initiate: error failed writing variable <altitude>' 927 927 write(*,*) NF_STRERROR(ierr) 928 stop ""928 stop 929 929 endif 930 930 … … 948 948 WRITE(*,*)'initiate: error failed writing variable <controle>' 949 949 write(*,*) NF_STRERROR(ierr) 950 stop ""950 stop 951 951 endif 952 952 endif … … 1014 1014 hybrid=.true. 1015 1015 if (ierr.ne.NF_NOERR) then 1016 stop "init2 Error: Failed reading aps" 1016 write(*,*) "init2 Error: Failed reading aps" 1017 stop 1017 1018 endif 1018 1019 … … 1031 1032 ierr=NF_GET_VAR_REAL(infid,tmpvarid,bps) 1032 1033 if (ierr.ne.NF_NOERR) then 1033 stop "init2 Error: Failed reading bps" 1034 write(*,*) "init2 Error: Failed reading bps" 1035 stop 1034 1036 endif 1035 1037 endif … … 1050 1052 ierr=NF_GET_VAR_REAL(infid,tmpvarid,phisinit) 1051 1053 if (ierr.ne.NF_NOERR) then 1052 stop "init2 Error: Failed reading phisinit" 1054 write(*,*) "init2 Error: Failed reading phisinit" 1055 stop 1053 1056 endif 1054 1057 phis = .true. … … 1069 1072 (/layerdimout/),apsid,ierr) 1070 1073 if (ierr.ne.NF_NOERR) then 1071 stop "Error: Failed to def_var aps" 1074 write(*,*) "Error: Failed to def_var aps" 1075 stop 1072 1076 endif 1073 1077 … … 1075 1079 ierr=NF_PUT_VAR_REAL(outfid,apsid,aps) 1076 1080 if (ierr.ne.NF_NOERR) then 1077 stop "Error: Failed to write aps" 1081 write(*,*) "Error: Failed to write aps" 1082 stop 1078 1083 endif 1079 1084 … … 1082 1087 (/layerdimout/),bpsid,ierr) 1083 1088 if (ierr.ne.NF_NOERR) then 1084 stop "Error: Failed to def_var bps" 1089 write(*,*) "Error: Failed to def_var bps" 1090 stop 1085 1091 endif 1086 1092 … … 1088 1094 ierr=NF_PUT_VAR_REAL(outfid,bpsid,bps) 1089 1095 if (ierr.ne.NF_NOERR) then 1090 stop "Error: Failed to write bps" 1096 write(*,*) "Error: Failed to write bps" 1097 stop 1091 1098 endif 1092 1099 … … 1105 1112 (/londimout,latdimout/),phisinitid,ierr) 1106 1113 if (ierr.ne.NF_NOERR) then 1107 stop "Error: Failed to def_var phisinit" 1114 write(*,*) "Error: Failed to def_var phisinit" 1115 stop 1108 1116 endif 1109 1117 … … 1111 1119 ierr=NF_PUT_VAR_REAL(outfid,phisinitid,phisinit) 1112 1120 if (ierr.ne.NF_NOERR) then 1113 stop "Error: Failed to write phisinit" 1121 write(*,*) "Error: Failed to write phisinit" 1122 stop 1114 1123 endif 1115 1124 … … 1226 1235 !write(*,*) 'NF_NOERR', NF_NOERR 1227 1236 !CALL abort 1228 stop ""1237 stop 1229 1238 endif 1230 1239 endif … … 1238 1247 ! WRITE(*,*) 'NF_NOERR', NF_NOERR 1239 1248 ! CALL abort 1240 stop ""1249 stop 1241 1250 endif 1242 1251 endif -
trunk/LMDZ.MARS/util/lslin.F90
r2450 r2567 131 131 write(*,*) 'Failed to open file '//infile 132 132 write(*,*) NF_STRERROR(ierr) 133 stop ""133 stop 134 134 endif 135 135 … … 149 149 write(*,*) "Failed to get number of dims for variable number:",start_var 150 150 write(*,*) NF_STRERROR(ierr) 151 stop ""151 stop 152 152 endif 153 153 enddo … … 188 188 write(*,*) 'ERROR: Field <latitude> is missing' 189 189 write(*,*) NF_STRERROR(ierr) 190 stop ""190 stop 191 191 endif 192 192 ierr=NF_INQ_DIMLEN(nid,latdim,latlen) … … 198 198 write(*,*) 'ERROR: Field <longitude> is missing' 199 199 write(*,*) NF_STRERROR(ierr) 200 stop ""200 stop 201 201 endif 202 202 ierr=NF_INQ_DIMLEN(nid,londim,lonlen) … … 208 208 write(*,*) 'ERROR: Field <altitude> is missing' 209 209 write(*,*) NF_STRERROR(ierr) 210 ! stop ""210 ! stop 211 211 altlen = 1 212 212 else … … 239 239 write(*,*) ' Dimension <index> is missing in file '//trim(infile) 240 240 ctllen=0 241 !stop ""241 !stop 242 242 endif 243 243 ierr=NF_INQ_VARID(nid,"controle",ctlvar) … … 245 245 write(*,*) 'Field <controle> is missing in file '//trim(infile) 246 246 ctllen=0 247 !stop ""247 !stop 248 248 else 249 249 ierr=NF_INQ_DIMLEN(nid,ctldim,ctllen) … … 289 289 write(*,*) 'ERROR: Dimension <Time> is missing' 290 290 write(*,*) NF_STRERROR(ierr) 291 stop ""291 stop 292 292 endif 293 293 ierr=NF_INQ_VARID(nid,"Time",timevar) … … 295 295 write(*,*) 'ERROR: Field <Time> is missing' 296 296 write(*,*) NF_STRERROR(ierr) 297 stop ""297 stop 298 298 endif 299 299 … … 407 407 408 408 do k=1,Nls 409 ierr= NF_PUT_VARA_REAL(nout,timevarout, k,1,timels(k))409 ierr= NF_PUT_VARA_REAL(nout,timevarout,(/k/),(/1/),timels(k)) 410 410 enddo 411 411 … … 426 426 write(*,*) 'ERROR: Field <',var(j),'> not found' 427 427 write(*,*) NF_STRERROR(ierr) 428 stop "Better stop now..." 428 write(*,*) "Better stop now..." 429 stop 429 430 endif 430 431 … … 589 590 if (ierr.ne.NF_NOERR) then 590 591 write(*,*) 'PUT_VAR ERROR: ',NF_STRERROR(ierr) 591 stop ""592 stop 592 593 endif 593 594 … … 716 717 WRITE(*,*)'ERROR: Impossible to create the file ',trim(filename) 717 718 write(*,*) NF_STRERROR(ierr) 718 stop ""719 stop 719 720 endif 720 721 … … 727 728 WRITE(*,*)'initiate: error failed to define dimension <latitude>' 728 729 write(*,*) NF_STRERROR(ierr) 729 stop ""730 stop 730 731 endif 731 732 ierr = NF_DEF_DIM(nout, "longitude", lonlen, londimout) … … 733 734 WRITE(*,*)'initiate: error failed to define dimension <longitude>' 734 735 write(*,*) NF_STRERROR(ierr) 735 stop ""736 stop 736 737 endif 737 738 ierr = NF_DEF_DIM(nout, "altitude", altlen, altdimout) … … 739 740 WRITE(*,*)'initiate: error failed to define dimension <altitude>' 740 741 write(*,*) NF_STRERROR(ierr) 741 stop ""742 stop 742 743 endif 743 744 if (size(ctl).ne.0) then … … 746 747 WRITE(*,*)'initiate: error failed to define dimension <index>' 747 748 write(*,*) NF_STRERROR(ierr) 748 stop ""749 stop 749 750 endif 750 751 endif … … 753 754 WRITE(*,*)'initiate: error failed to define dimension <Time>' 754 755 write(*,*) NF_STRERROR(ierr) 755 stop ""756 stop 756 757 endif 757 758 … … 761 762 WRITE(*,*)'initiate: error failed to switch out of define mode' 762 763 write(*,*) NF_STRERROR(ierr) 763 stop ""764 stop 764 765 endif 765 766 … … 785 786 WRITE(*,*)'initiate: error failed writing variable <latitude>' 786 787 write(*,*) NF_STRERROR(ierr) 787 stop ""788 stop 788 789 endif 789 790 … … 799 800 WRITE(*,*)'initiate: error failed writing variable <longitude>' 800 801 write(*,*) NF_STRERROR(ierr) 801 stop ""802 stop 802 803 endif 803 804 … … 822 823 WRITE(*,*)'initiate: error failed writing variable <altitude>' 823 824 write(*,*) NF_STRERROR(ierr) 824 stop ""825 stop 825 826 endif 826 827 … … 844 845 WRITE(*,*)'initiate: error failed writing variable <controle>' 845 846 write(*,*) NF_STRERROR(ierr) 846 stop ""847 stop 847 848 endif 848 849 endif … … 917 918 ierr=NF_GET_VAR_REAL(infid,tmpvarid,aps) 918 919 if (ierr.ne.NF_NOERR) then 919 stop "init2 error: Failed reading aps" 920 write(*,*) "init2 error: Failed reading aps" 921 stop 920 922 aps_ok=.false. 921 923 endif … … 945 947 ierr=NF_GET_VAR_REAL(infid,tmpvarid,bps) 946 948 if (ierr.ne.NF_NOERR) then 947 stop "init2 Error: Failed reading bps" 949 write(*,*) "init2 Error: Failed reading bps" 950 stop 948 951 bps_ok=.false. 949 952 endif … … 966 969 ierr=NF_GET_VAR_REAL(infid,tmpvarid,phisinit) 967 970 if (ierr.ne.NF_NOERR) then 968 stop "init2 Error: Failed reading phisinit" 971 write(*,*) "init2 Error: Failed reading phisinit" 972 stop 969 973 endif 970 974 phis = .true. … … 985 989 (/altdimout/),apsid,ierr) 986 990 if (ierr.ne.NF_NOERR) then 987 stop "Error: Failed to def_var aps" 991 write(*,*) "Error: Failed to def_var aps" 992 stop 988 993 endif 989 994 … … 991 996 ierr=NF_PUT_VAR_REAL(outfid,apsid,aps) 992 997 if (ierr.ne.NF_NOERR) then 993 stop "Error: Failed to write aps" 998 write(*,*) "Error: Failed to write aps" 999 stop 994 1000 endif 995 1001 ENDIF ! of IF (aps_ok) … … 1000 1006 (/altdimout/),bpsid,ierr) 1001 1007 if (ierr.ne.NF_NOERR) then 1002 stop "Error: Failed to def_var bps" 1008 write(*,*) "Error: Failed to def_var bps" 1009 stop 1003 1010 endif 1004 1011 … … 1006 1013 ierr=NF_PUT_VAR_REAL(outfid,bpsid,bps) 1007 1014 if (ierr.ne.NF_NOERR) then 1008 stop "Error: Failed to write bps" 1015 write(*,*) "Error: Failed to write bps" 1016 stop 1009 1017 endif 1010 1018 ENDIF ! of IF (bps_ok) … … 1020 1028 (/londimout,latdimout/),phisinitid,ierr) 1021 1029 if (ierr.ne.NF_NOERR) then 1022 stop "Error: Failed to def_var phisinit" 1030 write(*,*) "Error: Failed to def_var phisinit" 1031 stop 1023 1032 endif 1024 1033 … … 1026 1035 ierr=NF_PUT_VAR_REAL(outfid,phisinitid,phisinit) 1027 1036 if (ierr.ne.NF_NOERR) then 1028 stop "Error: Failed to write phisinit" 1037 write(*,*) "Error: Failed to write phisinit" 1038 stop 1029 1039 endif 1030 1040 … … 1141 1151 ! print*,'missing_value: valid_range attribution failed' 1142 1152 ! print*, NF_STRERROR(ierr) 1143 ! stop ""1153 ! stop 1144 1154 !endif 1145 1155 !********************************************************* … … 1150 1160 print*, 'missing_value: missing value attribution failed' 1151 1161 print*, NF_STRERROR(ierr) 1152 stop ""1162 stop 1153 1163 endif 1154 1164 -
trunk/LMDZ.MARS/util/solzenangle.F90
r2434 r2567 17 17 character (len=30), dimension(16) :: notprocessed 18 18 ! notprocessed(): names of the (16) variables that won't be processed 19 character (len= 50), dimension(:), allocatable :: var19 character (len=100), dimension(:), allocatable :: var 20 20 ! var(): name(s) of variable(s) that will be processed 21 21 character (len=100) :: tmpvar,long_name,units … … 141 141 if (len_trim(file).eq.0) then 142 142 write(*,*) "no file... game over" 143 stop ""143 stop 144 144 endif 145 145 … … 152 152 write(*,*) 'ERROR: Pb opening file '//trim(file) 153 153 write(*,*) NF_STRERROR(ierr) 154 stop ""154 stop 155 155 endif 156 156 … … 160 160 write(*,*) 'ERROR: Pb with NF_INQ_NVARS' 161 161 write(*,*) NF_STRERROR(ierr) 162 stop ""162 stop 163 163 endif 164 164 … … 218 218 write(*,*) "(an empty line , i.e: just <Enter>, implies end of list)" 219 219 nbvar=0 220 read(*,'(a 50)') tmpvar220 read(*,'(a100)') tmpvar 221 221 do while ((tmpvar/=' ').AND.(trim(tmpvar)/='all')) 222 222 nbvar=nbvar+1 223 223 var(nbvar)=tmpvar 224 read(*,'(a 50)') tmpvar224 read(*,'(a100)') tmpvar 225 225 enddo 226 226 … … 238 238 else if(nbvar==0) then 239 239 write(*,*) "no variable... game over" 240 stop ""240 stop 241 241 endif ! of if (tmpvar=="all") 242 242 … … 252 252 write(*,*) 'ERROR: Pb opening file '//trim(file) 253 253 write(*,*) NF_STRERROR(ierr) 254 stop ""254 stop 255 255 endif 256 256 … … 262 262 if (ierr.NE.NF_NOERR) then 263 263 write(*,*) 'ERROR: Dimension <latitude> is missing in file '//trim(file) 264 stop ""264 stop 265 265 endif 266 266 ierr=NF_INQ_VARID(nid,"latitude",latvar) 267 267 if (ierr.NE.NF_NOERR) then 268 268 write(*,*) 'ERROR: Field <latitude> is missing in file '//trim(file) 269 stop ""269 stop 270 270 endif 271 271 ierr=NF_INQ_DIMLEN(nid,latdim,latlen) … … 275 275 if (ierr.NE.NF_NOERR) then 276 276 write(*,*) 'ERROR: Dimension <longitude> is missing in file '//trim(file) 277 stop ""277 stop 278 278 endif 279 279 ierr=NF_INQ_VARID(nid,"longitude",lonvar) 280 280 if (ierr.NE.NF_NOERR) then 281 281 write(*,*) 'ERROR: Field <longitude> is missing in file'//trim(file) 282 stop ""282 stop 283 283 endif 284 284 ierr=NF_INQ_DIMLEN(nid,londim,lonlen) … … 288 288 if (ierr.NE.NF_NOERR) then 289 289 write(*,*) 'ERROR: Dimension <altitude> is missing in file '//trim(file) 290 stop ""290 stop 291 291 endif 292 292 ierr=NF_INQ_VARID(nid,"altitude",altvar) 293 293 if (ierr.NE.NF_NOERR) then 294 294 write(*,*) 'ERROR: Field <altitude> is missing in file'//trim(file) 295 stop ""295 stop 296 296 endif 297 297 ierr=NF_INQ_DIMLEN(nid,altdim,altlen) … … 315 315 write(*,*) ' Dimension <index> is missing in file '//trim(file) 316 316 ctllen=0 317 !stop ""317 !stop 318 318 endif 319 319 ierr=NF_INQ_VARID(nid,"controle",ctlvar) … … 321 321 write(*,*) 'Field <controle> is missing in file '//trim(file) 322 322 ctllen=0 323 !stop ""323 !stop 324 324 else 325 325 ierr=NF_INQ_DIMLEN(nid,ctldim,ctllen) … … 401 401 if (ierr.NE.NF_NOERR) then 402 402 write(*,*) 'ERROR: Dimension <Time> is missing in file'//trim(file) 403 stop ""403 stop 404 404 endif 405 405 ierr=NF_INQ_VARID(nid,"Time",timevar) 406 406 if (ierr.NE.NF_NOERR) then 407 407 write(*,*) 'ERROR: Field <Time> is missing in file'//trim(file) 408 stop ""408 stop 409 409 endif 410 410 ierr=NF_INQ_DIMLEN(nid,timedim,timelen) … … 583 583 584 584 do it=1,nsol 585 ierr= NF_PUT_VARA_REAL(nout,timevarout, it,1,intsol(it)*24.)585 ierr= NF_PUT_VARA_REAL(nout,timevarout,(/it/),(/1/),intsol(it)*24.) 586 586 enddo 587 587 else 588 588 do it=1,nsol 589 ierr= NF_PUT_VARA_REAL(nout,timevarout, it,1,intsol(it))589 ierr= NF_PUT_VARA_REAL(nout,timevarout,(/it/),(/1/),intsol(it)) 590 590 if (ierr.NE.NF_NOERR) then 591 591 write(*,*) "Error , failed to write Time" … … 609 609 if (ierr.NE.NF_NOERR) then 610 610 write(*,*) 'ERROR: Field <',var(j),'> not found in file'//file 611 stop ""611 stop 612 612 endif 613 613 ierr=nf_inq_varndims(nid,varid,ndim) … … 768 768 if (ierr.ne.NF_NOERR) then 769 769 write(*,*) 'PUT_VAR ERROR: ',NF_STRERROR(ierr) 770 stop ""770 stop 771 771 endif 772 772 … … 814 814 if (ierr.ne.NF_NOERR) then 815 815 write(*,*) 'PUT_VAR ERROR: ',NF_STRERROR(ierr) 816 stop ""816 stop 817 817 endif 818 818 … … 929 929 WRITE(*,*)'ERROR: Impossible to create the file ',trim(filename) 930 930 write(*,*) NF_STRERROR(ierr) 931 stop ""931 stop 932 932 endif 933 933 … … 940 940 WRITE(*,*)'initiate: error failed to define dimension <latitude>' 941 941 write(*,*) NF_STRERROR(ierr) 942 stop ""942 stop 943 943 endif 944 944 ierr = NF_DEF_DIM(nout, "longitude", lonlen, londimout) … … 946 946 WRITE(*,*)'initiate: error failed to define dimension <longitude>' 947 947 write(*,*) NF_STRERROR(ierr) 948 stop ""948 stop 949 949 endif 950 950 ierr = NF_DEF_DIM(nout, "altitude", altlen, altdimout) … … 952 952 WRITE(*,*)'initiate: error failed to define dimension <altitude>' 953 953 write(*,*) NF_STRERROR(ierr) 954 stop ""954 stop 955 955 endif 956 956 if (size(ctl).ne.0) then … … 959 959 WRITE(*,*)'initiate: error failed to define dimension <index>' 960 960 write(*,*) NF_STRERROR(ierr) 961 stop ""961 stop 962 962 endif 963 963 endif … … 966 966 WRITE(*,*)'initiate: error failed to define dimension <Time>' 967 967 write(*,*) NF_STRERROR(ierr) 968 stop ""968 stop 969 969 endif 970 970 … … 973 973 WRITE(*,*)'initiate: error failed to define dimension <GCM_layers>' 974 974 write(*,*) NF_STRERROR(ierr) 975 stop ""975 stop 976 976 endif 977 977 … … 981 981 WRITE(*,*)'initiate: error failed to switch out of define mode' 982 982 write(*,*) NF_STRERROR(ierr) 983 stop ""983 stop 984 984 endif 985 985 !============================================================================== … … 992 992 ierr = NF_REDEF (nout) 993 993 ierr = NF_PUT_ATT_TEXT(nout,timevarout,'comment',135,& 994 "The true unit of the variable Time is the integer value &995 994 "The true unit of the variable Time is the integer value "//& 995 "of sol at lon=0deg. A false unit is put to enable reading from Grads or Ferret") 996 996 ! End netcdf define mode 997 997 ierr = NF_ENDDEF(nout) … … 1008 1008 WRITE(*,*)'initiate: error failed writing variable <latitude>' 1009 1009 write(*,*) NF_STRERROR(ierr) 1010 stop ""1010 stop 1011 1011 endif 1012 1012 … … 1022 1022 WRITE(*,*)'initiate: error failed writing variable <longitude>' 1023 1023 write(*,*) NF_STRERROR(ierr) 1024 stop ""1024 stop 1025 1025 endif 1026 1026 … … 1045 1045 WRITE(*,*)'initiate: error failed writing variable <altitude>' 1046 1046 write(*,*) NF_STRERROR(ierr) 1047 stop ""1047 stop 1048 1048 endif 1049 1049 … … 1067 1067 WRITE(*,*)'initiate: error failed writing variable <controle>' 1068 1068 write(*,*) NF_STRERROR(ierr) 1069 stop ""1069 stop 1070 1070 endif 1071 1071 endif … … 1134 1134 hybrid=.true. 1135 1135 if (ierr.ne.NF_NOERR) then 1136 stop "init2 Error: Failed reading aps" 1136 write(*,*) "init2 Error: Failed reading aps" 1137 stop 1137 1138 endif 1138 1139 … … 1151 1152 ierr=NF_GET_VAR_REAL(infid,tmpvarid,bps) 1152 1153 if (ierr.ne.NF_NOERR) then 1153 stop "init2 Error: Failed reading bps" 1154 write(*,*) "init2 Error: Failed reading bps" 1155 stop 1154 1156 endif 1155 1157 endif … … 1170 1172 ierr=NF_GET_VAR_REAL(infid,tmpvarid,phisinit) 1171 1173 if (ierr.ne.NF_NOERR) then 1172 stop "init2 Error: Failed reading phisinit" 1174 write(*,*) "init2 Error: Failed reading phisinit" 1175 stop 1173 1176 endif 1174 1177 phis = .true. … … 1189 1192 (/layerdimout/),apsid,ierr) 1190 1193 if (ierr.ne.NF_NOERR) then 1191 stop "Error: Failed to def_var aps" 1194 write(*,*) "Error: Failed to def_var aps" 1195 stop 1192 1196 endif 1193 1197 … … 1195 1199 ierr=NF_PUT_VAR_REAL(outfid,apsid,aps) 1196 1200 if (ierr.ne.NF_NOERR) then 1197 stop "Error: Failed to write aps" 1201 write(*,*) "Error: Failed to write aps" 1202 stop 1198 1203 endif 1199 1204 … … 1202 1207 (/layerdimout/),bpsid,ierr) 1203 1208 if (ierr.ne.NF_NOERR) then 1204 stop "Error: Failed to def_var bps" 1209 write(*,*) "Error: Failed to def_var bps" 1210 stop 1205 1211 endif 1206 1212 … … 1208 1214 ierr=NF_PUT_VAR_REAL(outfid,bpsid,bps) 1209 1215 if (ierr.ne.NF_NOERR) then 1210 stop "Error: Failed to write bps" 1216 write(*,*) "Error: Failed to write bps" 1217 stop 1211 1218 endif 1212 1219 … … 1225 1232 (/londimout,latdimout/),phisinitid,ierr) 1226 1233 if (ierr.ne.NF_NOERR) then 1227 stop "Error: Failed to def_var phisinit" 1234 write(*,*) "Error: Failed to def_var phisinit" 1235 stop 1228 1236 endif 1229 1237 … … 1231 1239 ierr=NF_PUT_VAR_REAL(outfid,phisinitid,phisinit) 1232 1240 if (ierr.ne.NF_NOERR) then 1233 stop "Error: Failed to write phisinit" 1241 write(*,*) "Error: Failed to write phisinit" 1242 stop 1234 1243 endif 1235 1244 … … 1347 1356 !write(*,*) 'NF_NOERR', NF_NOERR 1348 1357 !CALL abort 1349 stop ""1358 stop 1350 1359 endif 1351 1360 endif … … 1360 1369 ! WRITE(*,*) 'NF_NOERR', NF_NOERR 1361 1370 ! CALL abort 1362 stop ""1371 stop 1363 1372 endif 1364 1373 endif -
trunk/LMDZ.MARS/util/streamfunction.F90
r2513 r2567 129 129 if (ierr.ne.NF_NOERR) then 130 130 write(*,*) 'ERROR: Pb opening input file' 131 stop ""131 stop 132 132 endif 133 133 … … 143 143 ierr=NF_INQ_DIMID(infid,"latitude",tmpdimid) 144 144 if (ierr.ne.NF_NOERR) then 145 stop "Error: Failed to get latitude dimension ID" 145 write(*,*) "Error: Failed to get latitude dimension ID" 146 stop 146 147 else 147 148 ierr=NF_INQ_VARID(infid,"latitude",tmpvarid) 148 149 if (ierr.ne.NF_NOERR) then 149 stop "Error: Failed to get latitude ID" 150 write(*,*) "Error: Failed to get latitude ID" 151 stop 150 152 else 151 153 ierr=NF_INQ_DIMLEN(infid,tmpdimid,latlength) 152 154 if (ierr.ne.NF_NOERR) then 153 stop "Error: Failed to get latitude length" 155 write(*,*) "Error: Failed to get latitude length" 156 stop 154 157 else 155 158 allocate(lat(latlength)) 156 159 ierr=NF_GET_VAR_REAL(infid,tmpvarid,lat) 157 160 if (ierr.ne.NF_NOERR) then 158 stop "Error: Failed reading latitude" 161 write(*,*) "Error: Failed reading latitude" 162 stop 159 163 endif 160 164 endif … … 165 169 ierr=NF_INQ_DIMID(infid,"longitude",tmpdimid) 166 170 if (ierr.ne.NF_NOERR) then 167 stop "Error: Failed to get longitude dimension ID" 171 write(*,*) "Error: Failed to get longitude dimension ID" 172 stop 168 173 else 169 174 ierr=NF_INQ_VARID(infid,"longitude",tmpvarid) 170 175 if (ierr.ne.NF_NOERR) then 171 stop "Error: Failed to get longitude ID" 176 write(*,*) "Error: Failed to get longitude ID" 177 stop 172 178 else 173 179 ierr=NF_INQ_DIMLEN(infid,tmpdimid,lonlength) 174 180 if (ierr.ne.NF_NOERR) then 175 stop "Error: Failed to get longitude length" 181 write(*,*) "Error: Failed to get longitude length" 182 stop 176 183 else 177 184 allocate(lon(lonlength)) 178 185 ierr=NF_GET_VAR_REAL(infid,tmpvarid,lon) 179 186 if (ierr.ne.NF_NOERR) then 180 stop "Error: Failed reading longitude" 187 write(*,*) "Error: Failed reading longitude" 188 stop 181 189 endif 182 190 endif … … 187 195 ierr=NF_INQ_DIMID(infid,"Time",tmpdimid) 188 196 if (ierr.ne.NF_NOERR) then 189 stop "Error: Failed to get Time dimension ID" 197 write(*,*) "Error: Failed to get Time dimension ID" 198 stop 190 199 else 191 200 ierr=NF_INQ_VARID(infid,"Time",tmpvarid) 192 201 if (ierr.ne.NF_NOERR) then 193 stop "Error: Failed to get Time ID" 202 write(*,*) "Error: Failed to get Time ID" 203 stop 194 204 else 195 205 ierr=NF_INQ_DIMLEN(infid,tmpdimid,timelength) 196 206 if (ierr.ne.NF_NOERR) then 197 stop "Error: Failed to get Time length" 207 write(*,*) "Error: Failed to get Time length" 208 stop 198 209 else 199 210 allocate(time(timelength)) 200 211 ierr=NF_GET_VAR_REAL(infid,tmpvarid,time) 201 212 if (ierr.ne.NF_NOERR) then 202 stop "Error: Failed reading Time" 213 write(*,*) "Error: Failed reading Time" 214 stop 203 215 endif 204 216 endif … … 209 221 ierr=NF_INQ_DIMID(infid,"altitude",tmpdimid) 210 222 if (ierr.ne.NF_NOERR) then 211 stop "Error: Failed to get altitude dimension ID" 223 write(*,*) "Error: Failed to get altitude dimension ID" 224 stop 212 225 else 213 226 ierr=NF_INQ_VARID(infid,"altitude",tmpvarid) 214 227 if (ierr.ne.NF_NOERR) then 215 stop "Error: Failed to get altitude length" 228 write(*,*) "Error: Failed to get altitude length" 229 stop 216 230 else 217 231 ierr=NF_INQ_DIMLEN(infid,tmpdimid,altlength) 218 232 if (ierr.ne.NF_NOERR) then 219 stop "Error: Failed to get altitude length" 233 write(*,*) "Error: Failed to get altitude length" 234 stop 220 235 else 221 236 allocate(alt(altlength)) 222 237 ierr=NF_GET_VAR_REAL(infid,tmpvarid,alt) 223 238 if (ierr.ne.NF_NOERR) then 224 stop "Error: Failed reading Altitude" 239 write(*,*) "Error: Failed reading Altitude" 240 stop 225 241 endif 226 242 endif … … 235 251 ierr=NF_INQ_VARID(infid,"aps",tmpvarid) 236 252 if (ierr.ne.NF_NOERR) then 237 stop "Error: Failed to get aps ID" 253 write(*,*) "Error: Failed to get aps ID" 254 stop 238 255 else 239 256 allocate(aps(altlength)) 240 257 ierr=NF_GET_VAR_REAL(infid,tmpvarid,aps) 241 258 if (ierr.ne.NF_NOERR) then 242 stop "Error: Failed reading aps" 259 write(*,*) "Error: Failed reading aps" 260 stop 243 261 endif 244 262 endif … … 247 265 ierr=NF_INQ_VARID(infid,"bps",tmpvarid) 248 266 if (ierr.ne.NF_NOERR) then 249 stop "Error: Failed to get bps ID" 267 write(*,*) "Error: Failed to get bps ID" 268 stop 250 269 else 251 270 allocate(bps(altlength)) 252 271 ierr=NF_GET_VAR_REAL(infid,tmpvarid,bps) 253 272 if (ierr.ne.NF_NOERR) then 254 stop "Error: Failed reading bps" 273 write(*,*) "Error: Failed reading bps" 274 stop 255 275 endif 256 276 endif … … 259 279 ierr=NF_INQ_VARID(infid,"ps",tmpvarid) 260 280 if (ierr.ne.NF_NOERR) then 261 stop "Error: Failed to get ps ID" 281 write(*,*) "Error: Failed to get ps ID" 282 stop 262 283 else 263 284 allocate(ps(lonlength,latlength,timelength)) 264 285 ierr=NF_GET_VAR_REAL(infid,tmpvarid,ps) 265 286 if (ierr.ne.NF_NOERR) then 266 stop "Error: Failed reading ps" 287 write(*,*) "Error: Failed reading ps" 288 stop 267 289 endif 268 290 endif … … 284 306 ierr=NF_INQ_VARID(infid,"u",tmpvarid) 285 307 if (ierr.ne.NF_NOERR) then 286 stop "Error: Failed to get u ID" 308 write(*,*) "Error: Failed to get u ID" 309 stop 287 310 else 288 311 allocate(u(lonlength,latlength,altlength,timelength)) 289 312 ierr=NF_GET_VAR_REAL(infid,tmpvarid,u) 290 313 if (ierr.ne.NF_NOERR) then 291 stop "Error: Failed reading zonal wind" 314 write(*,*) "Error: Failed reading zonal wind" 315 stop 292 316 endif 293 317 endif … … 296 320 ierr=NF_INQ_VARID(infid,"v",tmpvarid) 297 321 if (ierr.ne.NF_NOERR) then 298 stop "Error: Failed to get v ID" 322 write(*,*) "Error: Failed to get v ID" 323 stop 299 324 else 300 325 allocate(v(lonlength,latlength,altlength,timelength)) 301 326 ierr=NF_GET_VAR_REAL(infid,tmpvarid,v) 302 327 if (ierr.ne.NF_NOERR) then 303 stop "Error: Failed reading zonal wind" 328 write(*,*) "Error: Failed reading zonal wind" 329 stop 304 330 endif 305 331 endif … … 322 348 if (ierr.ne.NF_NOERR) then 323 349 write(*,*) "Problem: Could not find/open these files" 324 stop "Might as well stop here" 350 write(*,*) "Might as well stop here" 351 stop 325 352 endif 326 353 endif … … 329 356 ierr=NF_INQ_VARID(infid2,"aire",tmpvarid) 330 357 if (ierr.ne.NF_NOERR) then 331 stop "Error: Failed to get aire ID" 358 write(*,*) "Error: Failed to get aire ID" 359 stop 332 360 endif 333 361 ! Get aire 334 362 ierr=NF_GET_VAR_REAL(infid2,tmpvarid,aire) 335 363 if (ierr.ne.NF_NOERR) then 336 stop "Error: Failed reading aire" 364 write(*,*) "Error: Failed reading aire" 365 stop 337 366 endif 338 367 ! Close file … … 342 371 ierr=NF_GET_VAR_REAL(infid,tmpvarid,aire) 343 372 if (ierr.ne.NF_NOERR) then 344 stop "Error: Failed reading aire" 373 write(*,*) "Error: Failed reading aire" 374 stop 345 375 endif 346 376 endif … … 363 393 if (ierr.ne.NF_NOERR) then 364 394 write(*,*) "Problem: Could not find/open these files" 365 stop "Might as well stop here" 395 write(*,*) "Might as well stop here" 396 stop 366 397 endif 367 398 endif … … 371 402 ierr=NF_INQ_VARID(infid2,"phisinit",tmpvarid) 372 403 if (ierr.ne.NF_NOERR) then 373 stop "Error: Failed to get phisinit ID" 404 write(*,*) "Error: Failed to get phisinit ID" 405 stop 374 406 endif 375 407 ! Get phisinit 376 408 ierr=NF_GET_VAR_REAL(infid2,tmpvarid,phisinit) 377 409 if (ierr.ne.NF_NOERR) then 378 stop "Error: Failed reading phisinit" 410 write(*,*) "Error: Failed reading phisinit" 411 stop 379 412 endif 380 413 ! Close file … … 384 417 ierr=NF_GET_VAR_REAL(infid,tmpvarid,phisinit) 385 418 if (ierr.ne.NF_NOERR) then 386 stop "Error: Failed reading phisinit" 419 write(*,*) "Error: Failed reading phisinit" 420 stop 387 421 endif 388 422 endif … … 407 441 if (ierr.ne.NF_NOERR) then 408 442 write(*,*) "Problem: Could not find/open these files" 409 stop "Might as well stop here" 443 write(*,*) "Might as well stop here" 444 stop 410 445 endif 411 446 endif … … 415 450 ierr=NF_INQ_VARID(infid2,"cv",tmpvarid) 416 451 if (ierr.ne.NF_NOERR) then 417 stop "Error: Failed to get cv ID" 452 write(*,*) "Error: Failed to get cv ID" 453 stop 418 454 endif 419 455 ! Get cv 420 456 ierr=NF_GET_VAR_REAL(infid2,tmpvarid,cv) 421 457 if (ierr.ne.NF_NOERR) then 422 stop "Error: Failed reading cv" 458 write(*,*) "Error: Failed reading cv" 459 stop 423 460 endif 424 461 ! Close file … … 428 465 ierr=NF_GET_VAR_REAL(infid,tmpvarid,cv) 429 466 if (ierr.ne.NF_NOERR) then 430 stop "Error: Failed reading cv" 467 write(*,*) "Error: Failed reading cv" 468 stop 431 469 endif 432 470 endif … … 436 474 ierr=NF_INQ_VARID(infid,"temp",tmpvarid) 437 475 if (ierr.ne.NF_NOERR) then 438 stop "Error: Failed to get temp ID" 476 write(*,*) "Error: Failed to get temp ID" 477 stop 439 478 else 440 479 allocate(temp(lonlength,latlength,altlength,timelength)) 441 480 ierr=NF_GET_VAR_REAL(infid,tmpvarid,temp) 442 481 if (ierr.ne.NF_NOERR) then 443 stop "Error: Failed reading temperature" 482 write(*,*) "Error: Failed reading temperature" 483 stop 444 484 endif 445 485 endif … … 464 504 ierr=NF_GET_VAR_REAL(infid,tmpvarid,rho) 465 505 if (ierr.ne.NF_NOERR) then 466 stop "Error: Failed reading mass density" 506 write(*,*) "Error: Failed reading mass density" 507 stop 467 508 endif 468 509 endif … … 666 707 lon_fake(1)=0. 667 708 #ifdef NC_DOUBLE 668 ierr= NF_PUT_VARA_DOUBLE(nout,lonvarout, 1,1,lon_fake)709 ierr= NF_PUT_VARA_DOUBLE(nout,lonvarout,(/1/),(/1/),lon_fake) 669 710 #else 670 ierr= NF_PUT_VARA_REAL(nout,lonvarout, 1,1,lon_fake)711 ierr= NF_PUT_VARA_REAL(nout,lonvarout,(/1/),(/1/),lon_fake) 671 712 #endif 672 713 673 714 ! 3.1.3 New time dimension/value in output file 674 715 #ifdef NC_DOUBLE 675 ierr= NF_PUT_VARA_DOUBLE(nout,timevarout, 1,1,lon_fake)716 ierr= NF_PUT_VARA_DOUBLE(nout,timevarout,(/1/),(/1/),lon_fake) 676 717 #else 677 ierr= NF_PUT_VARA_REAL(nout,timevarout, 1,1,lon_fake)718 ierr= NF_PUT_VARA_REAL(nout,timevarout,(/1/),(/1/),lon_fake) 678 719 #endif 679 720 … … 690 731 if (ierr.ne.NF_NOERR) then 691 732 write(*,*) 'Error, could not define variable psi' 692 stop ""733 stop 693 734 endif 694 735 … … 705 746 if (ierr.ne.NF_NOERR) then 706 747 write(*,*) 'Error, could not define variable momave' 707 stop ""748 stop 708 749 endif 709 750 … … 721 762 if (ierr.ne.NF_NOERR) then 722 763 write(*,*) 'Error, could not define variable u' 723 stop ""764 stop 724 765 endif 725 766 … … 737 778 if (ierr.ne.NF_NOERR) then 738 779 write(*,*) 'Error, could not define variable v' 739 stop ""780 stop 740 781 endif 741 782 … … 752 793 if (ierr.ne.NF_NOERR) then 753 794 write(*,*) 'Error, could not define variable rho' 754 stop ""795 stop 755 796 endif 756 797 … … 767 808 if (ierr.ne.NF_NOERR) then 768 809 write(*,*) 'Error, could not define variable temp' 769 stop ""810 stop 770 811 endif 771 812 … … 782 823 if (ierr.ne.NF_NOERR) then 783 824 write(*,*) 'Error, could not define variable ps' 784 stop ""825 stop 785 826 endif 786 827 … … 798 839 if (ierr.ne.NF_NOERR) then 799 840 write(*,*) 'Error, could not define variable phisinit' 800 stop ""841 stop 801 842 endif 802 843 … … 874 915 if (ierr.NE.NF_NOERR) then 875 916 WRITE(*,*)'ERROR: Impossible to create the file.' 876 stop ""917 stop 877 918 endif 878 919 … … 983 1024 ierr=NF_GET_VAR_REAL(infid,tmpvarid,aps) 984 1025 if (ierr.ne.NF_NOERR) then 985 stop "error: Failed reading aps" 1026 write(*,*) "error: Failed reading aps" 1027 stop 986 1028 endif 987 1029 aps_ok=.true. … … 997 1039 ierr=NF_GET_VAR_REAL(infid,tmpvarid,bps) 998 1040 if (ierr.ne.NF_NOERR) then 999 stop "Error: Failed reading bps" 1041 write(*,*) "Error: Failed reading bps" 1042 stop 1000 1043 endif 1001 1044 bps_ok=.true. … … 1015 1058 (/altdimout/),apsid,ierr) 1016 1059 if (ierr.ne.NF_NOERR) then 1017 stop "Error: Failed to def_var aps" 1060 write(*,*) "Error: Failed to def_var aps" 1061 stop 1018 1062 endif 1019 1063 … … 1025 1069 #endif 1026 1070 if (ierr.ne.NF_NOERR) then 1027 stop "Error: Failed to write aps" 1071 write(*,*) "Error: Failed to write aps" 1072 stop 1028 1073 endif 1029 1074 ENDIF … … 1034 1079 (/altdimout/),bpsid,ierr) 1035 1080 if (ierr.ne.NF_NOERR) then 1036 stop "Error: Failed to def_var bps" 1081 write(*,*) "Error: Failed to def_var bps" 1082 stop 1037 1083 endif 1038 1084 … … 1044 1090 #endif 1045 1091 if (ierr.ne.NF_NOERR) then 1046 stop "Error: Failed to write bps" 1092 write(*,*) "Error: Failed to write bps" 1093 stop 1047 1094 endif 1048 1095 ENDIF -
trunk/LMDZ.MARS/util/xvik/fit_Iceinertia_MONSicedepth.F
r2338 r2567 132 132 133 133 maxiceidiff = 3000 ! maximum allowed difference between N and S best fit ice thermal inertia 134 deltaicei= 20 134 deltaicei= 20 ! step in ice thermal inertia 135 135 maxiceddiff = 30.e-4 ! maximum allowed difference between N and S best fit ice depth 136 136 deltaiced= 0.5e-4 ! step in ice depth coefficient … … 332 332 read(13,*) solgcm(n), patm(n,3), pcapn(n,3),pcaps(n,3) 333 333 read(14,*) solgcm(n), patm(n,4), pcapn(n,4),pcaps(n,4) 334 334 335 335 elseif (time_unit == 2) then 336 336 read(21,*) lsgcm(n), pvl_gcm(n,1) … … 358 358 read(13,*) solgcm(n), lsgcm(n), patm(n,3), pcapn(n,3),pcaps(n,3) 359 359 read(14,*) solgcm(n), lsgcm(n), patm(n,4), pcapn(n,4),pcaps(n,4) 360 361 362 360 361 else 362 write(*,*) 'Wrong integer for xvik files format :', 363 363 &' must be 1, 2 or 3' 364 364 stop 365 365 366 366 endif 367 367 368 368 c Checking total CO2 inventory for all runs : 369 369 do i=1,4 … … 381 381 end do 382 382 383 384 385 386 387 388 389 390 391 392 383 close(11) 384 close(12) 385 close(13) 386 close(14) 387 close(21) 388 close(22) 389 close(23) 390 close(24) 391 392 393 393 c Smoothing simulated GCM Viking 1 pressure curves 394 394 c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 493 493 c to plot COST(DN,DS) (plot_test=1), loops must be in this order : DN->DS->IN->IS 494 494 write(*,*)' DN DS cost IN IS Ps' 495 icedn=icedmin ! initialization 495 icedn=icedmin ! initialization 496 496 do while (icedn.le.icedmax) ! loop on northern ice depth coefficient 497 497 ! albn=albmin ! initialization … … 510 510 cost =0. !initialization 511 511 do n=1,nsol 512 512 !write(*,*) n 513 513 ! Pressure corresponding to Northern cap 514 514 pcapn_new=pcapn_sm(n,refrun)+ … … 527 527 ! and observed pressures at VL1 site 528 528 cost= cost+ ( pvl_obs(n) - pvl1)**2 529 529 530 530 end do ! of do n=1,nsol 531 531 ! store parameters which lead to minimum cost … … 539 539 icedsfit=iceds 540 540 end if 541 541 542 542 if(cost.lt.cost4plot) then 543 543 c RMS, best pressure and best albedos for these icedsivities value … … 575 575 c to plot COST(IN,IS) (plot_test=2), loops must be in this order : IN->IS->DN->DS 576 576 write(*,*)' DN DS cost IN IS Ps' 577 write(33,*)' DN DS cost IN IS 578 &Ps' 579 icein=iceimin ! initialization 577 write(33,*)' DN DS cost IN IS Ps' 578 icein=iceimin ! initialization 580 579 do while (icein.le.iceimax) ! loop on northern ice depth coefficient 581 580 ! albn=albmin ! initialization … … 594 593 cost =0. !initialization 595 594 do n=1,nsol 596 595 !write(*,*) n 597 596 ! Pressure corresponding to Northern cap 598 597 pcapn_new=pcapn_sm(n,refrun)+ … … 611 610 ! and observed pressures at VL1 site 612 611 cost= cost+ ( pvl_obs(n) - pvl1)**2 613 612 614 613 end do ! of do n=1,nsol 615 614 ! store parameters which lead to minimum cost … … 623 622 icedsfit=iceds 624 623 end if 625 624 626 625 if(cost.lt.cost4plot) then 627 626 c RMS, best pressure and best albedos for these icedsivities value … … 683 682 & + (fonc2s(icedsfit) -fonc2s(icedgcm_ref)) * dpdes(n) 684 683 pcaps_new= max(pcaps_new,0.) 685 684 686 685 call sol2ls(sol(n),solconv) 687 686 … … 722 721 723 722 724 if (nbig.lt.3*nmax) stop 'Must increase nbig in runave' 723 if (nbig.lt.3*nmax) then 724 write(*,*) 'Must increase nbig in runave' 725 stop 726 endif 725 727 726 728 c Reindexation des donnees -
trunk/LMDZ.MARS/util/zrecast.F90
r2546 r2567 176 176 write(*,*) 'ERROR: Pb opening file ',trim(infile) 177 177 write(*,*) NF_STRERROR(ierr) 178 stop ""178 stop 179 179 endif 180 180 … … 270 270 write(*,*) 'No variables to process !?' 271 271 write(*,*) 'Might as well stop here' 272 stop ""272 stop 273 273 else 274 274 write(*,*) "" … … 294 294 ierr=NF_INQ_DIMID(infid,"lat",tmpdimid) 295 295 if (ierr.ne.NF_NOERR) then 296 stop "Error: Failed to get lat dimension ID" 296 write(*,*) "Error: Failed to get lat dimension ID" 297 stop 297 298 else 298 299 ierr=NF_INQ_VARID(infid,"lat",tmpvarid) 299 300 if (ierr.ne.NF_NOERR) then 300 stop "Error: Failed to get lat ID" 301 write(*,*) "Error: Failed to get lat ID" 302 stop 301 303 else 302 304 ierr=NF_INQ_DIMLEN(infid,tmpdimid,latlength) 303 305 if (ierr.ne.NF_NOERR) then 304 stop "Error: Failed to get lat length" 306 write(*,*) "Error: Failed to get lat length" 307 stop 305 308 else 306 309 allocate(lat(latlength),stat=ierr) … … 312 315 ierr=NF_GET_VAR_REAL(infid,tmpvarid,lat) 313 316 if (ierr.ne.NF_NOERR) then 314 stop "Error: Failed reading lat" 317 write(*,*) "Error: Failed reading lat" 318 stop 315 319 endif 316 320 endif … … 320 324 ierr=NF_INQ_VARID(infid,"latitude",tmpvarid) 321 325 if (ierr.ne.NF_NOERR) then 322 stop "Error: Failed to get latitude ID" 326 write(*,*) "Error: Failed to get latitude ID" 327 stop 323 328 else 324 329 ierr=NF_INQ_DIMLEN(infid,tmpdimid,latlength) 325 330 if (ierr.ne.NF_NOERR) then 326 stop "Error: Failed to get latitude length" 331 write(*,*) "Error: Failed to get latitude length" 332 stop 327 333 else 328 334 allocate(lat(latlength),stat=ierr) … … 334 340 ierr=NF_GET_VAR_REAL(infid,tmpvarid,lat) 335 341 if (ierr.ne.NF_NOERR) then 336 stop "Error: Failed reading latitude" 342 write(*,*) "Error: Failed reading latitude" 343 stop 337 344 endif 338 345 endif … … 347 354 ierr=NF_INQ_DIMID(infid,"lon",tmpdimid) 348 355 if (ierr.ne.NF_NOERR) then 349 stop "Error: Failed to get lon dimension ID" 356 write(*,*) "Error: Failed to get lon dimension ID" 357 stop 350 358 else 351 359 ierr=NF_INQ_VARID(infid,"lon",tmpvarid) 352 360 if (ierr.ne.NF_NOERR) then 353 stop "Error: Failed to get lon ID" 361 write(*,*) "Error: Failed to get lon ID" 362 stop 354 363 else 355 364 ierr=NF_INQ_DIMLEN(infid,tmpdimid,lonlength) 356 365 if (ierr.ne.NF_NOERR) then 357 stop "Error: Failed to get lon length" 366 write(*,*) "Error: Failed to get lon length" 367 stop 358 368 else 359 369 allocate(lon(lonlength),stat=ierr) … … 365 375 ierr=NF_GET_VAR_REAL(infid,tmpvarid,lon) 366 376 if (ierr.ne.NF_NOERR) then 367 stop "Error: Failed reading longitude" 377 write(*,*) "Error: Failed reading longitude" 378 stop 368 379 endif 369 380 endif … … 373 384 ierr=NF_INQ_VARID(infid,"longitude",tmpvarid) 374 385 if (ierr.ne.NF_NOERR) then 375 stop "Error: Failed to get longitude ID" 386 write(*,*) "Error: Failed to get longitude ID" 387 stop 376 388 else 377 389 ierr=NF_INQ_DIMLEN(infid,tmpdimid,lonlength) 378 390 if (ierr.ne.NF_NOERR) then 379 stop "Error: Failed to get longitude length" 391 write(*,*) "Error: Failed to get longitude length" 392 stop 380 393 else 381 394 allocate(lon(lonlength),stat=ierr) … … 387 400 ierr=NF_GET_VAR_REAL(infid,tmpvarid,lon) 388 401 if (ierr.ne.NF_NOERR) then 389 stop "Error: Failed reading longitude" 402 write(*,*) "Error: Failed reading longitude" 403 stop 390 404 endif 391 405 endif … … 404 418 ierr=NF_INQ_DIMID(infid,"time_counter",tmpdimid) 405 419 if (ierr.ne.NF_NOERR) then 406 stop "Error: Failed to get time_counter dimension ID" 420 write(*,*) "Error: Failed to get time_counter dimension ID" 421 stop 407 422 else 408 423 ierr=NF_INQ_VARID(infid,"time_counter",tmpvarid) 409 424 if (ierr.ne.NF_NOERR) then 410 stop "Error: Failed to get time_counter ID" 425 write(*,*) "Error: Failed to get time_counter ID" 426 stop 411 427 else 412 428 ierr=NF_INQ_DIMLEN(infid,tmpdimid,timelength) 413 429 if (ierr.ne.NF_NOERR) then 414 stop "Error: Failed to get time_counter length" 430 write(*,*) "Error: Failed to get time_counter length" 431 stop 415 432 else 416 433 allocate(time(timelength),stat=ierr) … … 422 439 ierr=NF_GET_VAR_REAL(infid,tmpvarid,time) 423 440 if (ierr.ne.NF_NOERR) then 424 stop "Error: Failed reading time" 441 write(*,*) "Error: Failed reading time" 442 stop 425 443 endif 426 444 endif … … 430 448 ierr=NF_INQ_VARID(infid,"time",tmpvarid) 431 449 if (ierr.ne.NF_NOERR) then 432 stop "Error: Failed to get time ID" 450 write(*,*) "Error: Failed to get time ID" 451 stop 433 452 else 434 453 ierr=NF_INQ_DIMLEN(infid,tmpdimid,timelength) 435 454 if (ierr.ne.NF_NOERR) then 436 stop "Error: Failed to get time length" 455 write(*,*) "Error: Failed to get time length" 456 stop 437 457 else 438 458 allocate(time(timelength),stat=ierr) … … 444 464 ierr=NF_GET_VAR_REAL(infid,tmpvarid,time) 445 465 if (ierr.ne.NF_NOERR) then 446 stop "Error: Failed reading time" 466 write(*,*) "Error: Failed reading time" 467 stop 447 468 endif 448 469 endif … … 452 473 ierr=NF_INQ_VARID(infid,"Time",tmpvarid) 453 474 if (ierr.ne.NF_NOERR) then 454 stop "Error: Failed to get Time ID" 475 write(*,*) "Error: Failed to get Time ID" 476 stop 455 477 else 456 478 ierr=NF_INQ_DIMLEN(infid,tmpdimid,timelength) 457 479 if (ierr.ne.NF_NOERR) then 458 stop "Error: Failed to get Time length" 480 write(*,*) "Error: Failed to get Time length" 481 stop 459 482 else 460 483 allocate(time(timelength),stat=ierr) … … 466 489 ierr=NF_GET_VAR_REAL(infid,tmpvarid,time) 467 490 if (ierr.ne.NF_NOERR) then 468 stop "Error: Failed reading Time" 491 write(*,*) "Error: Failed reading Time" 492 stop 469 493 endif 470 494 endif … … 479 503 ierr=NF_INQ_DIMID(infid,"sigma",tmpdimid) 480 504 if (ierr.ne.NF_NOERR) then 481 stop "Error: Failed to get sigma dimension ID" 505 write(*,*) "Error: Failed to get sigma dimension ID" 506 stop 482 507 else 483 508 ierr=NF_INQ_DIMLEN(infid,tmpdimid,altlength) 484 509 if (ierr.ne.NF_NOERR) then 485 stop "Error: Failed to get altitude length" 510 write(*,*) "Error: Failed to get altitude length" 511 stop 486 512 endif 487 513 endif … … 489 515 ierr=NF_INQ_DIMLEN(infid,tmpdimid,altlength) 490 516 if (ierr.ne.NF_NOERR) then 491 stop "Error: Failed to get altitude length" 517 write(*,*) "Error: Failed to get altitude length" 518 stop 492 519 endif 493 520 endif … … 504 531 ierr=NF_INQ_VARID(infid,"controle",tmpvarid) 505 532 if (ierr.ne.NF_NOERR) then 506 stop "Error: Failed to get controle ID" 533 write(*,*) "Error: Failed to get controle ID" 534 stop 507 535 else 508 536 ierr=NF_INQ_DIMLEN(infid,tmpdimid,ctllength) 509 537 if (ierr.ne.NF_NOERR) then 510 stop "Error: Failed to get controle length" 538 write(*,*) "Error: Failed to get controle length" 539 stop 511 540 else 512 541 allocate(ctl(ctllength),stat=ierr) … … 518 547 ierr=NF_GET_VAR_REAL(infid,tmpvarid,ctl) 519 548 if (ierr.ne.NF_NOERR) then 520 stop "Error: Failed reading controle" 549 write(*,*) "Error: Failed reading controle" 550 stop 521 551 endif 522 552 endif … … 526 556 ierr=NF_INQ_VARID(infid,"controle",tmpvarid) 527 557 if (ierr.ne.NF_NOERR) then 528 stop "Error: Failed to get controle ID" 558 write(*,*) "Error: Failed to get controle ID" 559 stop 529 560 else 530 561 ierr=NF_INQ_DIMLEN(infid,tmpdimid,ctllength) 531 562 if (ierr.ne.NF_NOERR) then 532 stop "Error: Failed to get controle length" 563 write(*,*) "Error: Failed to get controle length" 564 stop 533 565 else 534 566 allocate(ctl(ctllength),stat=ierr) … … 540 572 ierr=NF_GET_VAR_REAL(infid,tmpvarid,ctl) 541 573 if (ierr.ne.NF_NOERR) then 542 stop "Error: Failed reading controle" 574 write(*,*) "Error: Failed reading controle" 575 stop 543 576 endif 544 577 endif … … 563 596 ierr=NF_GET_VAR_REAL(infid,tmpvarid,sigma) 564 597 if (ierr.ne.NF_NOERR) then 565 stop "Error: Failed reading sigma" 598 write(*,*) "Error: Failed reading sigma" 599 stop 566 600 endif 567 601 endif … … 572 606 ierr=NF_INQ_VARID(infid,"aps",tmpvarid) 573 607 if (ierr.ne.NF_NOERR) then 574 stop "Error: Failed to get aps ID" 608 write(*,*) "Error: Failed to get aps ID" 609 stop 575 610 else 576 611 allocate(aps(altlength),stat=ierr) … … 582 617 ierr=NF_GET_VAR_REAL(infid,tmpvarid,aps) 583 618 if (ierr.ne.NF_NOERR) then 584 stop "Error: Failed reading aps" 619 write(*,*) "Error: Failed reading aps" 620 stop 585 621 endif 586 622 endif … … 589 625 ierr=NF_INQ_VARID(infid,"bps",tmpvarid) 590 626 if (ierr.ne.NF_NOERR) then 591 stop "Error: Failed to get bps ID" 627 write(*,*) "Error: Failed to get bps ID" 628 stop 592 629 else 593 630 allocate(bps(altlength),stat=ierr) … … 599 636 ierr=NF_GET_VAR_REAL(infid,tmpvarid,bps) 600 637 if (ierr.ne.NF_NOERR) then 601 stop "Error: Failed reading bps" 638 write(*,*) "Error: Failed reading bps" 639 stop 602 640 endif 603 641 endif … … 631 669 if (ierr.ne.NF_NOERR) then 632 670 write(*,*) "Error: Could not open that file either" 633 stop "Might as well stop here" 671 write(*,*) "Might as well stop here" 672 stop 634 673 endif 635 674 endif … … 639 678 ierr=NF_INQ_VARID(infid2,"phisinit",tmpvarid) 640 679 if (ierr.ne.NF_NOERR) then 641 stop "Error: Failed to get phisinit ID" 680 write(*,*) "Error: Failed to get phisinit ID" 681 stop 642 682 endif 643 683 ! Get physinit 644 684 ierr=NF_GET_VAR_REAL(infid2,tmpvarid,phisinit) 645 685 if (ierr.ne.NF_NOERR) then 646 stop "Error: Failed reading phisinit" 686 write(*,*) "Error: Failed reading phisinit" 687 stop 647 688 endif 648 689 ! Close file … … 652 693 ierr=NF_GET_VAR_REAL(infid,tmpvarid,phisinit) 653 694 if (ierr.ne.NF_NOERR) then 654 stop "Error: Failed reading phisinit" 695 write(*,*) "Error: Failed reading phisinit" 696 stop 655 697 endif 656 698 endif … … 918 960 ierr=NF_INQ_VARID(infid,"ps",tmpvarid) 919 961 if (ierr.ne.NF_NOERR) then 920 stop "Error: Failed to get ps ID" 962 write(*,*) "Error: Failed to get ps ID" 963 stop 921 964 else 922 965 allocate(ps(lonlength,latlength,timelength),stat=ierr) … … 929 972 ierr=NF_GET_VAR_REAL(infid,tmpvarid,ps) 930 973 if (ierr.ne.NF_NOERR) then 931 stop "Error: Failed reading surface pressure" 974 write(*,*) "Error: Failed reading surface pressure" 975 stop 932 976 endif 933 977 endif … … 1022 1066 ierr=NF_GET_VAR_REAL(infid,tmpvarid,temp) 1023 1067 if (ierr.ne.NF_NOERR) then 1024 stop "Error: Failed reading atmospheric temperature" 1068 write(*,*) "Error: Failed reading atmospheric temperature" 1069 stop 1025 1070 endif 1026 1071 have_temp=.true. … … 1046 1091 ierr=NF_GET_VAR_REAL(infid,tmpvarid,rho) 1047 1092 if (ierr.ne.NF_NOERR) then 1048 stop "Error: Failed reading atmospheric density" 1093 write(*,*) "Error: Failed reading atmospheric density" 1094 stop 1049 1095 endif 1050 1096 endif … … 1234 1280 ierr=NF_PUT_ATT_TEXT(outfid,lon_varid,'long_name',len_trim(text),text) 1235 1281 if (ierr.ne.NF_NOERR) then 1236 stop "Error: Problem writing long_name for longitude" 1282 write(*,*) "Error: Problem writing long_name for longitude" 1283 stop 1237 1284 endif 1238 1285 text='degrees_east' 1239 1286 ierr=NF_PUT_ATT_TEXT(outfid,lon_varid,'units',len_trim(text),text) 1240 1287 if (ierr.ne.NF_NOERR) then 1241 stop "Error: Problem writing units for longitude" 1288 write(*,*) "Error: Problem writing units for longitude" 1289 stop 1242 1290 endif 1243 1291 … … 1255 1303 ierr=NF_PUT_ATT_TEXT(outfid,lat_varid,'long_name',len_trim(text),text) 1256 1304 if (ierr.ne.NF_NOERR) then 1257 stop "Error: Problem writing long_name for latitude" 1305 write(*,*) "Error: Problem writing long_name for latitude" 1306 stop 1258 1307 endif 1259 1308 text='degrees_north' 1260 1309 ierr=NF_PUT_ATT_TEXT(outfid,lat_varid,'units',len_trim(text),text) 1261 1310 if (ierr.ne.NF_NOERR) then 1262 stop "Error: Problem writing units for latitude" 1311 write(*,*) "Error: Problem writing units for latitude" 1312 stop 1263 1313 endif 1264 1314 … … 1277 1327 ierr=NF_PUT_ATT_TEXT(outfid,alt_varid,'long_name',len_trim(text),text) 1278 1328 if (ierr.ne.NF_NOERR) then 1279 stop "Error: Problem writing long_name for altitude" 1329 write(*,*) "Error: Problem writing long_name for altitude" 1330 stop 1280 1331 endif 1281 1332 text='Pa' 1282 1333 ierr=NF_PUT_ATT_TEXT(outfid,alt_varid,'units',len_trim(text),text) 1283 1334 if (ierr.ne.NF_NOERR) then 1284 stop "Error: Problem writing units for altitude" 1335 write(*,*) "Error: Problem writing units for altitude" 1336 stop 1285 1337 endif 1286 1338 text='down' 1287 1339 ierr=NF_PUT_ATT_TEXT(outfid,alt_varid,'positive',len_trim(text),text) 1288 1340 if (ierr.ne.NF_NOERR) then 1289 stop "Error: Problem writing positive for altitude" 1341 write(*,*) "Error: Problem writing positive for altitude" 1342 stop 1290 1343 endif 1291 1344 else if (ztype.eq.2) then ! above areoid vertical coordinate … … 1293 1346 ierr=NF_PUT_ATT_TEXT(outfid,alt_varid,'long_name',len_trim(text),text) 1294 1347 if (ierr.ne.NF_NOERR) then 1295 stop "Error: Problem writing long_name for altitude" 1348 write(*,*) "Error: Problem writing long_name for altitude" 1349 stop 1296 1350 endif 1297 1351 text='m' 1298 1352 ierr=NF_PUT_ATT_TEXT(outfid,alt_varid,'units',len_trim(text),text) 1299 1353 if (ierr.ne.NF_NOERR) then 1300 stop "Error: Problem writing units for altitude" 1354 write(*,*) "Error: Problem writing units for altitude" 1355 stop 1301 1356 endif 1302 1357 text='up' 1303 1358 ierr=NF_PUT_ATT_TEXT(outfid,alt_varid,'positive',len_trim(text),text) 1304 1359 if (ierr.ne.NF_NOERR) then 1305 stop "Error: Problem writing positive for altitude" 1360 write(*,*) "Error: Problem writing positive for altitude" 1361 stop 1306 1362 endif 1307 1363 else if (ztype.eq.3) then ! above surface vertical coordinate … … 1309 1365 ierr=NF_PUT_ATT_TEXT(outfid,alt_varid,'long_name',len_trim(text),text) 1310 1366 if (ierr.ne.NF_NOERR) then 1311 stop "Error: Problem writing long_name for altitude" 1367 write(*,*) "Error: Problem writing long_name for altitude" 1368 stop 1312 1369 endif 1313 1370 text='m' 1314 1371 ierr=NF_PUT_ATT_TEXT(outfid,alt_varid,'units',len_trim(text),text) 1315 1372 if (ierr.ne.NF_NOERR) then 1316 stop "Error: Problem writing units for altitude" 1373 write(*,*) "Error: Problem writing units for altitude" 1374 stop 1317 1375 endif 1318 1376 text='up' 1319 1377 ierr=NF_PUT_ATT_TEXT(outfid,alt_varid,'positive',len_trim(text),text) 1320 1378 if (ierr.ne.NF_NOERR) then 1321 stop "Error: Problem writing positive for altitude" 1379 write(*,*) "Error: Problem writing positive for altitude" 1380 stop 1322 1381 endif 1323 1382 else ! radial distance to center of planet … … 1325 1384 ierr=NF_PUT_ATT_TEXT(outfid,alt_varid,'long_name',len_trim(text),text) 1326 1385 if (ierr.ne.NF_NOERR) then 1327 stop "Error: Problem writing long_name for altitude" 1386 write(*,*) "Error: Problem writing long_name for altitude" 1387 stop 1328 1388 endif 1329 1389 text='m' 1330 1390 ierr=NF_PUT_ATT_TEXT(outfid,alt_varid,'units',len_trim(text),text) 1331 1391 if (ierr.ne.NF_NOERR) then 1332 stop "Error: Problem writing units for altitude" 1392 write(*,*) "Error: Problem writing units for altitude" 1393 stop 1333 1394 endif 1334 1395 text='up' 1335 1396 ierr=NF_PUT_ATT_TEXT(outfid,alt_varid,'positive',len_trim(text),text) 1336 1397 if (ierr.ne.NF_NOERR) then 1337 stop "Error: Problem writing positive for altitude" 1398 write(*,*) "Error: Problem writing positive for altitude" 1399 stop 1338 1400 endif 1339 1401 endif ! of if (have_sigma) … … 1352 1414 ierr=NF_PUT_ATT_TEXT(outfid,ctl_varid,'title',len_trim(text),text) 1353 1415 if (ierr.ne.NF_NOERR) then 1354 stop "Error: Problem writing title for controle" 1416 write(*,*) "Error: Problem writing title for controle" 1417 stop 1355 1418 endif 1356 1419 endif … … 1387 1450 ierr=NF_PUT_ATT_TEXT(outfid,sigma_varid,'long_name',len_trim(text),text) 1388 1451 if (ierr.ne.NF_NOERR) then 1389 stop "Error: Problem writing long_name for sigma" 1452 write(*,*) "Error: Problem writing long_name for sigma" 1453 stop 1390 1454 endif 1391 1455 else ! hybrid coordinates … … 1393 1457 ierr=NF_PUT_ATT_TEXT(outfid,aps_varid,'long_name',len_trim(text),text) 1394 1458 if (ierr.ne.NF_NOERR) then 1395 stop "Error: Problem writing long_name for aps" 1459 write(*,*) "Error: Problem writing long_name for aps" 1460 stop 1396 1461 endif 1397 1462 text="hybrid sigma at midlayers" 1398 1463 ierr=NF_PUT_ATT_TEXT(outfid,bps_varid,'long_name',len_trim(text),text) 1399 1464 if (ierr.ne.NF_NOERR) then 1400 stop "Error: Problem writing long_name for bps" 1465 write(*,*) "Error: Problem writing long_name for bps" 1466 stop 1401 1467 endif 1402 1468 endif ! of if (have_sigma) … … 1415 1481 ierr=NF_PUT_ATT_TEXT(outfid,time_varid,'long_name',len_trim(text),text) 1416 1482 if (ierr.ne.NF_NOERR) then 1417 stop "Error: Problem writing long_name for Time" 1483 write(*,*) "Error: Problem writing long_name for Time" 1484 stop 1418 1485 endif 1419 1486 text='days since 0000-01-1 00:00:00' 1420 1487 ierr=NF_PUT_ATT_TEXT(outfid,time_varid,'units',len_trim(text),text) 1421 1488 if (ierr.ne.NF_NOERR) then 1422 stop "Error: Problem writing units for Time" 1489 write(*,*) "Error: Problem writing units for Time" 1490 stop 1423 1491 endif 1424 1492 … … 1430 1498 ierr=NF_PUT_ATT_TEXT(outfid,phis_varid,'long_name',len_trim(text),text) 1431 1499 if (ierr.ne.NF_NOERR) then 1432 stop "Error: Problem writing long_name for phisinit" 1500 write(*,*) "Error: Problem writing long_name for phisinit" 1501 stop 1433 1502 endif 1434 1503 text='m2.s2' 1435 1504 ierr=NF_PUT_ATT_TEXT(outfid,phis_varid,'units',len_trim(text),text) 1436 1505 if (ierr.ne.NF_NOERR) then 1437 stop "Error: Problem writing units for geopotential phisinit" 1506 write(*,*) "Error: Problem writing units for geopotential phisinit" 1507 stop 1438 1508 endif 1439 1509 … … 1457 1527 ierr=NF_PUT_ATT_TEXT(outfid,ps_varid,'long_name',len_trim(text),text) 1458 1528 if (ierr.ne.NF_NOERR) then 1459 stop "Error: Problem writing long_name for surface pressure" 1529 write(*,*) "Error: Problem writing long_name for surface pressure" 1530 stop 1460 1531 endif 1461 1532 text='Pa' 1462 1533 ierr=NF_PUT_ATT_TEXT(outfid,ps_varid,'units',len_trim(text),text) 1463 1534 if (ierr.ne.NF_NOERR) then 1464 stop "Error: Problem writing units for surface pressure" 1535 write(*,*) "Error: Problem writing units for surface pressure" 1536 stop 1465 1537 endif 1466 1538 … … 1480 1552 ierr=NF_PUT_ATT_TEXT(outfid,za_varid,'long_name',len_trim(text),text) 1481 1553 if (ierr.ne.NF_NOERR) then 1482 stop "Error: Problem writing long_name for zareoid" 1554 write(*,*) "Error: Problem writing long_name for zareoid" 1555 stop 1483 1556 endif 1484 1557 text='m' 1485 1558 ierr=NF_PUT_ATT_TEXT(outfid,za_varid,'units',len_trim(text),text) 1486 1559 if (ierr.ne.NF_NOERR) then 1487 stop "Error: Problem writing units for zareoid" 1560 write(*,*) "Error: Problem writing units for zareoid" 1561 stop 1488 1562 endif 1489 1563 ! zareoid missing value 1490 1564 ierr=NF_PUT_ATT_REAL(outfid,za_varid,'missing_value',NF_REAL,1,miss_val) 1491 1565 if (ierr.ne.NF_NOERR) then 1492 stop "Error: Problem writing missing_value for zareoid" 1566 write(*,*) "Error: Problem writing missing_value for zareoid" 1567 stop 1493 1568 endif 1494 1569 else ! above areoid or above local surface vertical coordinate … … 1504 1579 ierr=NF_PUT_ATT_TEXT(outfid,p_varid,'long_name',len_trim(text),text) 1505 1580 if (ierr.ne.NF_NOERR) then 1506 stop "Error: Problem writing long_name for pressure" 1581 write(*,*) "Error: Problem writing long_name for pressure" 1582 stop 1507 1583 endif 1508 1584 text='Pa' 1509 1585 ierr=NF_PUT_ATT_TEXT(outfid,p_varid,'units',len_trim(text),text) 1510 1586 if (ierr.ne.NF_NOERR) then 1511 stop "Error: Problem writing units for pressure" 1587 write(*,*) "Error: Problem writing units for pressure" 1588 stop 1512 1589 endif 1513 1590 ! pressure missing value 1514 1591 ierr=NF_PUT_ATT_REAL(outfid,p_varid,'missing_value',NF_REAL,1,miss_val) 1515 1592 if (ierr.ne.NF_NOERR) then 1516 stop "Error: Problem writing missing_value for pressure" 1593 write(*,*) "Error: Problem writing missing_value for pressure" 1594 stop 1517 1595 endif 1518 1596 endif … … 1588 1666 if (ierr.ne.NF_NOERR) then 1589 1667 write(*,*) "Error failed to copy title attribute:",trim(text) 1590 stop ""1668 stop 1591 1669 endif 1592 1670 else ! no 'title' attribute … … 1611 1689 if (ierr.ne.NF_NOERR) then 1612 1690 write(*,*) "Error failed to copy long_name attribute:",trim(text) 1613 stop ""1691 stop 1614 1692 endif 1615 1693 endif … … 1625 1703 if (ierr.ne.NF_NOERR) then 1626 1704 write(*,*) "Error failed to copy units attribute:",trim(text) 1627 stop ""1705 stop 1628 1706 endif 1629 1707 endif … … 1641 1719 ierr=NF_PUT_ATT_REAL(outfid,var_id(i),'missing_value',NF_REAL,1,miss_val) 1642 1720 if (ierr.ne.NF_NOERR) then 1643 stop "Error, failed to write missing_value attribute" 1721 write(*,*) "Error, failed to write missing_value attribute" 1722 stop 1644 1723 endif 1645 1724 … … 1746 1825 1747 1826 ! Write time 1748 ierr=NF_PUT_VARA_REAL(outfid,time_varid, 1,timelength,time)1827 ierr=NF_PUT_VARA_REAL(outfid,time_varid,(/1/),(/timelength/),time) 1749 1828 if (ierr.ne.NF_NOERR) then 1750 1829 write(*,*) "Error: Could not write Time data to output file"
Note: See TracChangeset
for help on using the changeset viewer.