The netCDF library : Différence entre versions

De LMDZPedia
Aller à : navigation, rechercher
(Page créée avec « == the NetCDF library == The model reads and writes input and output files in NetCDF (Network Common Data Form) format (developed and maintained by Unidata: https://www.un... »)
 
Ligne 18 : Ligne 18 :
  
 
=== Install via a system manager ===
 
=== Install via a system manager ===
 +
If on Ubuntu (and with admin, i.e. ''sudo'' rights) you can try
 +
<syntaxhighlight lang="bash">
 +
sudo apt install libnetcdff-dev
 +
</syntaxhighlight>
 +
 +
=== Personal installation ===
 +
One can always download the source code and compile the NetCDF library (see https://docs.unidata.ucar.edu/netcdf-c/current/faq.html#HowdoIgetthenetCDFsoftwarepackage ). You can use the following home-made "install_netcdf4_hdf5_seq.bash" script to do so. For this, ensure that you are in your home directory:
 +
<syntaxhighlight lang="bash">
 +
mkdir netcdf
 +
cd netcdf
 +
wget -nv --no-check-certificate http://www.lmd.jussieu.fr/~lmdz/pub/import/install_netcdf4_hdf5_seq.bash
 +
chmod u=rwx install_netcdf4_hdf5_seq.bash
 +
./install_netcdf4_hdf5_seq.bash > netcdf.log 2>&1
 +
</syntaxhighlight>
 +
Compiling the library and dependencies can take a while (>>15 minutes; be patient).
 +
Once this is done, check file netcdf.log to verify that all went well.
 +
You may want to also add its "bin" directory to your PATH environment variable by adding in your .bashrc a line of:
 +
<syntaxhighlight lang="bash">
 +
export PATH=$PATH:$HOME/netcdf/bin
 +
</syntaxhighlight>
 +
The assumption here is that you have run the "install_netcdf4_hdf5_seq.bash" script in a "netcdf" subdirectory of your home directory. Adapt accordingly if not.
 +
 +
 +
03/01/2022
 +
 +
[[Category:HowTo]]
 +
[[Category:WhatIs]]

Version du 3 janvier 2023 à 13:43

the NetCDF library

The model reads and writes input and output files in NetCDF (Network Common Data Form) format (developed and maintained by Unidata: https://www.unidata.ucar.edu/software/netcdf/ ) and therefore a NetCDF library must be at hand when compiling and running LMDZ6.

As this library is not quite standard, chances are that you might need to install it yourself on your system (note that the install_lmdz.sh default behavior is to download and install that library), hence this page with some indications on how to do so.

Checking if a NetCDF library is already available

It is possible that the library, including its Fortran component, is already available. An easy way to check this is to see if the related utilities like ncdump are available, i.e. that

which ncdump

returns a positive answer.

Note that this does not suffice as the full library, including its Fortran component, and not just the related utilities are required. A neat way to check this is to use the nf-config

nf-config --all

returns something meaningful. If not, you probably need to take some action along the lines of what is indicated in the following sections.

Install via a system manager

If on Ubuntu (and with admin, i.e. sudo rights) you can try

sudo apt install libnetcdff-dev

Personal installation

One can always download the source code and compile the NetCDF library (see https://docs.unidata.ucar.edu/netcdf-c/current/faq.html#HowdoIgetthenetCDFsoftwarepackage ). You can use the following home-made "install_netcdf4_hdf5_seq.bash" script to do so. For this, ensure that you are in your home directory:

mkdir netcdf
cd netcdf
wget -nv --no-check-certificate http://www.lmd.jussieu.fr/~lmdz/pub/import/install_netcdf4_hdf5_seq.bash
chmod u=rwx install_netcdf4_hdf5_seq.bash
./install_netcdf4_hdf5_seq.bash > netcdf.log 2>&1

Compiling the library and dependencies can take a while (>>15 minutes; be patient). Once this is done, check file netcdf.log to verify that all went well. You may want to also add its "bin" directory to your PATH environment variable by adding in your .bashrc a line of:

export PATH=$PATH:$HOME/netcdf/bin

The assumption here is that you have run the "install_netcdf4_hdf5_seq.bash" script in a "netcdf" subdirectory of your home directory. Adapt accordingly if not.


03/01/2022