Changeset 2567 for trunk/LMDZ.MARS/util/streamfunction.F90
- Timestamp:
- Oct 5, 2021, 8:34:09 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.