Installation instructions¶
Attention
The long list of requirements may seem daunting but on many standard linux distributions they should be relatively easy to fulfill. Here it is assumed that Linux is used.
This package requires:
Core requirements¶
- Python 2.7.x.
- A recent version of the netCDF4 library.
- ESGF credentials.
Before proceeding further, are you willing to use a 3rd party Linux Distribution (Free for Academic Use)?
- If yes, follow the instructions Installing python and netCDF4 from a distribution
- If no, follow the instructions Installing python and netCDF4 from source
At this point in the installation, it is assumed that you have a working python distribution with the netCDF4 python package compiled.
Installing this package: cdb_query¶
This package can be installed with pip
:
$ pip install cdb_query
Warning
If you are using a virtual environment, you must always source $HOME/python/bin/activate
BEFORE
using cdb_query
. If you are using Anaconda, you must activate it (see Installing python and netCDF4 from a distribution).
Obtaining ESGF credentials¶
This package allows you to obtain and manage ESGF credentials transparently. The only actions a user should take is
- Register at https://pcmdi.llnl.gov/user/add/?next=https://pcmdi.llnl.gov/projects/esgf-llnl/. When registering, you will create a password and receive an openid.
- Go to https://pcmdi.llnl.gov/esg-orp/home.htm and login with your openid using your password.
- Go to https://pcmdi.llnl.gov/esg-orp/registration-request.htm?resource=http%3A%2F%2Fpcmdi.llnl.gov%2Fthredds%2FfileServer%2Fesg_testroot%2Fregister%2Fcmip5_research.nc. Your browser will likely ask you to trust some certificates. CLICK ALWAYS ALLOW. If you don’t do this, it won’t work.
- Register for CMIP5 Research. You do not need to download data.
- If using https://ceda.ac.uk instead of https://pcmdi.llnl.gov, your username must be passed along your openid when using cdb_query.
Note
Previously the authentication would use local certificates. This option is still available but will be deprecated in the future.
Secondary tools used in the recipes¶
netCDF Operators (NCO)¶
Some of the recipes make use of NCO. These recipes were tested using version 4.4.3 linked against the netcdf libraries built from anaconda and from Installing python and netCDF4 from source. Please consult the project’s webpage for information on how to install: http://nco.sourceforge.net/.
These recipes were tested using the NCO built using the BASH script found in BASH script to compile and install NCO on CentOS
Climate Data Operators (CDO)¶
The netCDF4 files generated by cdb_query are not compatible with CDO. NCO can be used to extract variables and remove the hierarchical structure. The retrieved data will then be compatible with CDO. With all the installed libraries, CDO is relatively easy to install.
JASPER¶
You will need to first install jasper:
$ wget http://www.ece.uvic.ca/~frodo/jasper/software/jasper-1.900.1.zip
$ unzip jasper-1.900.1.zip
$ cd jasper-1.900.1
$ ./configure --with-pic --prefix=$HOME/local/jasper-1.900.1
$ make
$ make install
PROJ¶
Next, you will need proj:
$ wget http://download.osgeo.org/proj/proj-4.8.0.tar.gz
$ tar xvfz proj-4.8.0.tar.gz
$ cd proj-4.8.0
$ ./configure --without-jni --prefix=$HOME/local/proj-4.8.0
$ make check
$ make install
CDO¶
Finally, you are ready to install CDO:
$ wget --no-check-certificate https://code.zmaw.de/attachments/download/7220/cdo-1.6.3.tar.gz
$ tar xvfz cdo-1.6.3.tar.gz
$ cd cdo-1.6.3
$ ./configure --prefix=$HOME/local/cdo-1.6.3 \
--with-proj=$HOME/local/proj-4.8.0 \
--with-jasper=$HOME/local/jasper-1.900.1 \
--with-netcdf=$HOME/anaconda/ \
--with-hdf5=$HOME/anaconda/ \
--with-zlib=$HOME/anaconda/ \
-enable-cgribex=no CFLAGS=-DHAVE_LIBNC_DAP
$ make
$ make install
This installation installs CDO in $HOME/local/cdo-1.6.3/bin
and this directory should be added to your path.
You can check that everything was done ok:
$ cdo -V
Climate Data Operators version 1.6.3 (http://code.zmaw.de/projects/cdo)
Compiler: gcc -std=gnu99 -DHAVE_LIBNC_DAP -pthread
version: gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)
Compiled: (x86_64-unknown-linux-gnu)
Features: PTHREADS NC4 OPeNDAP SZ Z JASPER UDUNITS2 PROJ.4
Libraries: proj/4.8
Filetypes: srv ext ieg grb grb2 nc nc2 nc4 nc4c
CDI library version : 1.6.3
GRIB_API library version : 1.11.0
netCDF library version : 4.3.1-rc2
HDF5 library version : 1.8.11
SERVICE library version : 1.3.1
EXTRA library version : 1.3.1
IEG library version : 1.3.1
FILE library version : 1.8.2
The Features line indicates that netCDF4 files are accepted, OPeNDAP links can be read and that compressed variables can be created (SZ, Z).