unable to open existing NetCDF file GET GRID

Report or discuss software problems and other woes

Moderators: arango, robertson

Post Reply
Message
Author
c.drinkorn
Posts: 110
Joined: Thu Mar 08, 2018 2:47 am
Location: German Research Centre for Geosciences

unable to open existing NetCDF file GET GRID

#1 Unread post by c.drinkorn »

Hi everyone!

I am sure this is trivial but I am lacking experience:

When trying to run the DAMEE_4 test case I receive the following error in the output file
INITIAL: Configuring and initializing forward nonlinear model ...
*******
Found Error: 02 Line: 6565 Source: ROMS/Modules/mod_netcdf.F, netcdf_open

NETCDF_OPEN - unable to open existing NetCDF file:
~/roms/Projects/damee_4/Data/netcdf3/damee4_grid_a.nc
call from: ROMS/Utility/get_grid.F
Found Error: 03 Line: 79 Source: ROMS/Utility/get_grid.F

GET_GRID - unable to open grid NetCDF file: ~/roms/Projects/damee_4/Data/netcdf3/damee4_grid_a.nc

GET_GRID - unable to open grid NetCDF file: ~/roms/Projects/damee_4/Data/netcdf3/damee4_grid_a.nc

GET_GRID - unable to open grid NetCDF file: ~/roms/Projects/damee_4/Data/netcdf3/damee4_grid_a.nc

GET_GRID - unable to open grid NetCDF file: ~/roms/Projects/damee_4/Data/netcdf3/damee4_grid_a.nc
Found Error: 03 Line: 271 Source: ROMS/Nonlinear/initial.F
Node # 3 CPU: 0.089
Node # 2 CPU: 0.089
Found Error: 03 Line: 188 Source: ROMS/Drivers/nl_ocean.h
What could be the reason?

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: unable to open existing NetCDF file GET GRID

#2 Unread post by kate »

GET_GRID - unable to open grid NetCDF file: ~/roms/Projects/damee_4/Data/netcdf3/damee4_grid_a.nc
Is this the correct path to this file? Do you have the file? Can you view it in ncview so that you know it wasn't corrupted?

c.drinkorn
Posts: 110
Joined: Thu Mar 08, 2018 2:47 am
Location: German Research Centre for Geosciences

Re: unable to open existing NetCDF file GET GRID

#3 Unread post by c.drinkorn »

Yes, it is there and I can open it with ncview. All variables are in it and it seems alright.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: unable to open existing NetCDF file GET GRID

#4 Unread post by kate »

The file reading failed here:
Found Error: 02 Line: 6565 Source: ROMS/Modules/mod_netcdf.F, netcdf_open
What you want is the error code from the netcdf library. You can get it with
this code:

Code: Select all

            status=nf90_open(TRIM(ncname), nf90_nowrite, ncid)
            IF (FoundError(status, nf90_noerr, __LINE__,                &
     &                     __FILE__ //                                  &
     &                     ", netcdf_open")) THEN
              IF (Master) WRITE (stdout,10) TRIM(ncname), TRIM(SourceFile)
              PRINT *, trim(nf90_strerror(status))
              exit_flag=3
              ioerror=status
END IF
Note the nf90_strerrror call. Then, you can look in netcdf.inc in the error
codes section:
parameter (nf_noerr = 0)
parameter (nf_ebadid = -33)
parameter (nf_eexist = -35)
parameter (nf_einval = -36)
parameter (nf_eperm = -37)
parameter (nf_enotindefine = -38)
parameter (nf_eindefine = -39)
parameter (nf_einvalcoords = -40)
parameter (nf_emaxdims = -41)
parameter (nf_enameinuse = -42)
parameter (nf_enotatt = -43)
parameter (nf_emaxatts = -44)
parameter (nf_ebadtype = -45)
parameter (nf_ebaddim = -46)
parameter (nf_eunlimpos = -47)
parameter (nf_emaxvars = -48)
parameter (nf_enotvar = -49)
parameter (nf_eglobal = -50)
parameter (nf_enotnc = -51)
parameter (nf_ests = -52)
parameter (nf_emaxname = -53)
parameter (nf_eunlimit = -54)
parameter (nf_enorecvars = -55)
parameter (nf_echar = -56)
parameter (nf_eedge = -57)
parameter (nf_estride = -58)
parameter (nf_ebadname = -59)
parameter (nf_erange = -60)
parameter (nf_enomem = -61)
parameter (nf_evarsize = -62)
parameter (nf_edimsize = -63)
parameter (nf_etrunc = -64)
Actually, the netcdf.h file has a comment for each with just a little more explanation.

c.drinkorn
Posts: 110
Joined: Thu Mar 08, 2018 2:47 am
Location: German Research Centre for Geosciences

Re: unable to open existing NetCDF file GET GRID

#5 Unread post by c.drinkorn »

Thank you, Kate! But where will I have to include it?

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: unable to open existing NetCDF file GET GRID

#6 Unread post by kate »

It is in mod_netcdf.F, routine netcdf_open. It should differ from what you have by just the one line.
OK, so you can add "if (master)" to it too.

c.drinkorn
Posts: 110
Joined: Thu Mar 08, 2018 2:47 am
Location: German Research Centre for Geosciences

Re: unable to open existing NetCDF file GET GRID

#7 Unread post by c.drinkorn »

Ok, I found the section in mod_netcdf.F and it looks like this now:

Code: Select all

IF (FoundError(status, nf90_noerr, __LINE__,                    &
     &                 __FILE__ //                                      &
     &                 ", netcdf_open")) THEN
          WRITE (stdout,10) TRIM(ncname), TRIM(SourceFile)
          PRINT *, trim(nf90_strerror(status))
          exit_flag=3
          ioerror=status
        END IF
There was no "IF (Master)" in front of "WRITE (stdout..." before but trying with or without adding it I can find no netcdf.inc.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: unable to open existing NetCDF file GET GRID

#8 Unread post by kate »

Well, compile it and run it and see what the print statement gives you. It should give an error corresponding to that error code. The netcdf.inc file is off in the netcdf include directory - the ROMS build knows how to find it, that's all you need.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: unable to open existing NetCDF file GET GRID

#9 Unread post by kate »

By admitting that you don't have the "IF (Master)" you are admitting that you don't have Hernan's latest code.

User avatar
arango
Site Admin
Posts: 1361
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: unable to open existing NetCDF file GET GRID

#10 Unread post by arango »

By the way, you don't need to modify that routine. ROMS prints out the NetCDF error code at the end of the standard output file when it closes all the files. Notice that there are NetCDF-3 and NetCDF-4 input files for this application. You may be using the wrong one for the compiled code.

c.drinkorn
Posts: 110
Joined: Thu Mar 08, 2018 2:47 am
Location: German Research Centre for Geosciences

Re: unable to open existing NetCDF file GET GRID

#11 Unread post by c.drinkorn »

It works! :D
After re-compiling and re-running and re-compiling and re-running using Netcdf4 or not using it... I finally figured what the problem was: The path to the grid nc (and apparently all the other input nc files) was wrong. It had to be the absolute path, no home directory shortcuts (or at least not the way I tried it) or such. I did take the different netcdf types into account but since the path was wrong either way, it still gave the error. :roll:
And Hernan was right: At the very end of the Standard Output it actually gives the error explanation: it couldn't find the directory. :lol:
This was trivial but I enjoyed the exciting expedition into the realm of mod_netcdf.F 8)
Thank you very very much the two of you!
Since the simulation is still running since more than 15 minutes now, I assume there are at least no more initial problems...

Post Reply