Ignore:
Timestamp:
Oct 5, 2021, 8:34:09 AM (3 years ago)
Author:
emillour
Message:

Mars GCM utilities:
Minor fixes to run with picky gfortran 10.3.0 which requires one element arrays
(rather than scalars) when calling NetCDF routines, andf that stop statements
should not be followed by strings. While at it replaced tabs with spaces.
EM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/util/localtime.F90

    r2546 r2567  
    1212include "netcdf.inc" ! NetCDF definitions
    1313
    14 character (len=50)  file
     14character (len=100)  file
    1515! file(): input file(s) names(s)
    1616character (len=30), dimension(16) :: notprocessed
    1717! notprocessed(): names of the (16) variables that won't be processed
    18 character (len=50), dimension(:), allocatable :: var
     18character (len=100), dimension(:), allocatable :: var
    1919! var(): name(s) of variable(s) that will be processed
    2020character (len=100) :: tmpvar,long_name,units
     
    121121if (len_trim(file).eq.0) then
    122122   write(*,*) "no file... game over"
    123    stop ""
     123   stop
    124124endif
    125125
     
    132132   write(*,*) 'ERROR: Pb opening file '//trim(file)
    133133   write(*,*) NF_STRERROR(ierr)
    134    stop ""
     134   stop
    135135endif
    136136
     
    140140   write(*,*) 'ERROR: Pb with NF_INQ_NVARS'
    141141   write(*,*) NF_STRERROR(ierr)
    142    stop ""
     142   stop
    143143endif
    144144
     
    199199write(*,*) "(an empty line , i.e: just <Enter>, implies end of list)"
    200200nbvar=0
    201 read(*,'(a50)') tmpvar
     201read(*,'(a100)') tmpvar
    202202do while ((tmpvar/=' ').AND.(trim(tmpvar)/='all'))
    203203   nbvar=nbvar+1
    204204   var(nbvar)=tmpvar
    205    read(*,'(a50)') tmpvar
     205   read(*,'(a100)') tmpvar
    206206enddo
    207207
     
    219219else if(nbvar==0) then
    220220   write(*,*) "no variable... game over"
    221    stop ""
     221   stop
    222222endif ! of if (tmpvar=="all")
    223223
     
    238238      write(*,*) 'ERROR: Pb opening file '//trim(file)
    239239      write(*,*) NF_STRERROR(ierr)
    240       stop ""
     240      stop
    241241   endif
    242242
     
    251251         if (ierr.NE.NF_NOERR) then
    252252            write(*,*) 'ERROR: Dimension <latitude> and <lat> is missing in file '//trim(file)
    253             stop ""
     253            stop
    254254         endif
    255255   endif
     
    260260      if (ierr.NE.NF_NOERR) then
    261261        write(*,*) 'ERROR: Field <latitude> and <lat> is missing in file '//trim(file)
    262         stop ""
     262        stop
    263263      endif
    264264   endif
     
    272272         if (ierr.NE.NF_NOERR) then
    273273            write(*,*) 'ERROR: Dimension <longitude> and <lon> is missing in file '//trim(file)
    274             stop ""
     274            stop
    275275         endif
    276276   endif
     
    281281      if (ierr.NE.NF_NOERR) then
    282282        write(*,*) 'ERROR: Field <longitude> and <lon> is missing in file '//trim(file)
    283         stop ""
     283        stop
    284284      endif
    285285   endif
     
    290290   if (ierr.NE.NF_NOERR) then
    291291      write(*,*) 'ERROR: Dimension <altitude> is missing in file '//trim(file)
    292       stop ""
     292      stop
    293293   endif
    294294   ierr=NF_INQ_VARID(nid,"altitude",altvar)
    295295   if (ierr.NE.NF_NOERR) then
    296296      write(*,*) 'ERROR: Field <altitude> is missing in file '//trim(file)
    297       stop ""
     297      stop
    298298   endif
    299299   ierr=NF_INQ_DIMLEN(nid,altdim,altlen)
     
    321321         ctllen=0
    322322      endif
    323       !stop ""
     323      !stop
    324324   endif
    325325!   ierr=NF_INQ_DIMID(nid,"controle_axe",ctldim)
    326326!   if (ierr.NE.NF_NOERR) then
    327 !      !stop ""
     327!      !stop
    328328!   endif
    329329   ierr=NF_INQ_VARID(nid,"controle",ctlvar)
     
    331331      write(*,*) 'Field <controle> is missing in file '//trim(file)
    332332      ctllen=0
    333       !stop ""
     333      !stop
    334334   else
    335335      ierr=NF_INQ_DIMLEN(nid,ctldim,ctllen)
     
    414414     if (ierr.NE.NF_NOERR) then
    415415        write(*,*) 'ERROR: Dimension <Time> or is missing in file'//trim(file)
    416         stop ""
     416        stop
    417417     endif
    418418   endif
     
    423423     if (ierr.NE.NF_NOERR) then
    424424        write(*,*) 'ERROR: Field <Time> is missing in file '//trim(file)
    425         stop ""
     425        stop
    426426     endif
    427427   endif
     
    556556
    557557     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))
    559559     enddo
    560560   else
    561561     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))
    563563        if (ierr.NE.NF_NOERR) then
    564564          write(*,*) "Error , failed to write Time"
     
    582582      if (ierr.NE.NF_NOERR) then
    583583         write(*,*) 'ERROR: Field <',var(j),'> not found in file'//file
    584          stop ""
     584         stop
    585585      endif
    586586      ierr=nf_inq_varndims(nid,varid,ndim)
     
    718718      if (ierr.ne.NF_NOERR) then
    719719         write(*,*) 'PUT_VAR ERROR: ',NF_STRERROR(ierr)
    720          stop ""
     720         stop
    721721      endif
    722722
     
    820820   WRITE(*,*)'ERROR: Impossible to create the file ',trim(filename)
    821821   write(*,*) NF_STRERROR(ierr)
    822    stop ""
     822   stop
    823823endif
    824824
     
    831831   WRITE(*,*)'initiate: error failed to define dimension <latitude>'
    832832   write(*,*) NF_STRERROR(ierr)
    833    stop ""
     833   stop
    834834endif
    835835ierr = NF_DEF_DIM(nout, "longitude", lonlen, londimout)
     
    837837   WRITE(*,*)'initiate: error failed to define dimension <longitude>'
    838838   write(*,*) NF_STRERROR(ierr)
    839    stop ""
     839   stop
    840840endif
    841841ierr = NF_DEF_DIM(nout, "altitude", altlen, altdimout)
     
    843843   WRITE(*,*)'initiate: error failed to define dimension <altitude>'
    844844   write(*,*) NF_STRERROR(ierr)
    845    stop ""
     845   stop
    846846endif
    847847if (size(ctl).ne.0) then
     
    850850    WRITE(*,*)'initiate: error failed to define dimension <index>'
    851851    write(*,*) NF_STRERROR(ierr)
    852     stop ""
     852    stop
    853853  endif
    854854endif
     
    857857   WRITE(*,*)'initiate: error failed to define dimension <Time>'
    858858   write(*,*) NF_STRERROR(ierr)
    859    stop ""
     859   stop
    860860endif
    861861
     
    867867   WRITE(*,*)'initiate: error failed to switch out of define mode'
    868868   write(*,*) NF_STRERROR(ierr)
    869    stop ""
     869   stop
    870870endif
    871871
     
    888888   WRITE(*,*)'initiate: error failed writing variable <latitude>'
    889889   write(*,*) NF_STRERROR(ierr)
    890    stop ""
     890   stop
    891891endif
    892892
     
    903903   WRITE(*,*)'initiate: error failed writing variable <longitude>'
    904904   write(*,*) NF_STRERROR(ierr)
    905    stop ""
     905   stop
    906906endif
    907907
     
    926926   WRITE(*,*)'initiate: error failed writing variable <altitude>'
    927927   write(*,*) NF_STRERROR(ierr)
    928    stop ""
     928   stop
    929929endif
    930930
     
    948948      WRITE(*,*)'initiate: error failed writing variable <controle>'
    949949      write(*,*) NF_STRERROR(ierr)
    950       stop ""
     950      stop
    951951   endif
    952952endif
     
    10141014  hybrid=.true.
    10151015  if (ierr.ne.NF_NOERR) then
    1016     stop "init2 Error: Failed reading aps"
     1016    write(*,*) "init2 Error: Failed reading aps"
     1017    stop
    10171018  endif
    10181019
     
    10311032    ierr=NF_GET_VAR_REAL(infid,tmpvarid,bps)
    10321033    if (ierr.ne.NF_NOERR) then
    1033       stop "init2 Error: Failed reading bps"
     1034      write(*,*) "init2 Error: Failed reading bps"
     1035      stop
    10341036    endif
    10351037  endif
     
    10501052  ierr=NF_GET_VAR_REAL(infid,tmpvarid,phisinit)
    10511053  if (ierr.ne.NF_NOERR) then
    1052     stop "init2 Error: Failed reading phisinit"
     1054    write(*,*) "init2 Error: Failed reading phisinit"
     1055    stop
    10531056  endif
    10541057  phis = .true.
     
    10691072               (/layerdimout/),apsid,ierr)
    10701073  if (ierr.ne.NF_NOERR) then
    1071     stop "Error: Failed to def_var aps"
     1074    write(*,*) "Error: Failed to def_var aps"
     1075    stop
    10721076  endif
    10731077
     
    10751079  ierr=NF_PUT_VAR_REAL(outfid,apsid,aps)
    10761080  if (ierr.ne.NF_NOERR) then
    1077     stop "Error: Failed to write aps"
     1081    write(*,*) "Error: Failed to write aps"
     1082    stop
    10781083  endif
    10791084 
     
    10821087               (/layerdimout/),bpsid,ierr)
    10831088  if (ierr.ne.NF_NOERR) then
    1084     stop "Error: Failed to def_var bps"
     1089    write(*,*) "Error: Failed to def_var bps"
     1090    stop
    10851091  endif
    10861092
     
    10881094  ierr=NF_PUT_VAR_REAL(outfid,bpsid,bps)
    10891095  if (ierr.ne.NF_NOERR) then
    1090     stop "Error: Failed to write bps"
     1096    write(*,*) "Error: Failed to write bps"
     1097    stop
    10911098  endif
    10921099 
     
    11051112              (/londimout,latdimout/),phisinitid,ierr)
    11061113  if (ierr.ne.NF_NOERR) then
    1107      stop "Error: Failed to def_var phisinit"
     1114     write(*,*) "Error: Failed to def_var phisinit"
     1115     stop
    11081116  endif
    11091117
     
    11111119  ierr=NF_PUT_VAR_REAL(outfid,phisinitid,phisinit)
    11121120  if (ierr.ne.NF_NOERR) then
    1113     stop "Error: Failed to write phisinit"
     1121    write(*,*) "Error: Failed to write phisinit"
     1122    stop
    11141123  endif
    11151124
     
    12261235     !write(*,*) 'NF_NOERR', NF_NOERR
    12271236     !CALL abort
    1228      stop ""
     1237     stop
    12291238  endif
    12301239endif
     
    12381247  !    WRITE(*,*) 'NF_NOERR', NF_NOERR
    12391248  !    CALL abort
    1240      stop ""
     1249     stop
    12411250  endif
    12421251endif
Note: See TracChangeset for help on using the changeset viewer.