Skip to content

Commit

Permalink
Update to v2.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
erget committed Oct 21, 2016
1 parent 9dd786e commit 60da590
Show file tree
Hide file tree
Showing 94 changed files with 2,131 additions and 1,858 deletions.
146 changes: 105 additions & 41 deletions INSTALLING
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
1/2013 General Installation
4/2016 General Installation

Quick Directions for the Default Configuration
"Any color that you like as long as it's black"
Quick Directions for the Default Configuration
"Any color that you like as long as it's black"

Download source code from

Expand Down Expand Up @@ -37,30 +37,34 @@ Try executing wgrib2

Copy wgrib2 to SOMEPLACE

cygwin/linux/unis: cp wgrib2/wgrib2 SOMEPLACE
cygwin/linux/unix: cp wgrib2/wgrib2 SOMEPLACE


Not So Quick Directions
So you want some options
Not So Quick Directions
So you want some options


Edit the file "makefile" and select the desired options:

# netcdf3: write netcdf files with netcdf-3 library
# netcdf4: write netcdf files with netcdf-4 library
# only one netcdf library can be installed. do not choose netcdf3 and ncdf4
# regex: regular expression package used by (match,not), POSIX-2
# tigge: enable -tigge option for tigge names
# mysql: write to mysql files
# ipolates: fortran interpolation library
# udf: user defined functions
# openmp: use OpemMP to thread the code
# g2clib: install g2clib decoders (allow -g2clib 2)
# openmp: multicore support using OpenMP
# proj4: use proj4 for geolocation
# wmo_validation: used for testing new templates
# fortran_api: fortran api for callable wgrib2, requires a fortran 2003
# feature, subroutines can allocated/deallocated arrays
# disable_timezone: some OS do not handle time zones in POSIX maner
#
# the flags are stored in wgrib2/config.h
#
# Warning do not set both USE_NETCDF3 and USE_NETCDF4 to one

Default options
These are the default options

USE_NETCDF3=1
USE_NETCDF4=0
Expand All @@ -69,60 +73,121 @@ USE_TIGGE=1
USE_MYSQL=0
USE_IPOLATES=0
USE_UDF=0
USE_OPENMP=0
USE_OPENMP=1
USE_PROJ4=0
USE_WMO_VALIDATION=0
DISABLE_TIMEZONE=0
MAKE_FTN_API=0

USE_G2CLIB=0
USE_PNG=1
USE_JASPER=1

COMMENTS:

In the default configuration, all the code is compiled
using the C compiler.
1) Do not set both USE_NETCDF3 and USE_NETCDF4 to one
2) Some options require a compatible fortran compiler (usually gfortran).
You need to set the environment variable FC before running make

sh/bash: export FC=gfortran
csh/tcsh: setenv FC gfortran

On some machines, you will have to define the C compiler
and C preprocessor. On the NCEP's AIX, I have to define
them by
3) On some machines, you will have to define the C compiler
and C preprocessor. On the NCEP's AIX, I have to define
them by

export CC=/usr/vacpp/bin/xlc_r
export CPP=/usr/bin/cpp

Then you have to run gnu make. (gmake on some machines, make on others)

make - on linux
gmake - on AIX



Comments on Netcdf
Netcdf

The makefile is set up to use either netcdf v3 or netcdf v4. Netcdf-4
makes wgrib2 much bigger, so don't install it unless you really have to.
The source code for netcdf-4 (and necessary hdf5) is also very big
and will have to be downloaded separately.
and will have to be downloaded separately. The makefile will
prompt you for the downloads. You also have to set the fortran
compiler. See (2).

The netcdf-3 library is included with this distribution. The library is
compiled in enable-C-only mode which is not be that useful for
fortran code. Don't use try to link other codes to this library.

The netcdf-4 library has to be downloaded with the HDF5 library and
the shell variable FC has to be set to the default fortran compiler.
MYSQL

Install MySQL requires the appropriate headers and libraries to be installed.
The makefile may have to be modified to reflect the locations of the headers
and libraries.


IPOLATES, interpolation library

IPOLATES is the interpolation library used by the -new_grid options.
In order to use this library, you must have a f90/f95/f2003 fortran compiler.
In order to enable the -new_grid options, the makefile has to have USE_IPOLATES
enabled and the shell variable, FC, must have the name of the fortran compiler.
You will have to change the source code if you are not using g95, gfortran,
openf95 or xlf.
In order to use this library, you must have a f90/f95/f2003 fortran compiler
enabled. See (2). You will have to change the source code if you are
not using g95, gfortran, openf95 or xlf.

MYSQL
USE_UDF

Install MySQL requires the appropriate headers and libraries to be installed.
The makefile may have to be modified to reflect the locations of the headers
and libraries.
Set to zero in 99.999% of the times.

USE_PROJ4

Wgrib2 can use Proj4 as its geolocation library. The default geolocation
library, gctpc, is faster. Proj4 is most used to compare check the
results from gctpc.


USE_WMO_VALIDATION

Has been used for validation of proposed WMO extentions.

DISABLE_TIMEZONE

INSTALLING on windows XP
Set to zero if most cases. For one non-POSIX system, the time zones
had to be disabled in order for a certain option to work correctly.


OpenMP

OpenMP allows wgrib2 to run faster by using threading the code and
running on multiple cores. When you enable OpenMP, your C compiler must
support OpenMP v3.0 or higher.


MAKE_FTN_API

The MAKE_FTN_API builds the wgrib2 library and the C and fortran API.
This enables C and Fortran codes to call wgrib2 as a subroutine. This
also requires a fortran compiler.


USE_G2CLIB

The internal grib decoders are better than g2clib so there is
little reason to link in g2clib. However, I've gotten complaints
that wgrib2 decoded this field incorrectly. My reply is that g2clib
got the same results.


USE_PNG

If set to zero, the png library is not linked in and png-compressed
grib message cannot be read. When was the last time you saw a
png-compressed grib message? Must be set to one if g2clib is
linked int.

USE_JASPER

If set to zero, the jasper library used for encoding and decoding
jpeg2000 is not linked in. Since jpeg2000-compressed files are
very common, USE_JASPER should be set to one. The only exception
is when you are cross-compiling wgrib2. Using autoconfig scripts
(Proj4, png, jasper) can be a challenge. Of course, you would
have restrict yourself to simple, complex or ieee packed grib.


INSTALLING on Cygwin and Windows

The code including the IPOLATES option compiles in the cygwin development
system. You'll have to install extra packages such as the C, gfortran
Expand All @@ -142,7 +207,7 @@ was compiled with clang and gfortran.

INSTALLING on Apple OS-X

Has been done. No details.
See Grace Peng's blog.


INSTALLING on NCEP's AIX
Expand All @@ -162,11 +227,10 @@ I've tried to make the add-on libraries static.

Testing Package

Have a testing script that tests an known-good version with a test
version. For new machines, I use the gcc compiled version as the
"known-good" version. Not ideal.
Yes it does exist.

Problems

Some optional packages require changes to makefile
Perfection? Not here.


102 changes: 82 additions & 20 deletions README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
wgrib2
wgrib2 revised 7.2016

wgrib2 is a program to read/write grib2 files.

Expand All @@ -24,37 +24,99 @@ for "f_{option}" where the option does not include the minus sign.

Default makefile options

USE_NETCDF4=0
USE_NETCDF3=1
USE_REGEX=1
USE_TIGGE=1
USE_MYSQL=0
USE_IPOLATES=0
USE_UDF=1

To compile without netcdf, use USE_NETCDF3=0 and USE_NETCDF4=0
USE_NETCDF3=1
USE_NETCDF4=0
USE_REGEX=1
USE_TIGGE=1
USE_MYSQL=0
USE_IPOLATES=0
USE_UDF=0
USE_OPENMP=1
USE_PROJ4=0
USE_WMO_VALIDATION=0
DISABLE_TIMEZONE=0
MAKE_FTN_API=0

USE_G2CLIB=0
USE_PNG=1
USE_JASPER=1
USE_AEC=1

To compile without netcdf, set USE_NETCDF3=0 and USE_NETCDF4=0
To compile without netcdf v3, set USE_NETCDF3=1 and USE_NETCDF4=0
To compile without netcdf v4, set USE_NETCDF3=0 and USE_NETCDF4=1
For netcdf4, the netcdf4 and hdf5 libraries are usually not included
in the wgrib2.tgz file to save space.

If you have an old C compiler system that doesn't include <regex.h>, then
you have to set USE_REGEX=0. This turns off all the regular expressions
which would be a pain.
For netcdf4, the netcdf4 and hdf5 libraries are usually not included
in the wgrib2.tgz file to save space. The makefile suggests
how to download the netcdf4 and hdf5 libraries.

If you have non-POSIX C compiler system that doesn't include <regex.h>, then
you have to set USE_REGEX=0. This disables the use of regular expressions.

No harm to keep TIGGE support on. USE_TIGGE=1

Support for Mysql is an option. You have to modify the makefile to indicate
the locations of the mysql includes and libraries and set USE_MYSQL=1

The option -new_grid uses the ipolates library to do the interpolation.
The required libraries are written in fortran and their is no support
for compiling these libraries. The source code and makefile will
have to be modified to use the ipolates option. Consult a local
expert if you want to install this optional package. No help is available
from NCEP for installing the package.
The required libraries are written in fortran and a few compilers are
already supported in the makefile. For other compilers, you are on
your own. The source code and makefile will have to be modified to use
the ipolates option. Consult a local expert if you want to install this
optional package. No help is available from NCEP for installing the package.

User Defined Functions (UDF) allow you to run shell commands from
within wgrib2. UDF are not available on windows machines unless
<unistd.h> is implimented by the compiler (cygwin, MinGW). For
the security paranoid, turn off UDF by USE_UDF=0.

OpenMP allows wgrib2 to run on many cores for a faster run time. See
README.openmp. The USE_OPENMP option will compile wgrib2 with openmp
for several compilers.

Proj4 is a open-source geolocation library. Usually the faster gctpc library
is used for geolocation. At the current time, Proj4 does not add any
capabilty over gctpc.

Wgrib2 has been used to test proposals to the WMO grib standard. Developers
might want to have conditional compilation of the tests using

#ifdef WMO_VALIDATION
... test code ...
#endif

and compile using

USE_WMO_VALIDATION=1


If you have a non-POSIX C compiler system that doesn't support time zones
or supports time zones in a non-POSIX manner, then you have to set
DISABLE_TIMEZONE to 1.

Wgrib2 is both a stand alone utility and a library that is callable
from both C and Fortran. To enable the making the wgrib2 library, you
have to set

MAKE_FTN_API=1

In older versions of wgrib2, the g2clib was the default decoder of grib files.
In the current version, you can use g2clib as an optional decoder. The main
use of compiling wgrib2 with g2clib is for testing g2clib.

USE_G2CLIB=1

Support for the png, jpeg2000 and CDCSD(AEC) compression can be turned off through
the following options.

USE_PNG=0
USE_JASPER=0
USE_AEC=0


You might want to turn off the various compressions because

1) libraries do not compile correctly (icc and pgcc have problems with Jasper)
2) reduce the executable size and compile time
3) problems with cross-compiling

Loading

0 comments on commit 60da590

Please sign in to comment.