Ignore:
Timestamp:
Mar 9, 2026, 10:29:53 AM (4 days ago)
Author:
jbclement
Message:

PEM:

  • Introduction of a configurable display/logging system with options 'out2term', 'out2log', 'verbosity_lvl'. All messages now use verbosity levels ('LVL_NFO', 'LVL_WRN', 'LVL_ERR' and 'LVL_DBG').
  • Code encapsulation improvements with systematic privacy/protection of module variables.
  • Addition of workflow safety checks for required executables, dependencies (e.g. 'ncdump'), input files and callphys keys.
  • Renaming of PEM starting and diagnostic files ("startevol.nc" into "startevo.nc", "diagevol.nc" into "diagevo.nc").

JBC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/evolution/io_netcdf.F90

    r4090 r4110  
    3232character(11), parameter :: start1D_name   = 'start1D.txt'
    3333character(10), parameter :: startfi_name   = 'startfi.nc'
    34 character(12), parameter :: startpem_name  = 'startevol.nc'
     34character(11), parameter :: startpem_name  = 'startevo.nc'
    3535character(19), parameter :: xios_day_name1 = 'Xoutdaily4pem_Y1.nc'  ! XIOS daily output file, second to last PCM year
    3636character(19), parameter :: xios_day_name2 = 'Xoutdaily4pem_Y2.nc'  ! XIOS daily output file, last PCM year
    3737character(20), parameter :: xios_yr_name1  = 'Xoutyearly4pem_Y1.nc' ! XIOS yearly output file, second to last PCM year
    3838character(20), parameter :: xios_yr_name2  = 'Xoutyearly4pem_Y2.nc' ! XIOS yearly output file, last PCM year
    39 character(11), parameter :: diagevol_name  = 'diagevol.nc'
     39character(10), parameter :: diagevo_name   = 'diagevo.nc'
    4040
    4141! VARIABLES
    4242! ---------
    43 logical(k4), private :: open_ncfile = .false.   ! Flag to true if a NetCDF file is already open
    44 logical(k4), private :: open_diagevol = .false. ! Flag to true if "diagevol.nc" is already open
    45 integer(di), private :: ncid_file               ! File ID
    46 integer(di), private :: varid                   ! Variable ID
    47 integer(di)          :: ncid_diagevol           ! File ID specific to "diagevol.nc"
     43logical(k4), protected, private :: open_ncfile = .false.  ! Flag to true if a NetCDF file is already open
     44logical(k4), protected, private :: open_diagevo = .false. ! Flag to true if "diagevo.nc" is already open
     45integer(di), protected, private :: ncid_file              ! File ID
     46integer(di), protected, private :: varid                  ! Variable ID
     47integer(di)          :: ncid_diagevo           ! File ID specific to "diagevo.nc"
    4848
    4949! INTERFACES
     
    8282! DEPENDENCIES
    8383! ------------
    84 use display, only: print_err
     84use display, only: print_msg, LVL_ERR
    8585
    8686! ARGUMENTS
     
    106106else
    107107    if (.not. tmp_found) then
    108         call print_err(trim(nf90_strerror(ierr)))
     108        call print_msg(trim(nf90_strerror(ierr)),LVL_ERR)
    109109        call stop_clean(__FILE__,__LINE__,'NetCDF error when '//trim(msg),ierr)
    110110    end if
     
    142142! ----
    143143! Diagevol logic
    144 if (adjustl(trim(filename)) == diagevol_name) then
     144if (adjustl(trim(filename)) == diagevo_name) then
    145145    if (adjustl(trim(mode)) == 'read') then
    146146        call stop_clean(__FILE__,__LINE__,'opening mode "read" cannot be used with '//trim(filename)//'"!',1)
    147147    else if (adjustl(trim(mode)) == 'write') then
    148         if (.not. open_diagevol) then
    149             call check_nc(nf90_open(trim(filename),nf90_write,ncid_diagevol),'opening file '//trim(filename)//' to write')
     148        if (.not. open_diagevo) then
     149            call check_nc(nf90_open(trim(filename),nf90_write,ncid_diagevo),'opening file '//trim(filename)//' to write')
    150150            if (present(itime)) call get_next_itime_nc('Time',itime) ! Next time index
    151             open_diagevol = .true.
     151            open_diagevo = .true.
    152152        end if
    153153        return
     
    201201! CODE
    202202! ----
    203 if (adjustl(trim(filename)) == diagevol_name) then ! Diagevol logic
    204     call check_nc(nf90_close(ncid_diagevol),'closing file '//trim(filename))
    205     open_diagevol = .false.
     203if (adjustl(trim(filename)) == diagevo_name) then ! Diagevol logic
     204    call check_nc(nf90_close(ncid_diagevo),'closing file '//trim(filename))
     205    open_diagevo = .false.
    206206else ! Standard logic
    207207    call check_nc(nf90_close(ncid_file),'closing file '//trim(filename))
     
    288288! ----
    289289! Diagevol logic priority over standard logic
    290 if (open_diagevol) then
    291     ncid = ncid_diagevol
     290if (open_diagevo) then
     291    ncid = ncid_diagevo
    292292else
    293293    ncid = ncid_file
     
    547547! ----
    548548! Diagevol logic priority over standard logic
    549 if (open_diagevol) then
    550     ncid = ncid_diagevol
     549if (open_diagevo) then
     550    ncid = ncid_diagevo
    551551else
    552552    ncid = ncid_file
     
    611611! ----
    612612! Diagevol logic priority over standard logic
    613 if (open_diagevol) then
    614     ncid = ncid_diagevol
     613if (open_diagevo) then
     614    ncid = ncid_diagevo
    615615else
    616616    ncid = ncid_file
     
    682682! ----
    683683! Diagevol logic priority over standard logic
    684 if (open_diagevol) then
    685     ncid = ncid_diagevol
     684if (open_diagevo) then
     685    ncid = ncid_diagevo
    686686else
    687687    ncid = ncid_file
     
    753753! ----
    754754! Diagevol logic priority over standard logic
    755 if (open_diagevol) then
    756     ncid = ncid_diagevol
     755if (open_diagevo) then
     756    ncid = ncid_diagevo
    757757else
    758758    ncid = ncid_file
     
    824824! ----
    825825! Diagevol logic priority over standard logic
    826 if (open_diagevol) then
    827     ncid = ncid_diagevol
     826if (open_diagevo) then
     827    ncid = ncid_diagevo
    828828else
    829829    ncid = ncid_file
     
    942942! ----
    943943! Diagevol logic priority over standard logic
    944 if (open_diagevol) then
    945     ncid = ncid_diagevol
     944if (open_diagevo) then
     945    ncid = ncid_diagevo
    946946else
    947947    ncid = ncid_file
     
    10271027! ----
    10281028! Diagevol logic priority over standard logic
    1029 if (open_diagevol) then
    1030     ncid = ncid_diagevol
     1029if (open_diagevo) then
     1030    ncid = ncid_diagevo
    10311031else
    10321032    ncid = ncid_file
     
    11121112! ----
    11131113! Diagevol logic priority over standard logic
    1114 if (open_diagevol) then
    1115     ncid = ncid_diagevol
     1114if (open_diagevo) then
     1115    ncid = ncid_diagevo
    11161116else
    11171117    ncid = ncid_file
     
    11971197! ----
    11981198! Diagevol logic priority over standard logic
    1199 if (open_diagevol) then
    1200     ncid = ncid_diagevol
     1199if (open_diagevo) then
     1200    ncid = ncid_diagevo
    12011201else
    12021202    ncid = ncid_file
     
    12821282! ----
    12831283! Diagevol logic priority over standard logic
    1284 if (open_diagevol) then
    1285     ncid = ncid_diagevol
     1284if (open_diagevo) then
     1285    ncid = ncid_diagevo
    12861286else
    12871287    ncid = ncid_file
Note: See TracChangeset for help on using the changeset viewer.