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/solzenangle.F90

    r2434 r2567  
    1717character (len=30), dimension(16) :: notprocessed
    1818! notprocessed(): names of the (16) variables that won't be processed
    19 character (len=50), dimension(:), allocatable :: var
     19character (len=100), dimension(:), allocatable :: var
    2020! var(): name(s) of variable(s) that will be processed
    2121character (len=100) :: tmpvar,long_name,units
     
    141141if (len_trim(file).eq.0) then
    142142   write(*,*) "no file... game over"
    143    stop ""
     143   stop
    144144endif
    145145
     
    152152   write(*,*) 'ERROR: Pb opening file '//trim(file)
    153153   write(*,*) NF_STRERROR(ierr)
    154    stop ""
     154   stop
    155155endif
    156156
     
    160160   write(*,*) 'ERROR: Pb with NF_INQ_NVARS'
    161161   write(*,*) NF_STRERROR(ierr)
    162    stop ""
     162   stop
    163163endif
    164164
     
    218218write(*,*) "(an empty line , i.e: just <Enter>, implies end of list)"
    219219nbvar=0
    220 read(*,'(a50)') tmpvar
     220read(*,'(a100)') tmpvar
    221221do while ((tmpvar/=' ').AND.(trim(tmpvar)/='all'))
    222222   nbvar=nbvar+1
    223223   var(nbvar)=tmpvar
    224    read(*,'(a50)') tmpvar
     224   read(*,'(a100)') tmpvar
    225225enddo
    226226
     
    238238else if(nbvar==0) then
    239239   write(*,*) "no variable... game over"
    240    stop ""
     240   stop
    241241endif ! of if (tmpvar=="all")
    242242
     
    252252   write(*,*) 'ERROR: Pb opening file '//trim(file)
    253253   write(*,*) NF_STRERROR(ierr)
    254    stop ""
     254   stop
    255255endif
    256256
     
    262262   if (ierr.NE.NF_NOERR) then
    263263      write(*,*) 'ERROR: Dimension <latitude> is missing in file '//trim(file)
    264       stop ""
     264      stop
    265265   endif
    266266   ierr=NF_INQ_VARID(nid,"latitude",latvar)
    267267   if (ierr.NE.NF_NOERR) then
    268268      write(*,*) 'ERROR: Field <latitude> is missing in file '//trim(file)
    269       stop ""
     269      stop
    270270   endif
    271271   ierr=NF_INQ_DIMLEN(nid,latdim,latlen)
     
    275275   if (ierr.NE.NF_NOERR) then
    276276      write(*,*) 'ERROR: Dimension <longitude> is missing in file '//trim(file)
    277       stop ""
     277      stop
    278278   endif
    279279   ierr=NF_INQ_VARID(nid,"longitude",lonvar)
    280280   if (ierr.NE.NF_NOERR) then
    281281      write(*,*) 'ERROR: Field <longitude> is missing in file'//trim(file)
    282       stop ""
     282      stop
    283283   endif
    284284   ierr=NF_INQ_DIMLEN(nid,londim,lonlen)
     
    288288   if (ierr.NE.NF_NOERR) then
    289289      write(*,*) 'ERROR: Dimension <altitude> is missing in file '//trim(file)
    290       stop ""
     290      stop
    291291   endif
    292292   ierr=NF_INQ_VARID(nid,"altitude",altvar)
    293293   if (ierr.NE.NF_NOERR) then
    294294      write(*,*) 'ERROR: Field <altitude> is missing in file'//trim(file)
    295       stop ""
     295      stop
    296296   endif
    297297   ierr=NF_INQ_DIMLEN(nid,altdim,altlen)
     
    315315      write(*,*) ' Dimension <index> is missing in file '//trim(file)
    316316      ctllen=0
    317       !stop ""
     317      !stop
    318318   endif
    319319   ierr=NF_INQ_VARID(nid,"controle",ctlvar)
     
    321321      write(*,*) 'Field <controle> is missing in file '//trim(file)
    322322      ctllen=0
    323       !stop ""
     323      !stop
    324324   else
    325325      ierr=NF_INQ_DIMLEN(nid,ctldim,ctllen)
     
    401401   if (ierr.NE.NF_NOERR) then
    402402      write(*,*) 'ERROR: Dimension <Time> is missing in file'//trim(file)
    403       stop ""
     403      stop
    404404   endif
    405405   ierr=NF_INQ_VARID(nid,"Time",timevar)
    406406   if (ierr.NE.NF_NOERR) then
    407407      write(*,*) 'ERROR: Field <Time> is missing in file'//trim(file)
    408       stop ""
     408      stop
    409409   endif
    410410   ierr=NF_INQ_DIMLEN(nid,timedim,timelen)
     
    583583
    584584     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.)
    586586     enddo
    587587   else
    588588     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))
    590590       if (ierr.NE.NF_NOERR) then
    591591         write(*,*) "Error , failed to write Time"
     
    609609      if (ierr.NE.NF_NOERR) then
    610610         write(*,*) 'ERROR: Field <',var(j),'> not found in file'//file
    611          stop ""
     611         stop
    612612      endif
    613613      ierr=nf_inq_varndims(nid,varid,ndim)
     
    768768       if (ierr.ne.NF_NOERR) then
    769769         write(*,*) 'PUT_VAR ERROR: ',NF_STRERROR(ierr)
    770          stop ""
     770         stop
    771771       endif
    772772
     
    814814   if (ierr.ne.NF_NOERR) then
    815815      write(*,*) 'PUT_VAR ERROR: ',NF_STRERROR(ierr)
    816       stop ""
     816      stop
    817817   endif
    818818
     
    929929   WRITE(*,*)'ERROR: Impossible to create the file ',trim(filename)
    930930   write(*,*) NF_STRERROR(ierr)
    931    stop ""
     931   stop
    932932endif
    933933
     
    940940   WRITE(*,*)'initiate: error failed to define dimension <latitude>'
    941941   write(*,*) NF_STRERROR(ierr)
    942    stop ""
     942   stop
    943943endif
    944944ierr = NF_DEF_DIM(nout, "longitude", lonlen, londimout)
     
    946946   WRITE(*,*)'initiate: error failed to define dimension <longitude>'
    947947   write(*,*) NF_STRERROR(ierr)
    948    stop ""
     948   stop
    949949endif
    950950ierr = NF_DEF_DIM(nout, "altitude", altlen, altdimout)
     
    952952   WRITE(*,*)'initiate: error failed to define dimension <altitude>'
    953953   write(*,*) NF_STRERROR(ierr)
    954    stop ""
     954   stop
    955955endif
    956956if (size(ctl).ne.0) then
     
    959959    WRITE(*,*)'initiate: error failed to define dimension <index>'
    960960    write(*,*) NF_STRERROR(ierr)
    961     stop ""
     961    stop
    962962  endif
    963963endif
     
    966966   WRITE(*,*)'initiate: error failed to define dimension <Time>'
    967967   write(*,*) NF_STRERROR(ierr)
    968    stop ""
     968   stop
    969969endif
    970970
     
    973973   WRITE(*,*)'initiate: error failed to define dimension <GCM_layers>'
    974974   write(*,*) NF_STRERROR(ierr)
    975    stop ""
     975   stop
    976976endif
    977977
     
    981981   WRITE(*,*)'initiate: error failed to switch out of define mode'
    982982   write(*,*) NF_STRERROR(ierr)
    983    stop ""
     983   stop
    984984endif
    985985!==============================================================================
     
    992992ierr = NF_REDEF (nout)
    993993ierr = NF_PUT_ATT_TEXT(nout,timevarout,'comment',135,&
    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")
     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")
    996996! End netcdf define mode
    997997ierr = NF_ENDDEF(nout)
     
    10081008   WRITE(*,*)'initiate: error failed writing variable <latitude>'
    10091009   write(*,*) NF_STRERROR(ierr)
    1010    stop ""
     1010   stop
    10111011endif
    10121012
     
    10221022   WRITE(*,*)'initiate: error failed writing variable <longitude>'
    10231023   write(*,*) NF_STRERROR(ierr)
    1024    stop ""
     1024   stop
    10251025endif
    10261026
     
    10451045   WRITE(*,*)'initiate: error failed writing variable <altitude>'
    10461046   write(*,*) NF_STRERROR(ierr)
    1047    stop ""
     1047   stop
    10481048endif
    10491049
     
    10671067      WRITE(*,*)'initiate: error failed writing variable <controle>'
    10681068      write(*,*) NF_STRERROR(ierr)
    1069       stop ""
     1069      stop
    10701070   endif
    10711071endif
     
    11341134  hybrid=.true.
    11351135  if (ierr.ne.NF_NOERR) then
    1136     stop "init2 Error: Failed reading aps"
     1136    write(*,*) "init2 Error: Failed reading aps"
     1137    stop
    11371138  endif
    11381139
     
    11511152    ierr=NF_GET_VAR_REAL(infid,tmpvarid,bps)
    11521153    if (ierr.ne.NF_NOERR) then
    1153       stop "init2 Error: Failed reading bps"
     1154      write(*,*) "init2 Error: Failed reading bps"
     1155      stop
    11541156    endif
    11551157  endif
     
    11701172  ierr=NF_GET_VAR_REAL(infid,tmpvarid,phisinit)
    11711173  if (ierr.ne.NF_NOERR) then
    1172     stop "init2 Error: Failed reading phisinit"
     1174    write(*,*) "init2 Error: Failed reading phisinit"
     1175    stop
    11731176  endif
    11741177  phis = .true.
     
    11891192               (/layerdimout/),apsid,ierr)
    11901193  if (ierr.ne.NF_NOERR) then
    1191     stop "Error: Failed to def_var aps"
     1194    write(*,*) "Error: Failed to def_var aps"
     1195    stop
    11921196  endif
    11931197
     
    11951199  ierr=NF_PUT_VAR_REAL(outfid,apsid,aps)
    11961200  if (ierr.ne.NF_NOERR) then
    1197     stop "Error: Failed to write aps"
     1201    write(*,*) "Error: Failed to write aps"
     1202    stop
    11981203  endif
    11991204 
     
    12021207               (/layerdimout/),bpsid,ierr)
    12031208  if (ierr.ne.NF_NOERR) then
    1204     stop "Error: Failed to def_var bps"
     1209    write(*,*) "Error: Failed to def_var bps"
     1210    stop
    12051211  endif
    12061212
     
    12081214  ierr=NF_PUT_VAR_REAL(outfid,bpsid,bps)
    12091215  if (ierr.ne.NF_NOERR) then
    1210     stop "Error: Failed to write bps"
     1216    write(*,*) "Error: Failed to write bps"
     1217    stop
    12111218  endif
    12121219 
     
    12251232              (/londimout,latdimout/),phisinitid,ierr)
    12261233  if (ierr.ne.NF_NOERR) then
    1227      stop "Error: Failed to def_var phisinit"
     1234     write(*,*) "Error: Failed to def_var phisinit"
     1235     stop
    12281236  endif
    12291237
     
    12311239  ierr=NF_PUT_VAR_REAL(outfid,phisinitid,phisinit)
    12321240  if (ierr.ne.NF_NOERR) then
    1233     stop "Error: Failed to write phisinit"
     1241    write(*,*) "Error: Failed to write phisinit"
     1242    stop
    12341243  endif
    12351244
     
    13471356     !write(*,*) 'NF_NOERR', NF_NOERR
    13481357     !CALL abort
    1349      stop ""
     1358     stop
    13501359  endif
    13511360endif
     
    13601369  !    WRITE(*,*) 'NF_NOERR', NF_NOERR
    13611370  !    CALL abort
    1362      stop ""
     1371     stop
    13631372  endif
    13641373endif
Note: See TracChangeset for help on using the changeset viewer.