Skip to content

Commit 9dd786e

Browse files
committed
First commit
0 parents  commit 9dd786e

File tree

571 files changed

+88493
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

571 files changed

+88493
-0
lines changed

Developement.doc

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Development notes for Wgrib2 1/2004
2+
3+
4+
5+
Every option for wgrib is now a function call. (Eventually some
6+
options will be macros; for example, -s = -var -d etc.) I went
7+
to this approach for
8+
9+
(1) ease of development
10+
(2) ease of extendability
11+
(3) more versatile
12+
13+
People kept making mods for wgrib, so I wanted a system where you
14+
just drop in the code and compile.
15+
16+
17+
Steps to add a new option/function:
18+
19+
(1) decide on the type of function
20+
currently inv (inventory) - writes to stdout, no access to decoded data
21+
output - writes to stdout, dump-file, access to decoded data
22+
setup - no access to decoded data
23+
24+
(2) write function
25+
functions are called several times
26+
a) first with mode == -1 (initialization stop)
27+
b) for each data field (mode = 0 or mode = 1 verbose)
28+
c) finishing with mode = -2 (finializing step)
29+
30+
(3) write header in the source code
31+
format is
32+
* HEADER:sort_order:name:type:number_args:description
33+
ex * HEADER:100:d:inv:0:date YYYYMMDDHH
34+
35+
For the name of the function and calling args, see
36+
documentation in wgrib2
37+
38+
To compile
39+
40+
./function.sh updates the option table
41+
./compile compiles the code
42+

INSTALLING

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
1/2013 General Installation
2+
3+
Quick Directions for the Default Configuration
4+
"Any color that you like as long as it's black"
5+
6+
Download source code from
7+
8+
ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz
9+
http://www.ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz
10+
11+
Untar the compressed tarball
12+
13+
gunzip wgrib2.tgz
14+
tar -xvf wgrib2.tar
15+
16+
or if you have gnu tar: tar -xzvf wgrib2.tgz
17+
18+
Go to the main directory (grib2)
19+
20+
cd grib2
21+
22+
Define the C compiler that you will be using. Note icc and pgc have been
23+
found to be incompatible with the Jasper library and are not allowed.
24+
25+
sh/bash: export CC=gcc
26+
csh/tcsh: setenv CC gcc
27+
28+
Compile the wgrib2 using gnu make
29+
30+
linux: make
31+
MacOS: gmake
32+
Unix: ??? ask system administrators
33+
34+
Try executing wgrib2
35+
36+
wgrib2/wgrib2 -config
37+
38+
Copy wgrib2 to SOMEPLACE
39+
40+
cygwin/linux/unis: cp wgrib2/wgrib2 SOMEPLACE
41+
42+
43+
Not So Quick Directions
44+
So you want some options
45+
46+
47+
Edit the file "makefile" and select the desired options:
48+
49+
# netcdf3: write netcdf files with netcdf-3 library
50+
# netcdf4: write netcdf files with netcdf-4 library
51+
# only one netcdf library can be installed. do not choose netcdf3 and ncdf4
52+
# regex: regular expression package used by (match,not), POSIX-2
53+
# tigge: enable -tigge option for tigge names
54+
# mysql: write to mysql files
55+
# ipolates: fortran interpolation library
56+
# udf: user defined functions
57+
# openmp: use OpemMP to thread the code
58+
# g2clib: install g2clib decoders (allow -g2clib 2)
59+
#
60+
# the flags are stored in wgrib2/config.h
61+
#
62+
63+
Default options
64+
65+
USE_NETCDF3=1
66+
USE_NETCDF4=0
67+
USE_REGEX=1
68+
USE_TIGGE=1
69+
USE_MYSQL=0
70+
USE_IPOLATES=0
71+
USE_UDF=0
72+
USE_OPENMP=0
73+
USE_G2CLIB=0
74+
75+
In the default configuration, all the code is compiled
76+
using the C compiler.
77+
78+
79+
On some machines, you will have to define the C compiler
80+
and C preprocessor. On the NCEP's AIX, I have to define
81+
them by
82+
83+
export CC=/usr/vacpp/bin/xlc_r
84+
export CPP=/usr/bin/cpp
85+
86+
Then you have to run gnu make. (gmake on some machines, make on others)
87+
88+
make - on linux
89+
gmake - on AIX
90+
91+
92+
93+
Comments on Netcdf
94+
95+
The makefile is set up to use either netcdf v3 or netcdf v4. Netcdf-4
96+
makes wgrib2 much bigger, so don't install it unless you really have to.
97+
The source code for netcdf-4 (and necessary hdf5) is also very big
98+
and will have to be downloaded separately.
99+
100+
The netcdf-3 library is included with this distribution. The library is
101+
compiled in enable-C-only mode which is not be that useful for
102+
fortran code. Don't use try to link other codes to this library.
103+
104+
The netcdf-4 library has to be downloaded with the HDF5 library and
105+
the shell variable FC has to be set to the default fortran compiler.
106+
107+
108+
IPOLATES, interpolation library
109+
110+
IPOLATES is the interpolation library used by the -new_grid options.
111+
In order to use this library, you must have a f90/f95/f2003 fortran compiler.
112+
In order to enable the -new_grid options, the makefile has to have USE_IPOLATES
113+
enabled and the shell variable, FC, must have the name of the fortran compiler.
114+
You will have to change the source code if you are not using g95, gfortran,
115+
openf95 or xlf.
116+
117+
MYSQL
118+
119+
Install MySQL requires the appropriate headers and libraries to be installed.
120+
The makefile may have to be modified to reflect the locations of the headers
121+
and libraries.
122+
123+
124+
125+
INSTALLING on windows XP
126+
127+
The code including the IPOLATES option compiles in the cygwin development
128+
system. You'll have to install extra packages such as the C, gfortran
129+
compilers and various scripting utilities.
130+
131+
Before you compile, you set the default compilers.
132+
133+
export CC=gcc
134+
export FC=gfortran
135+
make
136+
137+
INSTALLING on FreeBSD
138+
139+
Set appropriate CC and FC environment variables and try make. wgrib2 v1.9.8
140+
was compiled with clang and gfortran.
141+
142+
143+
INSTALLING on Apple OS-X
144+
145+
Has been done. No details.
146+
147+
148+
INSTALLING on NCEP's AIX
149+
150+
Define default C, C preprocessor and fortran
151+
152+
export CC=/usr/vacpp/bin/xlc_r
153+
export CPP=/usr/bin/cpp
154+
export FC=xlf_r
155+
gmake
156+
157+
158+
Static vs Dynamic Libraries
159+
160+
The various libraries can be created in both dynamic and static versions.
161+
I've tried to make the add-on libraries static.
162+
163+
Testing Package
164+
165+
Have a testing script that tests an known-good version with a test
166+
version. For new machines, I use the gcc compiled version as the
167+
"known-good" version. Not ideal.
168+
169+
Problems
170+
171+
Some optional packages require changes to makefile
172+

README

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
wgrib2
2+
3+
wgrib2 is a program to read/write grib2 files.
4+
5+
6+
For documentation, see
7+
8+
http://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/index.html
9+
10+
11+
For documentation of commonly used program options, type
12+
13+
wgrib2
14+
15+
16+
For documentation of all program options, type
17+
18+
wgrib2 -help all
19+
20+
For documenation of any program option that is poorly described on-line
21+
or by the "wgrib2 -help all", check the source code by searching
22+
for "f_{option}" where the option does not include the minus sign.
23+
24+
25+
Default makefile options
26+
27+
USE_NETCDF4=0
28+
USE_NETCDF3=1
29+
USE_REGEX=1
30+
USE_TIGGE=1
31+
USE_MYSQL=0
32+
USE_IPOLATES=0
33+
USE_UDF=1
34+
35+
To compile without netcdf, use USE_NETCDF3=0 and USE_NETCDF4=0
36+
To compile without netcdf v3, set USE_NETCDF3=1 and USE_NETCDF4=0
37+
To compile without netcdf v4, set USE_NETCDF3=0 and USE_NETCDF4=1
38+
For netcdf4, the netcdf4 and hdf5 libraries are usually not included
39+
in the wgrib2.tgz file to save space.
40+
41+
If you have an old C compiler system that doesn't include <regex.h>, then
42+
you have to set USE_REGEX=0. This turns off all the regular expressions
43+
which would be a pain.
44+
45+
No harm to keep TIGGE support on. USE_TIGGE=1
46+
47+
Support for Mysql is an option. You have to modify the makefile to indicate
48+
the locations of the mysql includes and libraries and set USE_MYSQL=1
49+
50+
The option -new_grid uses the ipolates library to do the interpolation.
51+
The required libraries are written in fortran and their is no support
52+
for compiling these libraries. The source code and makefile will
53+
have to be modified to use the ipolates option. Consult a local
54+
expert if you want to install this optional package. No help is available
55+
from NCEP for installing the package.
56+
57+
User Defined Functions (UDF) allow you to run shell commands from
58+
within wgrib2. UDF are not available on windows machines unless
59+
<unistd.h> is implimented by the compiler (cygwin, MinGW). For
60+
the security paranoid, turn off UDF by USE_UDF=0.

README.EUMETSAT

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
Using EUMETSAT grib2 fields
2+
3+
4+
Some of the EUMETSAT data is on a space view perspective grid.
5+
6+
-sh-3.00$ wgrib2 LMPEF_CLM_110328_0945.grib2 -grid
7+
1:0:grid_template=90:winds(N/S):
8+
Space view perspective or orographic grid (3712 x 3712) units 1e-06
9+
input EW:SN output WE:SN res 0
10+
sub-sat point: lat 0.000000 lon 0.000000 ix=1856.000000 iy=1856.000000
11+
diameter of earth dx=3622 dy=3610 grid cells ori_angle 0.000000
12+
sat. altitude=6.610700 (equatorial radii) grid_origin Xo=0 Yo=0
13+
14+
wgrib2 v1.9.3 adds support for space view perspective grids with the restriction
15+
that orientation angle (ori_angle) is 0 and sub-sat point has a latitude of 0.
16+
17+
The rest of the text assumes that you have a space view perspective file.
18+
19+
20+
Displaying with GrADS
21+
22+
My version of GrADS is not using the latest g2clib can couldn't handle product
23+
definition template 4.30. So here is what I did.
24+
25+
* make a copy of the grib file product with def template 4.0
26+
wgrib2 LMPEF_CLM_110328_0945.grib2 -set_pdt 0 -set_var CLOUDM -grib new.grb
27+
1:0:d=2011032809:CLOUDM:no_level:-1 missing fcst:
28+
29+
* make a control file
30+
g2ctl -raw new.grb >new.ctl
31+
32+
* make a index file
33+
gribmap -i new.ctl
34+
35+
Note that my grib file only had one field. Some EUMETSAT grib files have
36+
mutiple fields on different grids. g2ctl will get confused files that have
37+
more than one grid. Your grib file must only have one grid.
38+
39+
When you run GrADS on your file, you will see the raw satellite data.
40+
41+
42+
Getting grid point information
43+
44+
45+
To get the value of the grid point nearest to a specified lat-lon.
46+
47+
-sh-3.00$ wgrib2 new.grb -lon 10 30
48+
experimental space_view2ll scan=12
49+
experimental space_view2ij
50+
1:0:lon=10.009994,lat=30.005756,val=1
51+
52+
To get the value of a grid point
53+
54+
-sh-3.00$ wgrib2 new.grb -ijlat 1 1
55+
experimental space_view2ll scan=12
56+
1:0:(1,1),lon=999.000000,lat=999.000000,val=3
57+
-sh-3.00$ wgrib2 new.grb -ijlat 1000 1000
58+
experimental space_view2ll scan=12
59+
1:0:(1000,1000),lon=-27.386283,lat=-24.929402,val=0
60+
61+
If the grid point is off the earth, a lat-lon of 999 is used.
62+
The convention of (i,j) is different that used by EUMETSAT. (1,1) is
63+
the bottom left corner which is consistent with wgrib2 convention.
64+
65+
66+
Regridding the data
67+
68+
69+
To space view perspective is not as convenient as a latitude-longitude grid
70+
for many plotting programs. You can use the -lola option to regrid the
71+
data to a lola grid.
72+
73+
* converting to lola grid by nearest neighbor
74+
-sh-3.00$ wgrib2 new.grb -lola -60:1201:.1 -60:1201:.1 lola.grb grib
75+
experimental space_view2ll scan=12
76+
experimental space_view2ij
77+
1:0:d=2011032809:CLOUDM:no_level:-1 missing fcst:
78+
79+
* the grid of lola.grb
80+
-sh-3.00$ wgrib2 -V lola.grb
81+
1:0:vt=2011032809:no_level:-1 missing fcst:CLOUDM Cloud Mask [-]:
82+
ndata=1442401:undef=0:mean=1.53046:min=0:max=3
83+
grid_template=0:winds(N/S):
84+
lat-lon grid:(1201 x 1201) units 1e-06 input WE:SN output WE:SN res 48
85+
lat -60.000000 to 60.000000 by 0.100000
86+
lon 300.000000 to 60.000000 by 0.100000 #points=1442401
87+

README.Mac

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
A user had trouble making a 64 bit version of wgrib2 with the Leopard OS.
2+
Some of the libraries where 32 and other 64 bits. To get everything
3+
to work, he had to get the "-m64" flag to all the compiles. He
4+
did this by setting the following environment variables before
5+
doing the "gmake -f makefile"
6+
7+
export CC=/usr/bin/gcc
8+
export CXX=/usr/bin/c++
9+
export F77=ifort
10+
export CFLAGS="-O2 -m64"
11+
export CXXFLAGS="-O2 -m64"
12+
export FFLAGS="-O2 -m64"
13+
14+
Another user had to the above and change makefile
15+
16+
wCPPFLAGS=-O2
17+
18+
to
19+
20+
wCPPFLAGS=-O2 -m64
21+
22+
-------------------------------------------------
23+
24+
Another user Mac user had 32-bit MySQL libraries and had to
25+
remove the -m64 (2/2010)

README.clang

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Compiling with clang (C language frontend for LLVM)
2+
3+
tested with a Ubuntu 12.04 system
4+
5+
export CC=clang
6+
export FC=gfortran -fplugin=dragonegg
7+
8+
note: at time of testing, clang did not have OpenMP support

0 commit comments

Comments
 (0)