Changeset 2546


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

MARS Dynamico:

Utilitaire concatnc, localtime, zrecast can process Xios output
RV

Location:
trunk/LMDZ.MARS
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/LMDZ.MARS/README

    r2545 r2546  
    34253425== 08/07/2021 == RV
    34263426tab_cntrl is written by Xios output. It is now a module variable of phyetat0_mod
     3427
     3428== 08/07/2021 == RV
     3429Utilitaire concatnc, localtime, zrecast can process Xios output
  • TabularUnified 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
  • TabularUnified trunk/LMDZ.MARS/util/localtime.F90

    r2440 r2546  
    247247   ierr=NF_INQ_DIMID(nid,"latitude",latdim)
    248248   if (ierr.NE.NF_NOERR) then
    249       write(*,*) 'ERROR: Dimension <latitude> is missing in file '//trim(file)
    250       stop "" 
     249      write(*,*) 'Dimension <latitude> is missing, looking for lat'
     250      ierr=NF_INQ_DIMID(nid,"lat",latdim)
     251         if (ierr.NE.NF_NOERR) then
     252            write(*,*) 'ERROR: Dimension <latitude> and <lat> is missing in file '//trim(file)
     253            stop "" 
     254         endif
    251255   endif
    252256   ierr=NF_INQ_VARID(nid,"latitude",latvar)
    253257   if (ierr.NE.NF_NOERR) then
    254       write(*,*) 'ERROR: Field <latitude> is missing in file '//trim(file)
    255       stop "" 
     258      write(*,*) 'Field <latitude> is missing, looking for lat'
     259      ierr=NF_INQ_VARID(nid,"lat",latvar)
     260      if (ierr.NE.NF_NOERR) then
     261        write(*,*) 'ERROR: Field <latitude> and <lat> is missing in file '//trim(file)
     262        stop "" 
     263      endif
    256264   endif
    257265   ierr=NF_INQ_DIMLEN(nid,latdim,latlen)
     
    260268   ierr=NF_INQ_DIMID(nid,"longitude",londim)
    261269   if (ierr.NE.NF_NOERR) then
    262       write(*,*) 'ERROR: Dimension <longitude> is missing in file '//trim(file)
    263       stop "" 
     270      write(*,*) 'Field <longitude> is missing, looking for lon'
     271      ierr=NF_INQ_DIMID(nid,"lon",londim)
     272         if (ierr.NE.NF_NOERR) then
     273            write(*,*) 'ERROR: Dimension <longitude> and <lon> is missing in file '//trim(file)
     274            stop "" 
     275         endif
    264276   endif
    265277   ierr=NF_INQ_VARID(nid,"longitude",lonvar)
    266278   if (ierr.NE.NF_NOERR) then
    267       write(*,*) 'ERROR: Field <longitude> is missing in file '//trim(file)
    268       stop ""
     279      write(*,*) 'Field <longitude> is missing, looking for lon'
     280      ierr=NF_INQ_VARID(nid,"lon",lonvar)
     281      if (ierr.NE.NF_NOERR) then
     282        write(*,*) 'ERROR: Field <longitude> and <lon> is missing in file '//trim(file)
     283        stop "" 
     284      endif
    269285   endif
    270286   ierr=NF_INQ_DIMLEN(nid,londim,lonlen)
     
    300316   if (ierr.NE.NF_NOERR) then
    301317      write(*,*) 'Dimension <index> is missing in file '//trim(file)
    302       ctllen=0
     318      write(*,*) 'Looking for controle_axe'
     319      ierr=NF_INQ_DIMID(nid,"controle_axe",ctldim)
     320      if (ierr.NE.NF_NOERR) then
     321         ctllen=0
     322      endif
    303323      !stop "" 
    304324   endif
     325!   ierr=NF_INQ_DIMID(nid,"controle_axe",ctldim)
     326!   if (ierr.NE.NF_NOERR) then
     327!      !stop "" 
     328!   endif
    305329   ierr=NF_INQ_VARID(nid,"controle",ctlvar)
    306330   if (ierr.NE.NF_NOERR) then
     
    386410   ierr=NF_INQ_DIMID(nid,"Time",timedim)
    387411   if (ierr.NE.NF_NOERR) then
    388       write(*,*) 'ERROR: Dimension <Time> is missing in file'//trim(file)
    389       stop ""
     412     write(*,*) 'ERROR: Dimension <Time> is missing looking for time_counter'
     413     ierr=NF_INQ_DIMID(nid,"time_counter",timedim)
     414     if (ierr.NE.NF_NOERR) then
     415        write(*,*) 'ERROR: Dimension <Time> or is missing in file'//trim(file)
     416        stop ""
     417     endif
    390418   endif
    391419   ierr=NF_INQ_VARID(nid,"Time",timevar)
    392420   if (ierr.NE.NF_NOERR) then
    393       write(*,*) 'ERROR: Field <Time> is missing in file'//trim(file)
    394       stop ""
     421     write(*,*) 'ERROR: Field <Time> is missing looking for time_counter'
     422     ierr=NF_INQ_VARID(nid,"time_counter",timevar)
     423     if (ierr.NE.NF_NOERR) then
     424        write(*,*) 'ERROR: Field <Time> is missing in file '//trim(file)
     425        stop ""
     426     endif
    395427   endif
    396428   ierr=NF_INQ_DIMLEN(nid,timedim,timelen)
  • TabularUnified trunk/LMDZ.MARS/util/zrecast.F90

    r2528 r2546  
    400400  ierr=NF_INQ_DIMID(infid,"time",tmpdimid)
    401401  if (ierr.ne.NF_NOERR) then
    402     stop "Error: Failed to get lon dimension ID"
     402    write(*,*) "Could not get time dimension ID"
     403    write(*,*) "  looking for time_counter dimension instead... "
     404    ierr=NF_INQ_DIMID(infid,"time_counter",tmpdimid)
     405    if (ierr.ne.NF_NOERR) then
     406      stop "Error: Failed to get time_counter dimension ID"
     407    else
     408      ierr=NF_INQ_VARID(infid,"time_counter",tmpvarid)
     409      if (ierr.ne.NF_NOERR) then
     410        stop "Error: Failed to get time_counter ID"
     411      else
     412        ierr=NF_INQ_DIMLEN(infid,tmpdimid,timelength)
     413        if (ierr.ne.NF_NOERR) then
     414          stop "Error: Failed to get time_counter length"
     415        else
     416          allocate(time(timelength),stat=ierr)
     417          if (ierr.ne.0) then
     418            write(*,*) "Error: Failed to allocate time(timelength)"
     419            write(*,*) "     timelength=",timelength
     420            stop
     421          endif
     422          ierr=NF_GET_VAR_REAL(infid,tmpvarid,time)
     423          if (ierr.ne.NF_NOERR) then
     424            stop "Error: Failed reading time"
     425          endif
     426        endif
     427      endif
     428    endif
    403429  else
    404430    ierr=NF_INQ_VARID(infid,"time",tmpvarid)
     
    471497if (ierr.ne.NF_NOERR) then
    472498  write(*,*) "Could not get controle dimension ID"
    473   ctllength = 0
     499  write(*,*) "  looking for controle_axe dimension instead... "
     500  ierr=NF_INQ_DIMID(infid,"controle_axe",tmpdimid)
     501  if (ierr.ne.NF_NOERR) then
     502    ctllength = 0
     503  else
     504    ierr=NF_INQ_VARID(infid,"controle",tmpvarid)
     505    if (ierr.ne.NF_NOERR) then
     506      stop "Error: Failed to get controle ID"
     507    else
     508      ierr=NF_INQ_DIMLEN(infid,tmpdimid,ctllength)
     509      if (ierr.ne.NF_NOERR) then
     510        stop "Error: Failed to get controle length"
     511      else
     512        allocate(ctl(ctllength),stat=ierr)
     513        if (ierr.ne.0) then
     514          write(*,*) "Error: Failed to allocate ctl(ctllength)"
     515          write(*,*) "     ctllength=",ctllength
     516          stop
     517        endif
     518        ierr=NF_GET_VAR_REAL(infid,tmpvarid,ctl)
     519        if (ierr.ne.NF_NOERR) then
     520          stop "Error: Failed reading controle"
     521        endif
     522      endif
     523    endif
     524  endif
    474525else
    475526  ierr=NF_INQ_VARID(infid,"controle",tmpvarid)
     
    943994     ierr=NF_INQ_VARID(infid,"teta",tmpvarid)
    944995     if (ierr.ne.NF_NOERR) then
    945        write(*,*) "Error: Failed to get temp, t or teta ID"
    946        have_temp=.false.
    947        if (ztype.ne.1) stop
     996       ierr=NF_INQ_VARID(infid,"temperature",tmpvarid)
     997       if (ierr.ne.NF_NOERR) then
     998          write(*,*) "Error: Failed to get temp, t, teta or temperature ID"
     999          have_temp=.false.
     1000          if (ztype.ne.1) stop
     1001       endif
    9481002     endif
    9491003       ierr=NF_GET_VAR_REAL(infid,tmpvarid,teta)
Note: See TracChangeset for help on using the changeset viewer.