Difference between revisions of "GENIE Using netCDF"
Genie-user (talk | contribs) |
Genie-user (talk | contribs) |
||
Line 11: | Line 11: | ||
The Unidata webpage contains links to documentation describing installing and using the libraries. However, the quickstart below, may be enough to get you going. Note that it's far easier if you use the same fortran compiler to compile both GENIE and the NetCDF libraries. If you do not, then you will need to become familiar with compiler options which deal with the topic of "name mangling" (enough said). Note that you will also most likely fair better with an upto date copy of the NetCDF libraries. | The Unidata webpage contains links to documentation describing installing and using the libraries. However, the quickstart below, may be enough to get you going. Note that it's far easier if you use the same fortran compiler to compile both GENIE and the NetCDF libraries. If you do not, then you will need to become familiar with compiler options which deal with the topic of "name mangling" (enough said). Note that you will also most likely fair better with an upto date copy of the NetCDF libraries. | ||
− | # First of all unpack the gzipped tar file which you downloaded, e.g. | + | # First of all unpack the gzipped tar file which you downloaded, e.g. '''tar -xzf netcdf-3.6.0-p1.tar.gz''' |
− | # Change directory to that containing the source code, e.g. | + | # Change directory to that containing the source code, e.g. '''cd netcdf-3.6.0-p1/src''' |
# The libraries are written in C and Fortran. You need to set some environment variables to tell the installation process which compilers you are using. On my Linux system, using gcc to compile the C code and ifort for the Fortran, I typed the following in my bash shell: | # The libraries are written in C and Fortran. You need to set some environment variables to tell the installation process which compilers you are using. On my Linux system, using gcc to compile the C code and ifort for the Fortran, I typed the following in my bash shell: | ||
− | #*export CC=gcc | + | #*'''export CC=gcc''' |
− | #*export FC=ifort | + | #*'''export FC=ifort''' |
− | #*export CPPFLAGES="-DpgiFortran" | + | #*'''export CPPFLAGES="-DpgiFortran"''' |
− | # Now run the ''configure'' script. You can use the "--prefix" option to choose where to install the libraries. For example, "--prefix=/opt/local" will cause files to be placed in /opt/local/lib, opt/local/bin and /opt/local/include. | + | # Now run the '''configure''' script. You can use the "--prefix" option to choose where to install the libraries. For example, "--prefix=/opt/local" will cause files to be placed in /opt/local/lib, opt/local/bin and /opt/local/include. |
− | # Finally run ''make'' and then ''make install''. | + | # Finally run '''make''' and then '''make install'''. |
# Check that you have the created all the files you need. You should see ''libnetcdf.a'' in the your installation lib directory. For Fortran90 support, you will also need ''netcdf.mod'' in the include directory. | # Check that you have the created all the files you need. You should see ''libnetcdf.a'' in the your installation lib directory. For Fortran90 support, you will also need ''netcdf.mod'' in the include directory. |
Revision as of 15:22, 18 January 2007
What is NetCDF? and why use it?
NetCDF is fast becoming the de facto standard format for storing climate model data. It is a 'platform independent' format and so is good for sharing data between members of the community. The format is also flexible in what can be stored and self-documenting--two more very useful features. There is of course some overhead in learning any new file format, but I believe that using NetCDF is well worth the relatively small amount of effort involved.
Obtaining the NetCDF Libraries
You can download the source code for the NetCDF libraries from the Unidata NetCDF web page.
Quickstart: Compiling the NetCDF libraries
The Unidata webpage contains links to documentation describing installing and using the libraries. However, the quickstart below, may be enough to get you going. Note that it's far easier if you use the same fortran compiler to compile both GENIE and the NetCDF libraries. If you do not, then you will need to become familiar with compiler options which deal with the topic of "name mangling" (enough said). Note that you will also most likely fair better with an upto date copy of the NetCDF libraries.
- First of all unpack the gzipped tar file which you downloaded, e.g. tar -xzf netcdf-3.6.0-p1.tar.gz
- Change directory to that containing the source code, e.g. cd netcdf-3.6.0-p1/src
- The libraries are written in C and Fortran. You need to set some environment variables to tell the installation process which compilers you are using. On my Linux system, using gcc to compile the C code and ifort for the Fortran, I typed the following in my bash shell:
- export CC=gcc
- export FC=ifort
- export CPPFLAGES="-DpgiFortran"
- Now run the configure script. You can use the "--prefix" option to choose where to install the libraries. For example, "--prefix=/opt/local" will cause files to be placed in /opt/local/lib, opt/local/bin and /opt/local/include.
- Finally run make and then make install.
- Check that you have the created all the files you need. You should see libnetcdf.a in the your installation lib directory. For Fortran90 support, you will also need netcdf.mod in the include directory.