Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • N Nemo
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Graph
    • Compare
  • Issues 72
    • Issues 72
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • NEMO WorkspaceNEMO Workspace
  • Nemo
  • Issues
  • #37
Closed
Open
Issue created Apr 04, 2022 by Tomas Lovato@tlovatoDeveloper

Wrong parsing of filename in call to iom_open by agrif zooms

When agrif zoom(s) open input or restart files with iom_open the grid prefix substitution is automatically done in iom.F90

      clname   = trim(cdname)
      IF ( .NOT. Agrif_Root() .AND. .NOT. lliof ) THEN
         iln    = INDEX(clname,'/')
         cltmpn = clname(1:iln)
         clname = clname(iln+1:LEN_TRIM(clname))
         clname=TRIM(cltmpn)//TRIM(Agrif_CFixed())//'_'//TRIM(clname)
      ENDIF

Unfortunately, when the input file path is different from ./, e.g. absolute path is provided, the grid prefix substitution is placed just after the first occurence of the path separator by iln = INDEX(clname,'/')

Here a practical example for the temperature initial condition, where the input path is '/data/user/input_for_nemo' and the filename is 'WOA18_temperature.nc': the above code will return clname = /1_data/user/input_for_nemo/ORCA025_WOA18_temperature.nc instead of /data/user/input_for_nemo/1_ORCA025_WOA18_temperature.nc

To fix this behaviour and correctly split the pathname and the basename, INDEX function should be carried out in backwarddirection applying the following fix

diff --git a/src/OCE/IOM/iom.F90 b/src/OCE/IOM/iom.F90
index dbccf2c..f6ac95b 100644
--- a/src/OCE/IOM/iom.F90
+++ b/src/OCE/IOM/iom.F90
@@ -751,7 +751,7 @@ CONTAINS
       ! =============
       clname   = trim(cdname)
       IF ( .NOT. Agrif_Root() .AND. .NOT. lliof ) THEN
-         iln    = INDEX(clname,'/')
+         iln    = INDEX(clname,'/', BACK=.TRUE.)
          cltmpn = clname(1:iln)
          clname = clname(iln+1:LEN_TRIM(clname))
          clname=TRIM(cltmpn)//TRIM(Agrif_CFixed())//'_'//TRIM(clname)
Edited Apr 04, 2022 by Nicolas Martin
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking