Ignore:
Timestamp:
Jul 8, 2021, 4:29:44 PM (3 years ago)
Author:
romain.vande
Message:

MARS Dynamico:

Utilitaire concatnc, localtime, zrecast can process Xios output
RV

File:
1 edited

Legend:

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

    r2440 r2546  
    131131! valid_range(2): [netcdf] interval in which a value is considered valid
    132132real :: year_day = 669.
     133integer :: XIOS =0
    133134
    134135!==============================================================================
     
    328329   ierr=NF_INQ_VARID(nid,"latitude",latvar)
    329330   if (ierr.NE.NF_NOERR) then
    330       write(*,*) 'ERROR: Field <latitude> is missing in file '//file(i)
     331     ierr=NF_INQ_DIMID(nid,"lat",latdim)
     332     ierr=NF_INQ_VARID(nid,"lat",latvar)
     333     if (ierr.EQ.NF_NOERR) then
     334        write(*,*) 'XIOS concat spotted'
     335        XIOS=1
     336     endif
     337   endif 
     338   if (ierr.NE.NF_NOERR) then
     339      write(*,*) 'ERROR: Field <latitude> or <lat> is missing in file '//file(i)
    331340      stop "" 
    332341   endif
     
    334343!  write(*,*) "latlen: ",latlen
    335344
    336    ierr=NF_INQ_DIMID(nid,"longitude",londim)
    337    ierr=NF_INQ_VARID(nid,"longitude",lonvar)
    338    if (ierr.NE.NF_NOERR) then
    339       write(*,*) 'ERROR: Field <longitude> is missing in file '//file(i)
    340       stop ""
     345   if (XIOS.EQ.0) then
     346       ierr=NF_INQ_DIMID(nid,"longitude",londim)
     347       ierr=NF_INQ_VARID(nid,"longitude",lonvar)
     348       if (ierr.NE.NF_NOERR) then
     349          write(*,*) 'ERROR: Field <longitude> is missing in file '//file(i)
     350          stop ""
     351       endif
     352       ierr=NF_INQ_DIMLEN(nid,londim,lonlen)
     353       !  write(*,*) "lonlen: ",lonlen
     354   else
     355       ierr=NF_INQ_DIMID(nid,"lon",londim)
     356       ierr=NF_INQ_VARID(nid,"lon",lonvar)
     357       if (ierr.NE.NF_NOERR) then
     358          write(*,*) 'ERROR: Field <lon> is missing in file '//file(i)
     359          stop ""
     360       endif
     361       ierr=NF_INQ_DIMLEN(nid,londim,lonlen)
     362       !  write(*,*) "lonlen: ",lonlen
    341363   endif
    342    ierr=NF_INQ_DIMLEN(nid,londim,lonlen)
    343 !  write(*,*) "lonlen: ",lonlen
    344364
    345365   ierr=NF_INQ_DIMID(nid,"altitude",altdim)
     
    368388! 2.2.1 Check presence and read "controle" dimension & variable from input file
    369389!==============================================================================
    370    ierr=NF_INQ_DIMID(nid,"index",ctldim)
    371    if (ierr.NE.NF_NOERR) then
    372       write(*,*) 'Dimension <index> is missing in file '//file(i)
    373       write(*,*) "The program continues..."
    374       ctllen=0
    375       !stop ""
     390   if (XIOS.EQ.0) then
     391        ierr=NF_INQ_DIMID(nid,"index",ctldim)
     392        if (ierr.NE.NF_NOERR) then
     393          write(*,*) 'Dimension <index> is missing in file '//file(i)
     394          write(*,*) "The program continues..."
     395          ctllen=0
     396          !stop ""
     397       else
     398          ierr=NF_INQ_VARID(nid,"controle",ctlvar)
     399          if (ierr.NE.NF_NOERR) then
     400            write(*,*) 'Field <controle> is missing in file '//file(i)
     401            write(*,*) "The program continues..."
     402            ctllen=0
     403            !stop ""
     404          else
     405            ierr=NF_INQ_DIMLEN(nid,ctldim,ctllen)
     406          endif
     407       endif
    376408   else
    377       ierr=NF_INQ_VARID(nid,"controle",ctlvar)
    378       if (ierr.NE.NF_NOERR) then
    379          write(*,*) 'Field <controle> is missing in file '//file(i)
    380          write(*,*) "The program continues..."
    381          ctllen=0
    382          !stop ""
    383       else
    384          ierr=NF_INQ_DIMLEN(nid,ctldim,ctllen)
    385       endif
     409     ierr=NF_INQ_DIMID(nid,"controle_axe",ctldim)
     410     if (ierr.NE.NF_NOERR) then
     411       write(*,*) 'Dimension <controle_axe> is missing in file '//file(i)
     412       write(*,*) "The program continues..."
     413       ctllen=0
     414       !stop ""
     415     else
     416       ierr=NF_INQ_VARID(nid,"controle",ctlvar)
     417       if (ierr.NE.NF_NOERR) then
     418         write(*,*) 'Field <controle> is missing in file '//file(i)
     419         write(*,*) "The program continues..."
     420         ctllen=0
     421         !stop ""
     422        else
     423         ierr=NF_INQ_DIMLEN(nid,ctldim,ctllen)
     424       endif
     425     endif
    386426   endif
    387427
     
    395435! 2.3 Read "Time" dimension & variable from input file
    396436!==============================================================================
     437   if (XIOS.EQ.0) then
    397438   ierr=NF_INQ_DIMID(nid,"Time",timedim)
    398439   if (ierr.NE.NF_NOERR) then
     
    407448   ierr=NF_INQ_DIMLEN(nid,timedim,timelen)
    408449!  write(*,*) "timelen: ",timelen
     450   else
     451   ierr=NF_INQ_DIMID(nid,"time_counter",timedim)
     452   if (ierr.NE.NF_NOERR) then
     453      write(*,*) 'ERROR: Dimension <time_counter> is missing in file '//file(i)
     454      stop ""
     455   endif
     456   ierr=NF_INQ_VARID(nid,"time_counter",timevar)
     457   if (ierr.NE.NF_NOERR) then
     458      write(*,*) 'ERROR: Field <time_counter> is missing in file '//file(i)
     459      stop ""
     460   endif
     461   ierr=NF_INQ_DIMLEN(nid,timedim,timelen)
     462!  write(*,*) "timelen: ",timelen
     463   endif
    409464
    410465   ! allocate time() array and fill it with values from input file
     
    513568!         correction if the file to concatenate seems "before" previous file
    514569!         (for instance to concatenate diagfi from the previous year at the enf of a year)
     570          print *, "time(rep)", time(rep), rep
     571          print *, "ctlsol", ctlsol
     572          print *, "starttimeoffset", starttimeoffset
     573          print *, "output_time", output_time
     574          print *, "previous_last_output_time", previous_last_output_time
    515575          do while (output_time.lt.previous_last_output_time) 
    516576                   output_time = output_time + year_day
Note: See TracChangeset for help on using the changeset viewer.