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

Support for netCDF-C version 4.9.0

cfm

New member
Good morning,

I am trying to install the WRF model following the instructions from the online tutorial webpage, which makes use of netcdf 4.1.3. I am having some problems getting this library installed, maybe because it is a very old version.

I would like to ask if the WRF model can make use of netCDF4.9.0 instead and if I could get configuration instructions for it.

Thank you very much
 
Yes the WRF can use netcdf 4.9 without any issues.

Which version of linux are you using?
 
Thanks for the fast reply,

I am using Ubuntu version 20.04 LTS, Linux L18064 5.10.102.1-microsoft-standard-WSL2
 
This is adapted from one of my self install wrf scripts but it should give you an idea on how to install NETCDF

Bash:
##############################Install NETCDF C Library############################
cd $HOME/WRF/Downloads
tar -xzvf v4.9.0.tar.gz
cd netcdf-c-4.9.0/
export CPPFLAGS=-I$DIR/grib2/include
export LDFLAGS=-L$DIR/grib2/lib
export LIBS="-lhdf5_hl -lhdf5 -lz -lcurl -lgfortran -lgcc -lm -ldl"
CC=$MPICC FC=$MPIFC CXX=$MPICXX F90=$MPIF90 F77=$MPIF77 ./configure --prefix=$DIR/NETCDF --disable-dap --enable-netcdf-4 --enable-netcdf4 --enable-shared
make -j $CPU_HALF_EVEN
make -j $CPU_HALF_EVEN install
#make check

export PATH=$DIR/NETCDF/bin:$PATH
export NETCDF=$DIR/NETCDF

##############################NetCDF fortran library############################
cd $HOME/WRF/Downloads
tar -xvzf v4.6.0.tar.gz
cd netcdf-fortran-4.6.0/
export LD_LIBRARY_PATH=$DIR/NETCDF/lib:$LD_LIBRARY_PATH
export CPPFLAGS="-I$DIR/NETCDF/include -I$DIR/grib2/include"
export LDFLAGS="-L$DIR/NETCDF/lib -L$DIR/grib2/lib"
export LIBS="-lnetcdf -lm -lcurl -lhdf5_hl -lhdf5 -lz -ldl"
CC=$MPICC FC=$MPIFC CXX=$MPICXX F90=$MPIF90 F77=$MPIF77 ./configure --prefix=$DIR/NETCDF --enable-netcdf-4 --enable-netcdf4 --enable-shared
make -j $CPU_HALF_EVEN
make -j $CPU_HALF_EVEN install
#make check
 
Hello again,
I have not yet been able to install the NetCDF library. I have tried the suggested commands and many others, I am not sure if the errors are caused because the libraries are divided into two installations. I am completely new to Linux so that is not helping me find the errors.
 
Hi,
Installing netCDF with two libraries should not be an issue as long as you're putting everything in the same directory, as is suggested in the configure commands above. Since our group doesn't maintain or support the netCDF libraries, we may not be able to help, but if you provide the steps you're taking, along with the error(s) you're getting, we can try to take a look.
 
Hi all,
I install nercdf-c-4.9 & netcdf-fortran via homebrew (also tried macport, but still same error): cp: /Users/username/Build_WRF/LIBRARIES/netcdf/NetCDF/include/netcdf.inc: No such file or directory

Changed clang to homegrew gcc.
I have been struggled to install WRF-ARW for near two weeks (8 hours per day), but still can't figured it out.

These are my steps:

#set env variables
export CC=gcc
export CXX=g++
export FC=gfortran
export FCFLAGS=-m64
export F77=gfortran
export FFLAGS=-m64
export JASPERLIB=/Users/username/Build_WRF/LIBRARIES/grib2/lib
export JASPERINC=/Users/username/Build_WRF/LIBRARIES/grib2/include
export LDFLAGS=-L/Users/username/Build_WRF/LIBRARIES/grib2/lib
export CPPFLAGS=-I/Users/username/Build_WRF/LIBRARIES/grib2/include
export PATH=/Users/username/Build_WRF/LIBRARIES/netcdf/NetCDF/bin:$PATH
export NETCDF=/Users/username/Build_WRF/LIBRARIES/netcdf/NetCDF
export PATH=/Users/username/Build_WRF/LIBRARIES/mpich/bin:$PATH
export NCDIR=/Users/username/Build_WRF/LIBRARIES/netcdf
export LD_LIBRARY_PATH=${NCDIR}/lib:${LD_LIBRARY_PATH}
export NFDIR=/Users/username/Build_WRF/LIBRARIES/netcdf

#build netcdf
tar xzvf netcdf-c-4.9.0.tar.gz
cd netcdf-c-4.9.0
./configure --prefix=/Users/username/Build_WRF/LIBRARIES/netcdf --disable-dap --disable-netcdf-4 --disable-shared
make
make install
cd ..


#build zlib
tar xzvf zlib-1.2.7.tar.gz
cd zlib-1.2.7
./configure --prefix=/Users/username/Build_WRF/LIBRARIES/grib2
make
make install
cd ..

#build libpng
tar xzvf libpng-1.2.50.tar.gz
cd libpng-1.2.50
./configure --prefix=/Users/username/Build_WRF/LIBRARIES/grib2
make
make install
cd ..

#build jasper
tar xzvf jasper-1.900.1.tar.gz
cd jasper-1.900.1
./configure --prefix=/Users/username/Build_WRF/LIBRARIES/grib2
make
make install
cd ..


"cd" into the TESTS directory then
tar -xf Fortran_C_NETCDF_MPI_tests.tar
cp ${NETCDF}/include/netcdf.inc .

output:
cp: /Users/username/Build_WRF/LIBRARIES/netcdf/NetCDF/include/netcdf.inc: No such file or directory


Almost every “make install”, there is output like this:
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.


Is this related to why there isn’t NetCDF under netcdf?
 
Hi,
Try installing NetCDF-c and NetCDF-fortran separately. Take a look at this new FAQ I just posted that includes a full example of an installation I used (keep in mind these work for my environment and may need to be altered for yours).
Great new FAQ
 
Hi,
Try installing NetCDF-c-4.9 and NetCDF-fortran separately. Take a look at this new FAQ I just posted that includes a full example of an installation I used (keep in mind these work for my environment and may need to be altered for yours).
Hi, thanks for your reply. All my posts are based on installed netcdf-c & ndtcdf-fortran separately. But I'll try this. So I ignored what I have done before, just need to follow this post to re-install all? (I was struggle to compile WRF for almost two weeks, so it's better to ask you before I do anything).

source .bashrc
My Mac runs zsh, so do I need to change the code to fit zsh OR do I need to convert zsh to bash? (I'm totally new to terminal)
 
Compiling NetCDF is usually a meticulous process. Have you considered using Spack? I recommend setting up an environment, either for WRF or as a NetCDF stack. You can then enable the installed packages by either 1) manually adding paths (not recommended), 2) using `spack load` (works well enough, but you have to "load" spack first), or 3) building LMOD modules (which I recommend). Spack will also help you build a container, if you are so inclined.
 
Compiling NetCDF is usually a meticulous process. Have you considered using Spack? I recommend setting up an environment, either for WRF or as a NetCDF stack. You can then enable the installed packages by either 1) manually adding paths (not recommended), 2) using `spack load` (works well enough, but you have to "load" spack first), or 3) building LMOD modules (which I recommend). Spack will also help you build a container, if you are so inclined.
Hi there, I didn't try Spack before, it's my first time knowing this. I installed Homebrew and Macports (although I'm now too sure what they are, just I need WRF, so installed these.) If I install Spack, will Spack conflict with Homebrew or Macports? I only need WRF works on my Mac intel.
 
Hi there, I didn't try Spack before, it's my first time knowing this. I installed Homebrew and Macports (although I'm now too sure what they are, just I need WRF, so installed these.) If I install Spack, will Spack conflict with Homebrew or Macports? I only need WRF works on my Mac intel.
Netcdf fortran has a major problem with Mac compatibility.

See this post

 
Netcdf fortran has a major problem with Mac compatibility.

See this post

Hi Will, I just tried again, I changed 'source .bashrc' to 'source .zshrc' & 'source ~/.zshrc', and both showed me no such directory. I also listed hidden files, no zshrc file. Any other ideas to make this work?
 
Hi Will, I just tried again, I changed 'source .bashrc' to 'source .zshrc' & 'source ~/.zshrc', and both showed me no such directory. I also listed hidden files, no zshrc file. Any other ideas to make this work?
Morning,

Unfortunately I don't think it will work on Mac until unidata fixes there code.

I'm going to try and see if I can find a solution that is relatively easy for everyone using mac
 
Morning,

Unfortunately I don't think it will work on Mac until unidata fixes there code.

I'm going to try and see if I can find a solution that is relatively easy for everyone using mac
Oh, Mac users do need this. Thanks Will, hope you can figure it out. Finger-cross!! I’ll also search for it.
 
Top