I am trying to regrid some of my latitude-longitude grid files to tripolar ocean grid and found that ESMF can be useful. However, I am finding it hard to install the same.
First download the esmf tar file from http://www.earthsystemmodeling.org/esmf_releases/public/ESMF_7_1_0r/reg/ESMF_Framework_Down.html
Then install netcdf library and gfortran compiler using
sudo apt-get install git tcsh pkg-config sudo apt-get install gfortran sudo apt-get install netcdf-bin libnetcdf-dev libnetcdff-dev sudo apt-get install openmpi-bin libopenmpi-dev sudo apt-get install libnetcdff-dev
Once you have the netcdf library and gfortran compiler in your /usr/local/lib and /usr/local/include You can check this also, login as root using
Then define the following environment variables
cd path_of_esmf_dir export ESMF_DIR=path_of_esmf_dir export ESMF_INSTALL_PREFIX=/usr/local/esmf export ESMF_OS=Linux export ESMF_NETCDF="local" export ESMF_COMM=mpiuni export ESMF_F90COMPILER=gfortran export ESMF_CXXCOMPILER=g++ export ESMF_TESTEXHAUSTIVE=on export ESMF_TESTSHAREDOBJ=on export ESMF_NETCDF_INCLUDE=/usr/local/include export ESMF_NETCDF_LIBS="-lnetcdf -lnetcdff" export ESMF_NETCDF_LIBPATH=/usr/local/lib export ESMF_BOPT=O3
Then run the following syntax to make the library ESMF
make all make install make installcheck
Now to install the ESMF python library
cd path_to_esmf_dir/addon/ESMpy/ python setup.py build --ESMFMKFILE=/usr/local/esmf/lib/libO3/Linux.gfortran.64.mpiuni.default/esmf.mk python setup.py install
You can check the installation by
$ python >>> import ESMF
ESMF python library has got limited features as compared to the ESMF library. Hence it is better to use ESMF directly.
Actually, you probably shouldn't install it. If you're comfortable using Linux, then you would be better advised to use the docker container instead, with it already installed. That way your system stays clean and you can have someone else maintain it for you.
Check docker hub for different versions and find the one you like (here).
Install docker using:
curl -LSs get.docker.com | sh
There are plenty of simple docker tutorials that will help you work out how to use it.