Error in metgrid.exe (WRF-4.2.1)

Hi everyone, I am trying to run WRF-4.2.1 model and encountering with an error while running WPS-4.2 - metgrid.exe, error is as below:

Processing domain 1 of 3
Processing 2017-07-01_00
ERROR: Error in ext_pkg_write_field
application called MPI_Abort(MPI_COMM_WORLD, 0) - process 0
[unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=0
system msg for write_line failure : Bad file descriptor

The data that I have downloaded are in grib2 format.

Any comment or possible solution would help a lot!

This is more of a WRF Users support issue unfortunately.

I would be happy to look over your namelist.wps and Vtable to make sure these are correct if you post or make accessible. And give some testing ideas.

Have you used the NAM dataset before with the same version of WPS/ungrib/metgrid?

How large are your Ungrib files?

Can you provide a sample of Ungrib run? Just to look at the standard ensure all variables are in the Grib file.

And if you had the ability to load your specific files for me to test, I would be happy.

Otherwise the error above is not very clear at least to me.

Thanks, Rob

1 Like

Thank you Dear Rob for your support.

I was running WRF for 3 nested domain (12-4-1km) using GFS data for July2017 for the first time (the first 14 days).

I’ve uploaded some files I thought might be useful to fix the error.

namelist.wps.txt (1.4 KB)
Vtable.GFS.txt (8.4 KB)
ungrib.log.txt (1.5 MB)
metgrid.log.txt (18.8 KB)

I don’t see anything in the outputs or namelists that help me diagnose this issue. And I’m having computer issues that keep me off our system so cannot do any testing until next week.

Have you successfully used this version of WPS for other domains or is this the first time?

If you have success with Metgrid for other domains or times, have you used this version of GFS?


I have successfully used WPS-4.2/WRF-4.2.1 for running 2023 GFS data for one domain but they were not in grib2 format. Now I am trying to use archived GFS data for July2017 which are in grib2 format.

I’ll patiently wait for you to resolve your computer issue.

This is not a Grib2 issue IMO. You run Ungrib and that reads Grib2 inputs and writes those data in the intermediate file format you specify as something like “grib2:2017-07-01_00”

If you have these intermediate files from Ungrib then the Grib2 step is complete. Metgrid just reads the intermediate files.

While I used a different year of GFS (2016) for a test, I had no issues. Furthermore, it appears your error is initiated at the time the met_em* files are being written. Below is the log from my metgrid run and you see your error starts at the red mark I put on the screenshot.

I’ve not see this before. And it is impossible for me to test unless I have your Ungrib files. Some potential causes would be write permissions in the directory where this is ran or lack of disk space.

If you could upload your grib2:2017-07-01_00 file somewhere where I could download I’d be happy to test.

You could add this to the namelist and direct your metgrid outputs to a different directory.

out_format = ‘WPS’,
prefix = ‘GFS’,

fg_name = ‘GFS’
io_form_metgrid = 2,
opt_output_from_metgrid_path = ‘/work/MOD3DEV/grc/WPS4.0/domains/test_wrf’
opt_metgrid_tbl_path = ‘/work/MOD3DEV/grc/WPS4.0/metgrid/’,

Dear Rob,

Thank you for your respond.

Actually I guessed it was related to linking wrong Vtable, so instead of linking Vtable.GFS I linked Vtable.NAM and finally I was able to successfully run metgrid.exe.


Great! Best of luck.

1 Like