Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Compiling when NETCDF C and Fortran are in Different Directories

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.


New member
Dear Users,

Has anyone had success building WRF when netcdf-c and netcdf-fortran are installed in different directories? For context, I'm building in an HPC environment, so there are pre-built NETCDF libraries I'd like to link to. I've seen others on this forum run into the same issue, but I haven't come across a posted solution yet.

Thanks for the help,
Hi John,
I spoke to our software engineers and they agree that the best work-around for this problem is to follow these steps:
1) Create your own "netcdf_mine" (or whatever name you want) directory.
2) Inside that directory, create directories "lib," "include," and "bin."
3) Go into each of those and link all files from the corresponding separate netcdf-c and netcdf-fortran lib/include/bin directories into the new directories, so that they are now all under a single top-level directory.
4) Add the path to netcdf_mine/bin to your PATH, and set your NETCDF environment variable to your_path/netcdf_mine.

Then WRF should be able to find everything it needs. Let me know if any of those steps are not clear.