NCL Home > Documentation > Tools

nhlf90

nhlf90 is a script that invokes the FORTRAN 90 compiler/linker with the proper NCAR Graphics LLU (low-level utility) and HLU (high-level utility) libraries. There are special options recognized by this script. All other arguments and options are identical to the "gfortran" or "f90" command on your particular machine; arguments that include quoted strings may have to be enclosed in single quotes.

If you don't want to use nhlf90, but you want to see what libraries it pulls in, you can type "nhlf90" on the command line to see what gets included in the link line. You can then you can add this information to your own Makefile or script.

In order to run nhlf90, you must have your NCARG_ROOT environment variable set to the directory pathname where the NCAR Graphics libraries, binaries, and include files were installed. If you are not sure what NCARG_ROOT should be set to, please check with your system administrator, or send email to ncl-talk.

Note that, on some systems, if you supply your own binary libraries in addition to the ones automatically referenced by , all the libraries must have been created in a similar fashion.

See also nhlf77 or nhlcc for compiling Fortran 77 or C programs.

See ng4ex for a script that provides you with access to tons of Fortran HLU example programs.

Modifying nhlf90

It is possible to modify nhlf90 directly if you need to change anything from the compiler it's using, compiler options, libraries being linked in, etc.

The script resides in $NCARG_ROOT/bin. You can either edit it directly (be careful if you do this, especially if other people are using it), or you can copy it to your own directory and modify it as necessary. It's a C-shell script that is pretty easy to follow.

Some things you might want to change are:

The compiler used:

set f77       = "gfortran"

Fortran compile options:

set loadflags  = "-fPIC -fno-range-check "

C-to-Fortran libraries needed, or to add a "-L" path to the given libraries:

set f77libs  = "-lgfortran"

List of cairo libraries:

set cairolib = "-lcairo -lfontconfig -lpixman-1 -lfreetype -lexpat"

List of NetCDF libraries:

set extra_libs = "$extra_libs -lnetcdf -lcurl -lhdf5_hl -lhdf5 -lsz -lz"

Options

  • -ngmath

    Links in the NCAR Graphics ngmath library.

  • -cairo (Available in version 5.2.0 and later.)

    Links in the cairo libraries. This is necessary if you want your graphical output to go to the cairo PS, PDF, or PNG output formats.

  • -netcdf

    Links in the netCDF library. This library is not part of NCL, so check with your system administrator if you need it installed. You can obtain a copy of it on the Unidata NetCDF website.

  • -ncarbd

    Use this option for compilers that appear to be having trouble initializing blockdata variables. It will cause a small subroutine to be linked in that helps force the loading of blockdata initialization routines. This should no longer be an issue in version 5.1.1 or later.

  • -ngmathbd

    Just like with the "-ncarbd" option, use this option for compilers that appear to be having trouble initializing Ngmath-related blockdata variables. It will cause a small subroutine to be linked in that helps force the loading of Ngmath blockdata initialization routines.

    Note: this option doesn't need to be specified separately if you are already including the "-ncarbd" and "-ngmath" options.

Examples

To compile an HLU Fortran 90 program called "cn01f.f" and create an executable called "cn01f", type:

  nhlf90 -o cn01f cn01f.f

To compile an HLU Fortran 90 program called "xy06f.f" that depends on the NetCDF library, type:

  nhlf90 xy06f.f -netcdf

This will create an executable called "a.out".