Opened 11 months ago

Last modified 11 months ago

#3442 new error

Error reading namelist JULES_MODEL_GRID

Reported by: jmackay Owned by: jules_support
Component: JULES Keywords: jules model grid error
Cc: Platform: Other
UM Version:


Hello and happy new year,

I’ve been racking my brains since before Christmas as to how to overcome an error I’m getting when trying to run a 1D JULES model. I get the following error:

“[FATAL ERROR] init_model_grid: Error reading namelist JULES_MODEL_GRID (IOSTAT=-1 IOMSG=End of file)”

The model is set to run on a 1D grid with two grid points (npoints=2). I’ve set the model up uses rose/cylc so I feel the JULES_MODEL_GRID namelist should be set up correctly and I’m not sure what the IOSTAT error message is indicating. Do you have any idea what I’m doing wrong here? Any ideas would be greatly appreciated as I’m quite stuck on this. I’ve attached my rose config file for JULES with the namelists in case this helps.

Many thanks for your time


Attachments (1)

rose-app.conf (23.1 KB) - added by jmackay 11 months ago.
Rose suite configuration

Download all attachments as: .zip

Change History (18)

Changed 11 months ago by jmackay

Rose suite configuration

comment:1 Changed 11 months ago by pmcguire

  • Cc g.m.s.lister@… removed

comment:2 Changed 11 months ago by pmcguire

Hi Jonathan:
The JULES documentation at
says that when you want to use 'grid_is_1d=TRUE', that you then need to define 'grid_dim_name' for the variable in your NETCDF file. But I don't see that definition in your rose-app.conf file. And I don't have your NETCDF file to check it. Can you try definition that variable?

Version 0, edited 11 months ago by pmcguire (next)

comment:3 Changed 11 months ago by jmackay

Hi Patrick,

Thanks for the reply and help with this. I've tried setting the grid_dim_name variable, but I still get the same error. Note, I've set all of the dimension names to their "default" names so I don't think I need to specify any of these anyway. Is that right? I presume that if you don't specify a variable, JULES assumes you're using the default. If so, it shouldn't throw the error on reading the namelist. Am I right in thinking this?

Note, I don't specify the dimension names for the jules_land_frac and the jules_latlon namelists, but JULES reads them in (and the netcdf files associated with them) with no problem.

I've attached my initial conditions netcdf file in case this might help.

Many thanks


comment:4 Changed 11 months ago by pmcguire

Hi Jon
I don't see the attachments for your NETCDF files. Do you have the 'land' variable named in those files?

comment:5 Changed 11 months ago by jmackay

Sorry, the attachment facility doesn't seem to be working. I've made the file available via CITRIX sharefile here:

comment:6 Changed 11 months ago by pmcguire

Hi Jon:
I downloaded your file. I don't see a variable called 'land' in the file. Does your other file have a variable called 'land' in it?

comment:7 Changed 11 months ago by jmackay

Hi Patrick,

Land is a dimension, not a variable


comment:8 Changed 11 months ago by pmcguire

Hi Jon:
Yes, you are right. Sorry for the confusion on my part.
What is the name of the variable in your land_frac file? You don't define the name 'land_frac_name' in your namelist file, as required for more than 1 land point. What happens when you define that name properly in your namelist file?

Last edited 11 months ago by pmcguire (previous) (diff)

comment:9 Changed 11 months ago by jmackay

Hi Patrick,

I've tried this, but still the error. As with the dimension names, I used the default variable name so defining the default name in the namelist didn't make any difference.

FYI, this shows some of the last messages form the stdout (you'll see the latlon and land fraction data all read in correctly, but it doesn't like the jules_model_grid namelist options for some reason?

[INFO] init_latlon: Reading JULES_LATLON namelist…
[INFO] init_latlon: Getting latitude and longitude for the full input grid…
[INFO] init_latlon: Data is on a grid - reading latitude and longitude from file /users/joncka/roses/point_glacier/file/
[INFO] file_ncdf_open: Opening file /users/joncka/roses/point_glacier/file/ for reading
[INFO] file_ncdf_close: Closing file /users/joncka/roses/point_glacier/file/
[INFO] init_land_frac: Reading JULES_LAND_FRAC namelist…
[INFO] init_land_frac: Getting land fraction for the full input grid…
[INFO] init_land_frac: Data is on a grid - reading land fraction from file /users/joncka/roses/point_glacier/file/
[INFO] file_ncdf_open: Opening file /users/joncka/roses/point_glacier/file/ for reading
[INFO] file_ncdf_close: Closing file /users/joncka/roses/point_glacier/file/
[INFO] init_model_grid: Reading JULES_MODEL_GRID namelist…

Thanks for the continued help with this


comment:10 Changed 11 months ago by pmcguire

Hi Jon
Have you tried looking at the JULES FORTRAN code for reading the JULES_MODEL_GRID namelist?
Another suggestion is to put some print statements in the that part of the code to see what's going wrong.

comment:11 Changed 11 months ago by jmackay

Hi Patrick,

No I haven't looked at the source code. I've been trying to avoid this as I'm not familiar with it. Any ideas where I should look?


comment:12 Changed 11 months ago by pmcguire

Hi Jon:
You can do a grep through the source code directories for things that are printed in the stdout and stderr. For example, you can use grep to search for init_model_grid or JULES_MODEL_GRID.

comment:13 Changed 11 months ago by jmackay

Hi Patrick,

I've done this and found where the error is thrown in the source code. As you suggested, it's in the file. It's where the code calls the fortran READ function to read the namelist file. Here's the line in the code:

READ(namelist_unit, nml=jules_model_grid, IOSTAT=error, IOMSG=iomessage)

Note the IOSTAT output from READ which indicates if the read call was successful. A value of 0 indicates success, +ve indicates error and -ve indicates it reached the end of the file.

READ is called hundreds of times in the JULES code (for every namelist) and it seems to work for all of them until it gets to reading the JULES_MODEL_GRID namelist. The reason - because it ISOTAT returns negative i.e. for some reason, when reading this namelist it thinks it's reached the end of the file (when in fact it's nowhere near the end).

Note, after every call of READ, the JULES code has the following check, hence why it throws the error:

IF ( error /= 0 ) &

CALL log_fatal("init_model_grid", &

"Error reading namelist JULES_MODEL_GRID " &
TRIM(to_string(error)) " IOMSG=" &
TRIM(iomessage) ")")

I've tried creating a new namelist file, but no luck, it still throws the error.

I've also checked to make sure there's no dodgy special characters in the file (e.g. if some windows end of line characters have crept in somewhere)…again, nothing.

Here's something interesting though. I tried changing the error check in the jules code so that it only throws the error if ISOTAT > 0 (i.e. it ignores the end of line error). It successfully reads in the JULES_MODEL_GRID namelist! See the model output here:

[INFO] init_model_grid: Reading JULES_MODEL_GRID namelist…
[INFO] init_model_grid: Setting up model grid variables…
[INFO] init_model_grid: From the points specified, only land points will be modelled
[INFO] decompose_domain: Decomposing domain across 1 available tasks
[INFO] decompose_domain: Tasks are arranged as a grid of size 1 x 1
[INFO] init_model_grid: Size of model grid - 2 x 1
[INFO] init_model_grid: Selected grid contains 2 land points
[INFO] init_surf_hgt: Reading JULES_SURF_HGT namelist…

However, it then throws the same "end of file" error when trying to get the parameters for the next namelist (JULES_SURF_HGT).

So I guess, one solution would be to edit all of the error checks for every namelist in the code so that it doesn't throw an error if it thinks it's reached the end of the file. Somehow though, that solution isn't very satisfying. I'm still keen to find out how to get it to work without hacking the source code apart.

Any ideas!?

comment:14 Changed 11 months ago by pmcguire

Hi Jon
I recall that JULES uses the rose-app.conf​ files to make .nml files in a sub-sub-subdirectory of the ~/cylc-run for your suite for each of the namelists. Maybe you can look at this namelist files for a case when it runs correctly and for a case when it doesn't run correctly, checking for hidden characters that might be there, and checking that there isn't some obvious error for the jules_surf_hgt and jules_model_grid namelist files?

You shouldn't need to change the code to get it to work, there is probably some mistake in the namelists.

Can you possibly run this as a normal suite on JASMIN? It would be much easier to support you there.

comment:15 Changed 11 months ago by jmackay

Hi Patrick,

I've checked the actual .nml files. you can find the model_grid.nml file here:

It looks fine to me!

comment:16 Changed 11 months ago by jmackay

In case anyone is interested, I've not been able to get this model to run without the error. However, when I started from scratch (i.e. compiled new rose suite), it worked so I can only assume that there was something wrong with the rose configuration file for JULES. Thanks for the help all.

comment:17 Changed 11 months ago by pmcguire

Hi Jonathan:
I am glad you got it working!
What were the differences between the non-working suite and the working suite?
You can do a cd roses; diff -r suite1 suite2 to see what the differences are.

Note: See TracTickets for help on using tickets.