Error when running regional_esg_grid

Total Noob with UFS here, but lots of WRF experience.  Also, I don't know if I should post here or in the SRW  forum?  Anyways, I've built everything for SRW successfully and am using the standalone scripts to run the preprocessing workflow (ufs-srweather-app/regional_workflow/ush/wrappers), but when running, I get a "error Invalid argument".  The message output previous looks like this...

arcx, arcy  24.0569 14.5016
For lam=    0.80 the best [smallest possible]
optimality criterion, Q, for this domain:  0.453511E-04
The corresponding optimal A and K:   0.1156  -0.3476
The corresponding m_arcx,y:  0.4167189652257E+00  0.2524146128930E+00
x and y central grid resolution in map units:  0.19473E-02  0.19567E-02
Get additional diagnostics from hgrid_ak_rr
  check netcdf status=          22
error Invalid argument

For whatever reason, the file doesn't get created.  Any help would be appreciated as I've been stuck on this for a few days.  Thanks,


Hey Mike,

This is the relevant block of code in regional_esg_grid.f90:

use netcdf
integer,intent(in) :: status
if(status /= nf90_noerr) then
  write(0,*)' check netcdf status=',status
  write(0,'("error ", a)')trim(nf90_strerror(status))
  stop "Stopped"

This is the "check" subroutine which verifies the output of regional_esg_grid, so it looks like something went wrong with netCDF.  We may need to get the author of this code involved, but before doing that, can you increase the number of nodes/cores you are providing this job?  It could be a memory issue.



I think it's the most recent.  From ufs-srweather-app/Externals.cfg

protocol = git
repo_url =
tag = ufs-v1.0.1
local_path = regional_workflow
required = True

protocol = git
repo_url =
tag = ufs-v2.0.0
local_path = src/UFS_UTILS
required = True

protocol = git
repo_url =
tag = ufs-v2.0.0
local_path = src/ufs_weather_model
required = True

protocol = git
repo_url =
tag = upp_v9.0.1
local_path = src/EMC_post
required = True

schema_version = 1.0.0




In reply to by jbeck

I tried it using 24 cores on one of the compute nodes as well as 2 nodes.  No luck.  My installation is not a Level 1 or 2, but a New Platform, so there is a (good?)chance that I've not set it up correctly.  I followed the instructions to change all the regional_workflow/scripts to use mpirun, which seems to work as the /ufs-srweather-app/bin/regional_esg_grid exe did run, as you referenced above.

thank you.




Can you check the rest of your log file for other warnings or errors that occur prior to this netCDF check?  There may be additional information above the error you ran into that show problems with the system setup, for example.


Hi Mike,

To better pinpoint where in the code the error is occurring, you can try putting in some print statements before/between/after the

call check(...)

statements starting on line ~111 of regional_esg_grid.f90.  Maybe do that for the first batch of those statements and see if the problem is there; if not, continue to the next batch, etc.  I suspect it might be the very first one, i.e.

call check( nf90_create("", NF90_64BIT_OFFSET, ncid) )

maybe due to the wrong version of NetCDF.  



In reply to by gerard.ketefian


You were right about the version of NetCDF.  I put in a call to get the version and build date, and it's from my WRF install!

 4.1.3 of Jul  1 2020 11:48:44

I think the mistake was that I didn't reset the NETCDF env variable to the NCEPLIBS_external NetCDF.  Once I fix that, I would assume I have to start over and build NCEPLIBS again, and then ufs-srweather-app. 

Thanks a lot!



Good, sounds like progress!  I would guess you're right about rebuilding NCEPLIBS, but I'm not 100% sure since I usually use a pre-compiled version of NCEPLIBS.  Give that a shot and if it doesn't work, let us know.  There are a couple of others on our team that can guide you through that part.



In reply to by gerard.ketefian

So I resolved the issues with NetCDF, but now a new problem crops up when doing 'make' in NCEPLIBS.  I'm considering deleting NCEPLIBS and NCEPLIBS-external and starting over from scratch as I must have screwed something up.




CMake Error at /cm/shared/apps/cmake/gcc/3.18.0/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
Call Stack (most recent call first):
  /cm/shared/apps/cmake/gcc/3.18.0/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
  /cm/shared/apps/cmake/gcc/3.18.0/share/cmake-3.18/Modules/FindJasper.cmake:39 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:25 (find_package)

-- Configuring incomplete, errors occurred!
See also "/ipchome/mleuthold/NCEPLIBS-ufs-v2.0.0/src/NCEPLIBS/g2/src/g2-build/CMakeFiles/CMakeOutput.log".
make[2]: *** [g2/src/g2-stamp/g2-configure] Error 1
make[1]: *** [CMakeFiles/g2.dir/all] Error 2
make: *** [all] Error 2



In reply to by leuthold

Hi Mike,

I asked a couple of my colleagues who know more about building NCEPLIBS to take a look.  Hopefully they'll get around to it soon.  In the meantime, please let us know if starting over worked.


Mike, if you have not done so already, it may be worth re-building from scratch...if parts of the NCEPLIBS were built with a mis-match of libraries (some from NCEPLIBS-external, and some from your WRF build) then there may be complicated problems with the libraries that would be most quickly solved by a "nuke-and-rebuild" approach. 

Out of curiosity's sake, does your machine make use of modules, or was the environment for NCEPLIBS set up with the "" script?