Compiling wgrib2 with netcdf-4 8/2020: NetCDF4 support has been in shambles for many years. The good news, Redhat with its vintage compilers has been working fine. If you are using the Intel compilers, it compiles and probably works. (I have heard no complaints but number of users is extremely small.) I had no problems with Ubuntu 12.04LTS until it lost support. I had to move to something newer like Ubuntu 18.04LTS. Now for the bad news. HDF5 would not compile with the default gnu compilers and needed something from the GNU 4.xx series. Finally hdf5 10.6.0 was released with support for not-so-old gnu compilers. I could now compile hdf5 on my unbuntu 18.04 system. Being able to provide NetCDF4 support was looking better. Unfortunately hdf5 10.6.0 breaks the -import_netcdf option on my Redhat system with the vintage compilers. Maybe I made a mistake with my netcdf calls, the only error message is that hdf5 had a problem. It's not helpful. I had convert my personal copy back to hdf 10.4.0 to get some scripts working. 8/2020: There is not support for netcdf4. You may be able to get netcdf4 to work with gnu 4.xx compilers. You may be able to use the system installed netcdf4 libraries. However, you are on your own in modifying the makefiles to already installed netcdf4 libraries. You are on your own in verifying that wgrib2 is working correctly with your system libraries. Configuration: In the makefile, change the configuration to USE_NETCDF3=0 USE_NETCDF4=1 Then you have to set the environment variables to the C and F90 compilers and run gnu make. (bash example) export CC=gcc (set the C compiler) export FC=gfortran (set the f90 compiler) make (on some machines this gnu make could be called gmake) The make will respond with an error message that you need to get the netcdf4 source code. You can get the source code using wget. make (on some machines this gnu make could be called gmake) The make will respond with another error message that you need to get the hdf5 source code. You can get the source code using wget. make (third time is a charm) This has been tested with gcc/gfortran and clang/gfortran on Ubuntu 12.04 (64 bits) and with gcc/fortran on Redhat 5 and 6 (64-bits). Notes: UCAR has a web page with help in compiling netcdf.