Main menu


NETCDF issue when porting to a new machine.

3 posts / 0 new
Last post
NETCDF issue when porting to a new machine.


I have some NETCDF issue when porting CESM1_2_2_1 to new machine.

The new machine use module to manage the software.

The NETCDF-C and NETCDF-FORTRAN are installed on different locations.

The admin told me I only need to load the fortran module because  the fortran one depends on the C one.

This is netcdf-fortran module:

 - Homepage:


whatis("Description: NetCDF (network Common Data Form) is a set of software libraries

 and machine-independent data formats that support the creation, access, and sharing of array-oriented

 scientific data.")














I built the model after loading the modules,

I got error when compiling pio,

WARNING: did not find netcdf fortran library

So I add one line in the env_mach_specific:

setenv NETCDF /opt/apps/software/data/netCDF-Fortran/4.4.5-intel-2018.5.274


but it still has another error:-- Could NOT find NETCDF (missing: NETCDF_INCLUDE_DIR)


Even with this warning, the pio build is completed, but it is stuck at building the csm_share.


home/xlong/cesm1_2_2_1/models/drv/shr/seq_io_mod.F90(1170): error #6404: This name does not have a type, and must have an explicit type.   [PIO_UNLIMITED]


      rcode = pio_def_dim(cpl_io_file,'time',PIO_UNLIMITED,dimid(1))



I guess all the errors are due to that the netcdf lib is not set correctly?


Could anyone give some suggestion how to link the netcdf C and fortran library, and also let the model know the location of include files?




Based on the error, even though the pio bld completed I don't think that it worked.  Try setting in env_mach_specific


the remove the bld directory and try again. is not set up to handle seperate netcdf c and fortran directories so you may need to create a directory tree that links the 

installed libs into something that will make sence to the build,  that is create netcdf/lib and netcdf/include directories, from these lnk the files from the netcdf-c and netcdf-fortran 

directories and set netcdf to that newly created directory.   

CESM Software Engineer



I did explicitly set the env varibale :

setenv NETCDF /opt/apps/software/data/netCDF-Fortran/4.4.5-intel-2018.5.274, in the env_mach_specific file

But after doing this, the pio build still say "Could NOT find NETCDF (missing: NETCDF_INCLUDE_DIR)"

As you suggeted,

I should make a local directory like netcdf, the link the files in the netcdf-c/lib, netcdf-c/include, netcdf-fortran/lib, netcdf-fortran/include

I think I also need to link the bin directory ?

So that the model only access netcdf through my local directory?

Log in or register to post comments

Who's new

  • jwolff
  • tinna.gunnarsdo...
  • sarthak2235@...
  • eolivares@...
  • shubham.gandhi@...