NetCDF is a set of software libraries and self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data.
Load the appropriate modules on bionic and/or use the system version on focal. Note that in newer versions of the NetCDF software, the C library and Fortran interface are distributed as separate packages with separate version numbers. The Fortran interface depends on the C interface.
The 'compilertype' needs to match the compiler family you want to use, eg 'intel' for Intel compilers. Once you have loaded the modules, the nc-config and nf-config commands will tell you how to link the library.
Installed via spack, although these days the distro packages are probably fine too