Changeset 397 for trunk


Ignore:
Timestamp:
Nov 18, 2011, 12:49:09 PM (13 years ago)
Author:
emillour
Message:

Mars GCM utility concatnc : minor upgrade. Handle cases when ap and bp are not available but aps and bps are.
FF

File:
1 edited

Legend:

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

    r322 r397  
    1616!   of data (which is the case for outputs from 'zrecast')
    1717!   (EM, April 2010)
     18! + handle absence of ap() and bp() if aps and bps are available
     19!    (case of stats file) FF, November 2011
    1820! ********************************************************
    1921
     
    748750logical :: phis ! is "phisinit" available ?
    749751logical :: hybrid ! are "aps" and "bps" available ?
     752logical :: apbp ! are "ap" and "bp" available ?
    750753
    751754!==============================================================================
     
    797800  if (ierr.ne.NF_NOERR) then
    798801    write(*,*) "Ooops. Failed to get ap ID. OK."
    799     hybrid=.false.
     802    apbp=.false.
    800803  else
    801804    ierr=NF_GET_VAR_REAL(infid,tmpvarid,ap)
    802     hybrid=.true.
     805    apbp=.true.
    803806    if (ierr.ne.NF_NOERR) then
    804807      stop "Error: Failed reading ap"
     
    816819  if (ierr.ne.NF_NOERR) then
    817820    write(*,*) "Ooops. Failed to get bp ID. OK."
    818     hybrid=.false.
     821    apbp=.false.
    819822  else
    820823    ierr=NF_GET_VAR_REAL(infid,tmpvarid,bp)
    821     hybrid=.true.
     824    apbp=.true.
    822825    if (ierr.ne.NF_NOERR) then
    823826      stop "Error: Failed reading bp"
     
    900903  endif
    901904
    902 ! define ap
    903   call def_var(nout,"ap","hybrid sigma at interlayers"," ",1,&
     905  if (apbp) then
     906!   define ap
     907    call def_var(nout,"ap","hybrid sigma at interlayers"," ",1,&
    904908             (/interlayerdimout/),apid,ierr)
    905   if (ierr.ne.NF_NOERR) then
    906     stop "Error: Failed to def_var ap"
    907   endif
     909    if (ierr.ne.NF_NOERR) then
     910      stop "Error: Failed to def_var ap"
     911    endif
    908912
    909913! write ap
    910914#ifdef NC_DOUBLE
    911   ierr=NF_PUT_VAR_DOUBLE(outfid,apid,ap)
    912 #else
    913   ierr=NF_PUT_VAR_REAL(outfid,apid,ap)
    914 #endif
    915   if (ierr.ne.NF_NOERR) then
    916     stop "Error: Failed to write ap"
    917   endif
     915    ierr=NF_PUT_VAR_DOUBLE(outfid,apid,ap)
     916#else
     917    ierr=NF_PUT_VAR_REAL(outfid,apid,ap)
     918#endif
     919    if (ierr.ne.NF_NOERR) then
     920      stop "Error: Failed to write ap"
     921    endif
    918922
    919923! define bp
    920   call def_var(nout,"bp","hybrid sigma at interlayers"," ",1,&
     924    call def_var(nout,"bp","hybrid sigma at interlayers"," ",1,&
    921925             (/interlayerdimout/),bpid,ierr)
    922   if (ierr.ne.NF_NOERR) then
    923     stop "Error: Failed to def_var bp"
    924   endif
    925 
    926 ! write bp
    927 #ifdef NC_DOUBLE
    928   ierr=NF_PUT_VAR_DOUBLE(outfid,bpid,bp)
    929 #else
    930   ierr=NF_PUT_VAR_REAL(outfid,bpid,bp)
    931 #endif
    932   if (ierr.ne.NF_NOERR) then
    933     stop "Error: Failed to write bp"
    934   endif
     926    if (ierr.ne.NF_NOERR) then
     927      stop "Error: Failed to def_var bp"
     928    endif
     929
     930!   write bp
     931#ifdef NC_DOUBLE
     932    ierr=NF_PUT_VAR_DOUBLE(outfid,bpid,bp)
     933#else
     934    ierr=NF_PUT_VAR_REAL(outfid,bpid,bp)
     935#endif
     936    if (ierr.ne.NF_NOERR) then
     937      stop "Error: Failed to write bp"
     938    endif
     939  endif ! of if (apbp)
    935940
    936941else
Note: See TracChangeset for help on using the changeset viewer.