wrf-model / WRF

The official repository for the Weather Research and Forecasting (WRF) model
Other
1.22k stars 674 forks source link

WRF v4.0.1 configuration warning about NETCDF #794

Closed zhihua-zheng closed 1 year ago

zhihua-zheng commented 5 years ago

I have netcdf-c and netcdf-fortran built with nc4 support, but in different directories. With my variable NETCDF was initially set as the path to netcdf-fortran, the configuration of WRF returned a warning message:

NETCDF4 IO features are requested, but this installation of NetCDF
  /opt/netcdf_fortran/4_4_4/intel
DOES NOT support these IO features.

Please make sure NETCDF version is 4.1.3 or later and was built with
--enable-netcdf4

OR set NETCDF_classic variable
   bash/ksh : export NETCDF_classic=1
      echo  csh : setenv NETCDF_classic 1

Then re-run this configure script

!!! configure.wrf has been REMOVED !!!

What I did to resolve this is to make links for netcdf-c and netcdf-fortran, then put them together according to the /lib, /include, /bin structure, and update the variable NETCDF as the path to the new directory.

weiwangncar commented 5 years ago

@zhihua-zheng Try to set environment variable NETCDF_classic as suggested by the message before you run configure again. In the future, this should be posted to WRF Forum at http://forum.mmm.ucar.edu. Thanks.

davegill commented 5 years ago

@weiwangncar Wei, There are some utilities that require WRF to be built with netcdf4. We used to have some build logic to look for the netcdf and netcdff libs. We might need to consider how to handle netcdf installations that have separated C and Fortran directories.

mgduda commented 5 years ago

I've also run into problems when the netCDF-4 library is build with support for parallel I/O via HDF5. If we were to significantly overhaul the logic in the configure script for detecting netCDF libraries, we could also consider the potential need to add -lhdf5_hl -lhdf5 -lz.

It might also be worth trying to leverage the output of nc-config --flibs (although this is broken at the moment, as it doesn't report a dependency on the parallel-netCDF library even when netCDF was build with support for pnetcdf).

JiaweiZhuang commented 5 years ago

FYI, EasyBuild has a patch to separate NetCDF C and Fortran directories: https://github.com/easybuilders/easybuild-easyconfigs/blob/master/easybuild/easyconfigs/w/WRF/WRF-3.5_netCDF-Fortran_separate_path.patch

agumartina commented 5 years ago

I had the same problem, with WRF master branch. Checked the _nc4test.log and saw many libs errors with HDF5 and PNETCDF, so I checked in configure that $(USENETCDF) was assigned only -lnetcdf flag, so i chaged that variable to USENETCDF="-lnetcdf -lhdf5_hl -lhdf5 -lz -lcurl -lmpi -lpnetcdf" and it worked :)

milancurcic commented 5 years ago

Just chiming in as I ran into this issue this morning with WRF-4.1.1. netcdf-c and netcdf-fortran by default install libraries to lib64/ rather than lib/ (this is on some kind of OpenSUSE I believe). Having NetCDF libs in lib64/ triggers the warning regarding NetCDF4 fetures, despite nc-config assuring otherwise. Linking lib64/ to lib/ makes the warning go away.

A pedantic nit-pick: If the NetCDF4 warning doesn't allow the configure to complete (i.e. "configure.wrf has been removed"), it should be called an error.

lgeorget commented 5 years ago

We had the same issue on a Debian install because we wanted to use the libnetcdf-dev package from the package manager. The problem is that the installer puts the libnetcdf.so library in /usr/lib/x86_64-linux-gnu/ instead of /usr/lib so the USENETCDF variable is not populated properly. We were able to get the configuration to finish correctly by replacing $(USENETCDF) in the Makefile by the output of pkg-config --libs netcdf.

razib911 commented 4 years ago

NETCDF4 IO features are requested, but this installation of NetCDF
/home/razib/Build_WRF/LIBRARIES/netcdf DOES NOT support these IO features.

Please make sure NETCDF version is 4.1.3 or later and was built with
--enable-netcdf4

OR set NETCDF_classic variable
bash/ksh : export NETCDF_classic=1 echo csh : setenv NETCDF_classic 1

Then re-run this configure script

!!! configure.wrf has been REMOVED !!

I am very new to WRF and Ubuntu. I am trying to install WRFV4.2, using Ubuntu 18LTS, got stuck here while ./configure on WRFv4.2.

I tried to understand the replies but failed. Can anybody tell me how to solve this with an example (command lines)?

davegill commented 4 years ago

@razib911 First, welcome to WRF.

Second, please take a look at the WRF forum web page: forum.mmm.ucar.edu. That site is specifically set up for user questions. The github site is more for source code bugs.

Third, repost this question on the WRF Forum.

Fourth, did you perhaps try to set the environment variables as suggested? Do not answer here, but include all of this information in the post to the forum. This allows others with a similar problem to search to see the solution.

opoplawski commented 4 years ago

I would also very much appreciate WRF not assuming that libraries are in a sub-directory of a NETCDFPATH (or HDF5PATH or whatever) called "lib". We need to be able to specify the library directory directly. OpenHPC for example uses the following environment variables:

setenv          NETCDF_DIR        /opt/ohpc/pub/libs/intel/openmpi4/netcdf/4.7.3
setenv          NETCDF_BIN        /opt/ohpc/pub/libs/intel/openmpi4/netcdf/4.7.3/bin
setenv          NETCDF_LIB        /opt/ohpc/pub/libs/intel/openmpi4/netcdf/4.7.3/lib
setenv          NETCDF_INC        /opt/ohpc/pub/libs/intel/openmpi4/netcdf/4.7.3/include
setenv          NETCDF_FORTRAN_DIR        /opt/ohpc/pub/libs/intel/openmpi4/netcdf-fortran/4.5.2
setenv          NETCDF_FORTRAN_BIN        /opt/ohpc/pub/libs/intel/openmpi4/netcdf-fortran/4.5.2/bin
setenv          NETCDF_FORTRAN_LIB        /opt/ohpc/pub/libs/intel/openmpi4/netcdf-fortran/4.5.2/lib
setenv          NETCDF_FORTRAN_INC        /opt/ohpc/pub/libs/intel/openmpi4/netcdf-fortran/4.5.2/include

I would suggest using those variable names for looking for items.

davegill commented 4 years ago

@opoplawski Orion, A number of users have mentioned issues similar to this. Would you be interested in working on the pull request?

davegill commented 4 years ago

@razib911 Have you taken a look at https://github.com/davegill/wrf-coop/blob/master/README_tutorial.md For small desktop systems, docker may be a reasonable choice.

opoplawski commented 4 years ago

@opoplawski Orion, A number of users have mentioned issues similar to this. Would you be interested in working on the pull request?

Possibly - I'll see if I can scrape together some time.

davegill commented 4 years ago

@opoplawski This will be a modification to "develop". Take a look at: https://github.com/wrf-model/WRF/wiki/Workflow-for-WRF-Code-Modification

Where there are differences with the bug fix and the new feature (develop branch), use the develop branch options.

irowebbn commented 4 years ago

From what I can observe, the specific thing causing the problem is lines 178-203 of the configure script. If the $NETCDF environment variable is pointing to the NetCDF-Fortran folder, it links to the fortran libraries, if it points to the NetCDF-C folder, it links to those libraries. However, WRF needs both, and since NetCDF 4.2, the C and Fortran libraries are distributed separately. The netcdf.inc file is only in the Fortran distribution, so if you link to the C libraries, later the config script complains (lines 637-643). If you link to the Fortran libraries, a bunch of utilities can't get build because they need the C libraries. Somehow, we need to change the section below so the user can set both $NETCDF and $NETCDFF so they are not mutually exclusive.

USENETCDFF=""
USENETCDF=""
if [ -n "$NETCDF" ] ; then
  echo "Will use NETCDF in dir: $NETCDF"
# Oh UNIDATA, why make it so hard ...
  if [ -f "$NETCDF/lib/libnetcdff.a" -o -f "$NETCDF/lib/libnetcdff.so" -o -f "$NETCDF/lib/libnetcdff.dll.a" ] ; then
    USENETCDFF="-lnetcdff"
  else
    USENETCDFF=" "
  fi
  if [ -f "$NETCDF/lib/libnetcdf.a" -o -f "$NETCDF/lib/libnetcdf.so" -o -f "$NETCDF/lib/libnetcdf.dll.a" ] ; then
    USENETCDF="-lnetcdf"
  else
    USENETCDF=" "
  fi
  export USENETCDF=$USENETCDF
  export USENETCDFF=$USENETCDFF
else
  echo ' '
  echo '*****************************************************************************'
  echo 'No environment variable NETCDF set.'
  echo 'Stopping'
  echo '*****************************************************************************'
  echo ' '
  exit 6
fi
zemboy commented 1 year ago

I need help. This error message appears when installing WRF_4.1 in my ubunu 22.04.
** W A R N I N G **** NETCDF4 IO features are requested, but this installation of NetCDF
/usr DOES NOT support these IO features.

Please make sure NETCDF version is 4.1.3 or later and was built with
--enable-netcdf4

OR set NETCDF_classic variable
bash/ksh : export NETCDF_classic=1 echo csh : setenv NETCDF_classic 1

Then re-run this configure script

!!! configure.wrf has been REMOVED !!!


razib911 commented 1 year ago

Hello

Please use one of the following:

bash/ksh : export NETCDF_classic=1 echo csh : setenv NETCDF_classic 1

Then re-configure wrf.

Problem is in the netCDF installation or configuration. If you set this classic=1, you will not see this error.

regards Razib PhD Candidate University of Quebec in Montreal Montreal, Canada


From: zemboy @.> Sent: Thursday, March 16, 2023 1:30:29 PM To: wrf-model/WRF @.> Cc: Vhuiyan, Md Razib @.>; Mention @.> Subject: Re: [wrf-model/WRF] WRF v4.0.1 configuration warning about NETCDF (#794)

I need help. This error message appears when installing WRF_4.1 in my ubunu 22.04. ** W A R N I N G **** NETCDF4 IO features are requested, but this installation of NetCDF /usr DOES NOT support these IO features.

Please make sure NETCDF version is 4.1.3 or later and was built with --enable-netcdf4

OR set NETCDF_classic variable bash/ksh : export NETCDF_classic=1 echo csh : setenv NETCDF_classic 1

Then re-run this configure script

!!! configure.wrf has been REMOVED !!!


— Reply to this email directly, view it on GitHubhttps://github.com/wrf-model/WRF/issues/794#issuecomment-1472406095, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APOMTKHZETJ7OHHTKGL3HRLW4NE3LANCNFSM4G2MIU6A. You are receiving this because you were mentioned.Message ID: @.***>

zemboy commented 1 year ago

Hello

Thank you very much for your help. In which directory should I place myself to execute the code: export NETCDF_classic=1?

weiwangncar commented 1 year ago

@zemboy It should be in your working terminal. This message and further discussion should be posted in Forum: https://forum.mmm.ucar.edu/.