[v4.0.x] Creating restart files from AGRIF nest

Dear all,

I am trying to create restart files for my AGRIF nest, I use the agrif_create_restart.exe tool, and at first it seems to work: some fields are indeed created and they look good (i.e.: they look like an interpolation of the given field on the higher resolution nest).
But at some point I get this kind of error: unable to store variable ssu_m in file
I thought it was a disk or memory issue at first, but it does not help to increase memory or disk space.
Any idea ?

Thanks for your help,


You may have reached the maximum size of the netcdf file ?

Hei Jêrome,

It crashes after printing one 2D field, and the size of the file is 20M…


Hi Robinson, That error message is issued by io_netcdf.f90 (tools/NESTING/src). There are about five possibilities where the return status from a netcdf call is checked against nf90_strerror but its actual value is not reported. You will get more information if you add :

         write(*,*) trim(nf90_strerror(status))

to those checks.

My guess is that you’ve got some NaNs in that field.

Thanks Andrew, it is very helpful. I will first check for the NaNs, it’s very possible indeed.


Otherwise, you switch to NEMO_4.2_RC: You can set the initial state online, directly interpolated from parent… :wink:

Moui… this looks cool but i already have a Nemo4 running with good results. I’d rather keep it for now… :slight_smile:

ok, now it works… i will not tell you why it did not work because i’m a bit ashamed, ok i tell you, there was no more disk space (but it was not that easy to see because of some group permission… so i have kinda have an excuse but thanks Andrew for letting me know about the error messages…).
But it does not work fully because my 1_restart.nc file stops being created when it reaches 2.5 GB. Since it’s a “classic” file I guess this makes sense, maximum size.
Do you know of any workaround without changing the code ? I compiled the agrif tools with the same arch file as that for Nemo4 which itself creates huge netcdf files all the time and like a charm…

Thanks !! :slight_smile:

And one extra precision, what is strange is that all the AGRIF file created before (domain_cfg.nc etc…) are in Netcdf 4.
So it works to create Netcdf 4 with the AGRIF tools…

ok, so i found the solution. Pretty simple actually, one just needs to tell the code to write a netcdf4 file and then it works, here is the fix:

--- agrif_create_restart.f90    (revision 12672)
+++ agrif_create_restart.f90    (working copy)
@@ -99,7 +99,7 @@
   ! create this file
   CALL set_child_name(restart_file,Child_file)
-  status = nf90_create(Child_file,NF90_WRITE,ncid)
+  status = nf90_create(Child_file,NF90_NETCDF4,ncid)
   status = nf90_close(ncid)
   WRITE(*,*) 'Child grid restart file name = ',TRIM(Child_file)      
   WRITE(*,*) ''

Thanks Robinson. That’s indeed something I went through, which explains my first post. Please, write a ticket !

I would like to, but I never managed to verify my email on Trac: it never sends me the token to do so…