Changeset 2204
- Timestamp:
- Jan 6, 2020, 11:17:44 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/util/localtime.F90
r2147 r2204 115 115 116 116 !============================================================================== 117 ! 1.3. Open the firstinput file117 ! 1.3. Open the input file 118 118 !============================================================================== 119 119 120 120 ierr = NF_OPEN(file,NF_NOWRITE,nid) 121 121 if (ierr.NE.NF_NOERR) then 122 write(*,*) 'ERROR: Pb opening file '//file 122 write(*,*) 'ERROR: Pb opening file '//trim(file) 123 write(*,*) NF_STRERROR(ierr) 123 124 stop "" 124 125 endif … … 126 127 ierr=NF_INQ_NVARS(nid,nbvarfile) 127 128 ! nbvarfile now set to be the (total) number of variables in file 128 129 !============================================================================== 130 ! 1.4. Ask for (output) "Time" axis type 129 if (ierr.NE.NF_NOERR) then 130 write(*,*) 'ERROR: Pb with NF_INQ_NVARS' 131 write(*,*) NF_STRERROR(ierr) 132 stop "" 133 endif 134 135 !============================================================================== 136 ! 1.4. List of variables that should not be processed 131 137 !============================================================================== 132 138 … … 148 154 149 155 !============================================================================== 150 ! 1.5. Get (and check) list of variables to concatenate156 ! 1.5. Get (and check) list of variables to process 151 157 !============================================================================== 152 158 write(*,*) … … 165 171 enddo 166 172 167 ! Nnotconcat: # of variables that won't be concatenated173 ! Nnotconcat: # of variables that won't be processed 168 174 ! nbvarfile: total # of variables in file 169 allocate(var(nbvarfile-Nnotconcat)) 175 allocate(var(nbvarfile-Nnotconcat),stat=ierr) 176 if (ierr.ne.0) then 177 write(*,*) "Error: failed allocation of var(nbvarfile-Nnotconcat)" 178 write(*,*) " nbvarfile=",nbvarfile 179 write(*,*) " Nnotconcat=",Nnotconcat 180 stop 181 endif 170 182 171 183 … … 187 199 ierr=nf_inq_varname(nid,j,var(j-Nnotconcat)) 188 200 enddo 189 ! Variables names from the file are catched201 ! Variables names from the file are stored in var() 190 202 nbvar=nbvarfile-Nnotconcat 191 203 do i=1,nbvar … … 202 214 !============================================================================== 203 215 filename=file(1:len_trim(file)-3)//"_LT.nc" 204 write(*,*) filename216 write(*,*) trim(filename) 205 217 206 218 !============================================================================== … … 208 220 !============================================================================== 209 221 210 if (i/=1) then211 222 write(*,*) 212 223 write(*,*) "opening "//trim(file)//"..." 213 224 ierr = NF_OPEN(file,NF_NOWRITE,nid) 214 225 if (ierr.NE.NF_NOERR) then 215 write(*,*) 'ERROR: Pb opening file '// file226 write(*,*) 'ERROR: Pb opening file '//trim(file) 216 227 write(*,*) NF_STRERROR(ierr) 217 228 stop "" 218 229 endif 219 endif220 230 221 231 !============================================================================== … … 224 234 225 235 ierr=NF_INQ_DIMID(nid,"latitude",latdim) 236 if (ierr.NE.NF_NOERR) then 237 write(*,*) 'ERROR: Dimension <latitude> is missing in file '//trim(file) 238 stop "" 239 endif 226 240 ierr=NF_INQ_VARID(nid,"latitude",latvar) 227 241 if (ierr.NE.NF_NOERR) then 228 write(*,*) 'ERROR: Field <latitude> is missing in file '//file242 write(*,*) 'ERROR: Field <latitude> is missing in file '//trim(file) 229 243 stop "" 230 244 endif … … 233 247 234 248 ierr=NF_INQ_DIMID(nid,"longitude",londim) 249 if (ierr.NE.NF_NOERR) then 250 write(*,*) 'ERROR: Dimension <longitude> is missing in file '//trim(file) 251 stop "" 252 endif 235 253 ierr=NF_INQ_VARID(nid,"longitude",lonvar) 236 254 if (ierr.NE.NF_NOERR) then 237 write(*,*) 'ERROR: Field <longitude> is missing in file'// file255 write(*,*) 'ERROR: Field <longitude> is missing in file'//trim(file) 238 256 stop "" 239 257 endif … … 242 260 243 261 ierr=NF_INQ_DIMID(nid,"altitude",altdim) 262 if (ierr.NE.NF_NOERR) then 263 write(*,*) 'ERROR: Dimension <altitude> is missing in file '//trim(file) 264 stop "" 265 endif 244 266 ierr=NF_INQ_VARID(nid,"altitude",altvar) 245 267 if (ierr.NE.NF_NOERR) then 246 write(*,*) 'ERROR: Field <altitude> is missing in file'// file268 write(*,*) 'ERROR: Field <altitude> is missing in file'//trim(file) 247 269 stop "" 248 270 endif … … 251 273 252 274 ierr=NF_INQ_DIMID(nid,"index",ctldim) 275 if (ierr.NE.NF_NOERR) then 276 write(*,*) 'ERROR: Dimension <index> is missing in file '//trim(file) 277 stop "" 278 endif 253 279 ierr=NF_INQ_VARID(nid,"controle",ctlvar) 254 280 if (ierr.NE.NF_NOERR) then 255 write(*,*) 'Field <controle> is missing in file'// file281 write(*,*) 'Field <controle> is missing in file'//trim(file) 256 282 ctllen=0 257 283 !stop "" … … 267 293 268 294 ! First call; initialize/allocate 269 allocate(lat(latlen)) 270 allocate(lon(lonlen)) 271 allocate(alt(altlen)) 272 allocate(ctl(ctllen)) 295 allocate(lat(latlen),stat=ierr) 296 if (ierr.ne.0) then 297 write(*,*) "Error: failed to allocate lat(latlen)" 298 stop 299 endif 300 allocate(lon(lonlen),stat=ierr) 301 if (ierr.ne.0) then 302 write(*,*) "Error: failed to allocate lon(lonlen)" 303 stop 304 endif 305 allocate(alt(altlen),stat=ierr) 306 if (ierr.ne.0) then 307 write(*,*) "Error: failed to allocate alt(altlen)" 308 stop 309 endif 310 allocate(ctl(ctllen),stat=ierr) 311 if (ierr.ne.0) then 312 write(*,*) "Error: failed to allocate ctl(ctllen)" 313 stop 314 endif 315 273 316 #ifdef NC_DOUBLE 274 317 ierr = NF_GET_VAR_DOUBLE(nid,latvar,lat) 318 #else 319 ierr = NF_GET_VAR_REAL(nid,latvar,lat) 320 #endif 321 if (ierr.ne.0) then 322 write(*,*) "Error: failed to load latitude" 323 write(*,*) NF_STRERROR(ierr) 324 stop 325 endif 326 327 #ifdef NC_DOUBLE 275 328 ierr = NF_GET_VAR_DOUBLE(nid,lonvar,lon) 329 #else 330 ierr = NF_GET_VAR_REAL(nid,lonvar,lon) 331 #endif 332 if (ierr.ne.0) then 333 write(*,*) "Error: failed to load longitude" 334 write(*,*) NF_STRERROR(ierr) 335 stop 336 endif 337 338 #ifdef NC_DOUBLE 276 339 ierr = NF_GET_VAR_DOUBLE(nid,altvar,alt) 277 if (ctllen .ne. -1) ierr = NF_GET_VAR_DOUBLE(nid,ctlvar,ctl) 278 #else 279 ierr = NF_GET_VAR_REAL(nid,latvar,lat) 280 ierr = NF_GET_VAR_REAL(nid,lonvar,lon) 340 #else 281 341 ierr = NF_GET_VAR_REAL(nid,altvar,alt) 282 if (ctllen .ne. -1) ierr = NF_GET_VAR_REAL(nid,ctlvar,ctl) 283 #endif 342 #endif 343 if (ierr.ne.0) then 344 write(*,*) "Error: failed to load altitude" 345 write(*,*) NF_STRERROR(ierr) 346 stop 347 endif 348 349 if (ctllen .ne. 0) then 350 #ifdef NC_DOUBLE 351 ierr = NF_GET_VAR_DOUBLE(nid,ctlvar,ctl) 352 #else 353 ierr = NF_GET_VAR_REAL(nid,ctlvar,ctl) 354 #endif 355 if (ierr.ne.0) then 356 write(*,*) "Error: failed to load controle" 357 write(*,*) NF_STRERROR(ierr) 358 stop 359 endif 360 endif ! of if (ctllen .ne. 0) 361 284 362 !============================================================================== 285 363 ! 2.4. Handle "Time" dimension from input file … … 291 369 ierr=NF_INQ_DIMID(nid,"Time",timedim) 292 370 if (ierr.NE.NF_NOERR) then 293 write(*,*) 'ERROR: Dimension <Time> is missing in file'// file371 write(*,*) 'ERROR: Dimension <Time> is missing in file'//trim(file) 294 372 stop "" 295 373 endif 296 374 ierr=NF_INQ_VARID(nid,"Time",timevar) 297 375 if (ierr.NE.NF_NOERR) then 298 write(*,*) 'ERROR: Field <Time> is missing in file'// file376 write(*,*) 'ERROR: Field <Time> is missing in file'//trim(file) 299 377 stop "" 300 378 endif … … 313 391 314 392 ! allocate time() array and fill it with values from input file 315 allocate(time(timelen)) 393 allocate(time(timelen),stat=ierr) 394 if (ierr.ne.0) then 395 write(*,*) "Error: failed to allocate time(timelen)" 396 stop 397 endif 316 398 317 399 #ifdef NC_DOUBLE … … 322 404 if (ierr.NE.NF_NOERR) then 323 405 write(*,*) "Error , failed to load Time" 406 write(*,*) NF_STRERROR(ierr) 324 407 stop 325 408 endif … … 331 414 write(*,*) 'number of local time to be used ?' 332 415 read(*,*) nhour 333 allocate(lt_hour(nhour)) 416 allocate(lt_hour(nhour),stat=ierr) 417 if (ierr.ne.0) then 418 write(*,*) "Error: failed to allocate lt_hour(nhour)" 419 stop 420 endif 334 421 write(*,*) 'list of selected local time (0<t<24)' 335 422 do it=1,nhour … … 341 428 stats=.true. 342 429 timelen_lt=nhour 343 allocate(lt_out(timelen_lt)) 430 allocate(lt_out(timelen_lt),stat=ierr) 431 if (ierr.ne.0) then 432 write(*,*) "Error: failed to allocate lt_hour(nhour)" 433 stop 434 endif 344 435 do it=1,nhour 345 436 lt_out(it)=lt_hour(it)/24. … … 355 446 nsol = int(time(timelen)) - int(time(1)) 356 447 timelen_lt=nhour*nsol 357 allocate(lt_out(timelen_lt)) 448 allocate(lt_out(timelen_lt),stat=ierr) 449 if (ierr.ne.0) then 450 write(*,*) "Error: failed to allocate lt_hour(nhour)" 451 stop 452 endif 358 453 i=0 359 454 do k=1,nsol … … 371 466 timelen_tot=timelen+1 372 467 endif 373 allocate(lt_gcm(timelen_tot)) 374 allocate(var_gcm(timelen_tot)) 375 376 allocate(lt_outc(timelen_lt)) 377 468 allocate(lt_gcm(timelen_tot),stat=ierr) 469 if (ierr.ne.0) then 470 write(*,*) "Error: failed to allocate lt_gcm(timelen_tot)" 471 stop 472 endif 473 allocate(var_gcm(timelen_tot),stat=ierr) 474 if (ierr.ne.0) then 475 write(*,*) "Error: failed to allocate var_gcm(timelen_tot)" 476 stop 477 endif 478 allocate(lt_outc(timelen_lt),stat=ierr) 479 if (ierr.ne.0) then 480 write(*,*) "Error: failed to allocate lt_outc(timelen_lt)" 481 stop 482 endif 378 483 379 484 !============================================================================== … … 383 488 384 489 ! Initialize output file's lat,lon,alt and time dimensions 385 call initiate (filename,lat,lon,alt,ctl,nout,& 386 latdimout,londimout,altdimout,timedimout,timevarout) 490 call initiate(filename,lat,lon,alt,ctl,latlen,lonlen,altlen,ctllen,& 491 nout,latdimout,londimout,altdimout,timedimout,timevarout) 492 387 493 ! Initialize output file's aps,bps and phisinit variables 388 call init2(nid,lonlen,latlen,altlen, &494 call init2(nid,lonlen,latlen,altlen,altdim,& 389 495 nout,londimout,latdimout,altdimout) 390 496 … … 454 560 corner(4)=1 455 561 456 562 ! length (along dimensions) of block of data to be written 457 563 edges(1)=lonlen 458 564 edges(2)=latlen … … 474 580 corner(4)=1 475 581 476 582 ! length (along dimensions) of block of data to be written 477 583 edges(1)=lonlen 478 584 edges(2)=latlen … … 481 587 endif 482 588 483 units=" 484 title=" 589 units=" " 590 title=" " 485 591 ierr=nf_get_att_text(nid,varid,"title",title) 486 592 ierr=nf_get_att_text(nid,varid,"units",units) … … 597 703 598 704 !****************************************************************************** 599 Subroutine initiate (filename,lat,lon,alt,ctl,&705 Subroutine initiate(filename,lat,lon,alt,ctl,latlen,lonlen,altlen,ctllen,& 600 706 nout,latdimout,londimout,altdimout,timedimout,timevarout) 601 707 !============================================================================== … … 616 722 character (len=*), intent(in):: filename 617 723 ! filename(): the file's name 618 real, dimension(:), intent(in):: lat724 real, intent(in):: lat(latlen) 619 725 ! lat(): latitude 620 real, dimension(:), intent(in):: lon726 real, intent(in):: lon(lonlen) 621 727 ! lon(): longitude 622 real, dimension(:), intent(in):: alt728 real, intent(in):: alt(altlen) 623 729 ! alt(): altitude 624 real, dimension(:), intent(in):: ctl730 real, intent(in):: ctl(ctllen) 625 731 ! ctl(): controle 732 integer,intent(in) ::latlen,lonlen,altlen,ctllen 626 733 integer, intent(out):: nout 627 734 ! nout: [netcdf] file ID … … 653 760 ! NB: setting NF_CLOBBER mode means that it's OK to overwrite an existing file 654 761 if (ierr.NE.NF_NOERR) then 655 WRITE(*,*)'ERROR: Impossible to create the file.' 762 WRITE(*,*)'ERROR: Impossible to create the file ',trim(filename) 763 write(*,*) NF_STRERROR(ierr) 656 764 stop "" 657 765 endif … … 661 769 !============================================================================== 662 770 663 ierr = NF_DEF_DIM(nout, "latitude", size(lat), latdimout) 664 ierr = NF_DEF_DIM(nout, "longitude", size(lon), londimout) 665 ierr = NF_DEF_DIM(nout, "altitude", size(alt), altdimout) 666 if (size(ctl).ne.0) ierr = NF_DEF_DIM(nout, "index", size(ctl), ctldimout) 771 ierr = NF_DEF_DIM(nout, "latitude", latlen, latdimout) 772 if (ierr.NE.NF_NOERR) then 773 WRITE(*,*)'initiate: error failed to define dimension <latitude>' 774 write(*,*) NF_STRERROR(ierr) 775 stop "" 776 endif 777 ierr = NF_DEF_DIM(nout, "longitude", lonlen, londimout) 778 if (ierr.NE.NF_NOERR) then 779 WRITE(*,*)'initiate: error failed to define dimension <longitude>' 780 write(*,*) NF_STRERROR(ierr) 781 stop "" 782 endif 783 ierr = NF_DEF_DIM(nout, "altitude", altlen, altdimout) 784 if (ierr.NE.NF_NOERR) then 785 WRITE(*,*)'initiate: error failed to define dimension <altitude>' 786 write(*,*) NF_STRERROR(ierr) 787 stop "" 788 endif 789 if (size(ctl).ne.0) then 790 ierr = NF_DEF_DIM(nout, "index", ctllen, ctldimout) 791 if (ierr.NE.NF_NOERR) then 792 WRITE(*,*)'initiate: error failed to define dimension <index>' 793 write(*,*) NF_STRERROR(ierr) 794 stop "" 795 endif 796 endif 667 797 ierr = NF_DEF_DIM(nout, "Time", NF_UNLIMITED, timedimout) 798 if (ierr.NE.NF_NOERR) then 799 WRITE(*,*)'initiate: error failed to define dimension <Time>' 800 write(*,*) NF_STRERROR(ierr) 801 stop "" 802 endif 668 803 669 804 ! End netcdf define mode 670 805 ierr = NF_ENDDEF(nout) 806 if (ierr.NE.NF_NOERR) then 807 WRITE(*,*)'initiate: error failed to switch out of define mode' 808 write(*,*) NF_STRERROR(ierr) 809 stop "" 810 endif 671 811 672 812 !============================================================================== … … 689 829 ierr = NF_PUT_VAR_REAL (nout,nvarid,lat) 690 830 #endif 831 if (ierr.NE.NF_NOERR) then 832 WRITE(*,*)'initiate: error failed writing variable <latitude>' 833 write(*,*) NF_STRERROR(ierr) 834 stop "" 835 endif 691 836 692 837 !============================================================================== … … 702 847 ierr = NF_PUT_VAR_REAL (nout,nvarid,lon) 703 848 #endif 849 if (ierr.NE.NF_NOERR) then 850 WRITE(*,*)'initiate: error failed writing variable <longitude>' 851 write(*,*) NF_STRERROR(ierr) 852 stop "" 853 endif 704 854 705 855 !============================================================================== … … 728 878 ierr = NF_PUT_VAR_REAL (nout,nvarid,alt) 729 879 #endif 880 if (ierr.NE.NF_NOERR) then 881 WRITE(*,*)'initiate: error failed writing variable <altitude>' 882 write(*,*) NF_STRERROR(ierr) 883 stop "" 884 endif 730 885 731 886 !============================================================================== … … 753 908 ierr = NF_PUT_VAR_REAL (nout,nvarid,ctl) 754 909 #endif 910 if (ierr.NE.NF_NOERR) then 911 WRITE(*,*)'initiate: error failed writing variable <controle>' 912 write(*,*) NF_STRERROR(ierr) 913 stop "" 914 endif 755 915 endif 756 916 757 917 end Subroutine initiate 758 918 !****************************************************************************** 759 subroutine init2(infid,lonlen,latlen,altlen, &919 subroutine init2(infid,lonlen,latlen,altlen,altdimid, & 760 920 outfid,londimout,latdimout,altdimout) 761 921 !============================================================================== … … 777 937 integer, intent(in) :: lonlen ! # of grid points along longitude 778 938 integer, intent(in) :: latlen ! # of grid points along latitude 779 integer, intent(in) :: altlen ! # of grid points along latitude 939 integer, intent(in) :: altlen ! # of grid points along altitude 940 integer, intent(in) :: altdimid ! ID of altitude dimension 780 941 integer, intent(in) :: outfid ! NetCDF output file ID 781 942 integer, intent(in) :: londimout ! longitude dimension ID … … 789 950 integer :: apsid,bpsid,phisinitid 790 951 integer :: ierr 952 integer :: tmpdimid ! temporary dimension ID 791 953 integer :: tmpvarid ! temporary variable ID 792 954 logical :: phis, aps_ok, bps_ok ! are "phisinit" "aps" "bps" available ? … … 798 960 799 961 ! hybrid coordinate aps 800 allocate(aps(altlen)) 962 allocate(aps(altlen),stat=ierr) 963 if (ierr.ne.0) then 964 write(*,*) "init2: failed to allocate aps(altlen)" 965 stop 966 endif 967 801 968 ierr=NF_INQ_VARID(infid,"aps",tmpvarid) 802 969 if (ierr.ne.NF_NOERR) then … … 804 971 aps_ok=.false. 805 972 else 806 ierr=NF_GET_VAR_REAL(infid,tmpvarid,aps) 807 if (ierr.ne.NF_NOERR) then 808 stop "error: Failed reading aps" 973 ! Check that aps() is the right size (it most likely won't be if 974 ! zrecast has be used to generate the input file) 975 ierr=NF_INQ_VARDIMID(infid,tmpvarid,tmpdimid) 976 if (tmpdimid.ne.altdimid) then 977 write(*,*) "init2: wrong dimension size for aps(), skipping it ..." 978 aps_ok=.false. 979 else 980 ierr=NF_GET_VAR_REAL(infid,tmpvarid,aps) 981 if (ierr.ne.NF_NOERR) then 982 stop "init2 error: Failed reading aps" 983 endif 984 aps_ok=.true. 809 985 endif 810 aps_ok=.true.811 986 endif 812 987 813 988 ! hybrid coordinate bps 814 allocate(bps(altlen)) 989 allocate(bps(altlen),stat=ierr) 990 if (ierr.ne.0) then 991 write(*,*) "init2: failed to allocate bps(altlen)" 992 stop 993 endif 994 815 995 ierr=NF_INQ_VARID(infid,"bps",tmpvarid) 816 996 if (ierr.ne.NF_NOERR) then … … 818 998 bps_ok=.false. 819 999 else 820 ierr=NF_GET_VAR_REAL(infid,tmpvarid,bps) 821 if (ierr.ne.NF_NOERR) then 822 stop "Error: Failed reading bps" 1000 ! Check that bps() is the right size 1001 ierr=NF_INQ_VARDIMID(infid,tmpvarid,tmpdimid) 1002 if (tmpdimid.ne.altdimid) then 1003 write(*,*) "init2: wrong dimension size for bps(), skipping it ..." 1004 bps_ok=.false. 1005 else 1006 ierr=NF_GET_VAR_REAL(infid,tmpvarid,bps) 1007 if (ierr.ne.NF_NOERR) then 1008 stop "init2 Error: Failed reading bps" 1009 endif 1010 bps_ok=.true. 823 1011 endif 824 bps_ok=.true.825 1012 endif 826 1013 827 1014 ! ground geopotential phisinit 1015 allocate(phisinit(lonlen,latlen),stat=ierr) 1016 if (ierr.ne.0) then 1017 write(*,*) "init2: failed to allocate phisinit(lonlen,latlen)" 1018 stop 1019 endif 828 1020 ierr=NF_INQ_VARID(infid,"phisinit",tmpvarid) 829 allocate(phisinit(lonlen,latlen))830 1021 if (ierr.ne.NF_NOERR) then 831 1022 write(*,*) "Failed to get phisinit ID. OK" … … 835 1026 ierr=NF_GET_VAR_REAL(infid,tmpvarid,phisinit) 836 1027 if (ierr.ne.NF_NOERR) then 837 stop " Error: Failed reading phisinit"1028 stop "init2 Error: Failed reading phisinit" 838 1029 endif 839 1030 phis = .true. … … 850 1041 851 1042 IF (aps_ok) then 852 ! define aps853 call def_var(nout,"aps","hybrid pressure at midlayers"," ",1,&854 (/altdimout/),apsid,ierr)855 if (ierr.ne.NF_NOERR) then856 stop "Error: Failed to def_var aps"857 endif858 859 ! write aps860 #ifdef NC_DOUBLE 861 ierr=NF_PUT_VAR_DOUBLE(outfid,apsid,aps)862 #else 863 ierr=NF_PUT_VAR_REAL(outfid,apsid,aps)864 #endif 865 if (ierr.ne.NF_NOERR) then866 stop "Error: Failed to write aps"867 endif868 ENDIF 1043 ! define aps 1044 call def_var(outfid,"aps","hybrid pressure at midlayers"," ",1,& 1045 (/altdimout/),apsid,ierr) 1046 if (ierr.ne.NF_NOERR) then 1047 stop "Error: Failed to def_var aps" 1048 endif 1049 1050 ! write aps 1051 #ifdef NC_DOUBLE 1052 ierr=NF_PUT_VAR_DOUBLE(outfid,apsid,aps) 1053 #else 1054 ierr=NF_PUT_VAR_REAL(outfid,apsid,aps) 1055 #endif 1056 if (ierr.ne.NF_NOERR) then 1057 stop "Error: Failed to write aps" 1058 endif 1059 ENDIF ! of IF (aps_ok) 869 1060 870 1061 IF (bps_ok) then 871 ! define bps872 call def_var(nout,"bps","hybrid sigma at midlayers"," ",1,&873 (/altdimout/),bpsid,ierr)874 if (ierr.ne.NF_NOERR) then875 stop "Error: Failed to def_var bps"876 endif877 878 ! write bps879 #ifdef NC_DOUBLE 880 ierr=NF_PUT_VAR_DOUBLE(outfid,bpsid,bps)881 #else 882 ierr=NF_PUT_VAR_REAL(outfid,bpsid,bps)883 #endif 884 if (ierr.ne.NF_NOERR) then885 stop "Error: Failed to write bps"886 endif887 ENDIF 1062 ! define bps 1063 call def_var(outfid,"bps","hybrid sigma at midlayers"," ",1,& 1064 (/altdimout/),bpsid,ierr) 1065 if (ierr.ne.NF_NOERR) then 1066 stop "Error: Failed to def_var bps" 1067 endif 1068 1069 ! write bps 1070 #ifdef NC_DOUBLE 1071 ierr=NF_PUT_VAR_DOUBLE(outfid,bpsid,bps) 1072 #else 1073 ierr=NF_PUT_VAR_REAL(outfid,bpsid,bps) 1074 #endif 1075 if (ierr.ne.NF_NOERR) then 1076 stop "Error: Failed to write bps" 1077 endif 1078 ENDIF ! of IF (bps_ok) 888 1079 889 1080 !============================================================================== … … 891 1082 !============================================================================== 892 1083 893 894 1084 IF (phis) THEN 895 1085 896 !define phisinit897 call def_var(nout,"phisinit","Ground level geopotential"," ",2,&898 (/londimout,latdimout/),phisinitid,ierr)899 if (ierr.ne.NF_NOERR) then1086 !define phisinit 1087 call def_var(outfid,"phisinit","Ground level geopotential"," ",2,& 1088 (/londimout,latdimout/),phisinitid,ierr) 1089 if (ierr.ne.NF_NOERR) then 900 1090 stop "Error: Failed to def_var phisinit" 901 1091 endif 902 1092 903 ! write phisinit904 #ifdef NC_DOUBLE 905 ierr=NF_PUT_VAR_DOUBLE(outfid,phisinitid,phisinit)906 #else 907 ierr=NF_PUT_VAR_REAL(outfid,phisinitid,phisinit)908 #endif 909 if (ierr.ne.NF_NOERR) then910 stop "Error: Failed to write phisinit"911 endif912 913 END IF1093 ! write phisinit 1094 #ifdef NC_DOUBLE 1095 ierr=NF_PUT_VAR_DOUBLE(outfid,phisinitid,phisinit) 1096 #else 1097 ierr=NF_PUT_VAR_REAL(outfid,phisinitid,phisinit) 1098 #endif 1099 if (ierr.ne.NF_NOERR) then 1100 stop "Error: Failed to write phisinit" 1101 endif 1102 1103 ENDIF ! of IF (phis) 914 1104 915 1105 … … 1051 1241 1052 1242 end subroutine missing_value 1053 !******************************************************************************1054 1055 end program localtime1056 1243 1057 1244 !***************************************************************************** … … 1096 1283 end subroutine interpolf 1097 1284 1285 !****************************************************************************** 1286 1287 end program localtime 1288
Note: See TracChangeset
for help on using the changeset viewer.