Compare commits
1 commit
rawhide
...
epel8-play
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ffac09156 |
20 changed files with 1 additions and 1951 deletions
10
.gitignore
vendored
10
.gitignore
vendored
|
|
@ -1,10 +0,0 @@
|
|||
wgrib.c.v1.8.1.0b
|
||||
/wgrib.c.v1.8.1.0d
|
||||
/wgrib.c.v1.8.1.0h
|
||||
/wgrib.c.v1.8.1.2a
|
||||
/wgrib.c.v1.8.1.2b
|
||||
/wgrib.c.v1.8.1.2c
|
||||
/wgrib.c.v1.8.2
|
||||
/wgrib.c.v1.8.3
|
||||
/wgrib.c.v1.8.4
|
||||
/wgrib.c.v1.8.5
|
||||
315
Changes
315
Changes
|
|
@ -1,315 +0,0 @@
|
|||
v1.8.3 5/23 ECMWF introduced a new ec_stream (1122). This stream uses the same
|
||||
convention as 1033 and 1035 for denoting the perturbation number.
|
||||
thanks S Villaume (ECMWF)
|
||||
v1.8.2 3/17 old code only checked grib header (Sec 0) to find grib message, assumed
|
||||
grib message is valid. new code will reject grib message (no error message)
|
||||
if the message wants to be bigger than the message length. This fixes
|
||||
problems with ECMWF mixed grib1+grib2 files. Some of their files included
|
||||
a grib1 Sec 0 which was not part of a grib1 message.
|
||||
v1.8.1.2e 7/15 internal release
|
||||
7/15 removed from pds4.h: #define PDS_EcNoFcst(pds) (pds[50]), no affect on code
|
||||
7/15 various code/.h files: removed warnings about prototypes and initialization
|
||||
no affect on the code
|
||||
v1.8.1.2e beta1 9/2014 added pertbation no. for ECMWF stream 1033 (hindcast)
|
||||
v1.8.1.2d 4/14 updated ncep table 130, 131
|
||||
v1.8.1.2c 9/13 added JMA levels 211, 212 and 213 for JRA-55
|
||||
v1.8.1.2b 9/13 added JMA table 200 for JRA-55
|
||||
10/11 added fflush(dump_file) and fflush(stdout), enhancement for potential apps
|
||||
v1.8.1.1 6/11 changes from Jeffery S Smith for Albers equal area projection
|
||||
v1.8.1.0h 5/11 seekgrib: scan entire file for grib data because ECMWF files have grib1+grib2 data
|
||||
v1.8.1.0g 5/11 Paul Schou: fixed #define GDS_Lambert_LonSP(gds) INT3(gds[37],gds[38],gds[39])
|
||||
v1.8.1.0f 3/11 update ncep table 129, 130, 133
|
||||
v1.8.1.0e 10/10 moved int ec_large and len_ec_bds to seek_grib.c
|
||||
helped people who just call subroutines, suggested by P. Tran
|
||||
v1.8.1.0d 9/10 changed add_time: old: 1month + Jan31 returns Feb31, now returns Feb 28/29
|
||||
v1.8.1.0c 7/10 Updated ncep table 130
|
||||
v1.8.1.0b 5/10 PDStimes .. decided to remove normalize minutes to hours, make time units consistent in inv
|
||||
v1.8.1.0 5/10 PDStimes .. if time_range == 10 and time_unit == 0 (minute) .. normalize to hour only
|
||||
occurs when (time/256 % 60) == 0 && ((time % 256) % 60) == 0 rather than (time % 60 == 0)
|
||||
v1.8.0.13g 5/10 changed decl of pos so error message wont appear on AIX
|
||||
v1.8.0.13f 3/10 added code from Brian Doty for large ECMWF files
|
||||
v1.8.0.13e 2/10 added level 216/217/239/241
|
||||
updated nceptab 128, 129
|
||||
9/09 warning message if grib2 message encountered
|
||||
v1.8.0.13d 9/09 added ncep table 141, fixed typo in ncep table 129 (thanks YT)
|
||||
v1.8.0.13c 6/09 Dusan Jovic's changes for Arakawa staggered b-grid (205)
|
||||
v1.8.0.13b 6/09 updated ncep table 129
|
||||
v1.8.0.13a 5/09 added SUNSD ncep table 133
|
||||
v1.8.0.13 5/09 added -cmc by NCO request, updated ncep table 129
|
||||
v1.8.0.12z: 4/09 updated/added ectables: 128, 129, 131, 132, 133, 140, 150,
|
||||
151, 160, 162, 170, 171, 173, 174, 180, 190, 200, 210, 211, 228
|
||||
v1.8.0.12y: 3/09 added #include <stdlib.h> to BDSunpk.c (Lulin Song)
|
||||
fix: bit 1 table 7 doesn't apply to lambert conformal
|
||||
v1.8.0.12x: 11/08 make center LAMI point to DWD tables (Davide Sacchetti) (removed)
|
||||
v1.8.0.12w: 9/08 (preliminary) MDL table
|
||||
v1.8.0.12v: 8/08 polar & lambert conformal grid: dx/dy now respect bit 1 of resolution flag
|
||||
v1.8.0.12u: 4/08 update time ranges for CFSRR
|
||||
v1.8.0.12t: 3/08 update table ncep table 129, fix ncep table 133, #205
|
||||
v1.8.0.12s: 1/08 update ncep table 133 (CFSRR)
|
||||
v1.8.0.12r: 12/07 update ncep table 133 (CFSRR)
|
||||
v1.8.0.12q: 11/07 update ecmwf table 128
|
||||
v1.8.0.12p: 10/07 update ncep table 129, 130, add ncep table 140
|
||||
v1.8.0.12o: 5/07 update ncep table 129
|
||||
v1.8.0.12n: 3/07 name change DH->VEDH (ncep table 129), update ncep table 129, 130
|
||||
updated levels table to current on388
|
||||
updated levels table to current on388
|
||||
v1.8.0.12m: 3/07 added FAST_GRIBTAB compile option, support for updates in user defined grib tables
|
||||
v1.8.0.12l: 3/07 minor table change ncep 129 (lat/lon of u, v and p points)
|
||||
v1.8.0.12k: 2/07 stdin 2000 characters now
|
||||
v1.8.0.12j: 2/07 level 210 corresponds to WMO standard for non-NCEP files
|
||||
v1.8.0.12i: 12/06 ncep table 128 entry 186 K->C
|
||||
v1.8.0.12h: 9/06 can figure out the nxny of complex packed files, still no support for decoding
|
||||
so you can manipulate ec-spectral files but can't decode them
|
||||
v1.8.0.12g: 8/06 more ncep ensemble information
|
||||
v1.8.0.12f: 8/06 more ncep ensemble information stddev/wtd mean
|
||||
v1.8.0.12e: 8/06 level 20: T=280K, added verbose parameter, revised level 113
|
||||
v1.8.0.12d: 8/06 added marine branch table 128 (extremely revised)
|
||||
v1.8.0.12c: 8/06 level 20
|
||||
v1.8.0.12b: 7/06 update ncep tab 129, remove ncep tab 128 .. need new table, minor fixes
|
||||
v1.8.0.12a: 6/06 replace error message - complex packing spectral files
|
||||
v1.8.0.12: 5/06 update thinned gaussian grid info for grib2ctl.pl
|
||||
v1.8.0.11: 5/06 flag bad read_grib calls
|
||||
v1.8.0.10c: 1/06 fix the 1/3/05 additions to PDStimes, H. Frank
|
||||
v1.8.0.10b: 1/06 add new (204, 205) and updated DWD tables H. Frank, 10-19-2005
|
||||
v1.8.0.10a: 12/05 add ectable 172 from Geert Jan van Oldenborgh (KNMI)
|
||||
v1.8.0.10: 9/05 fix gribtable.c
|
||||
v1.8.0.9m1: 9/05 put copyright info in wgrib_main.c and wgrib.c
|
||||
v1.8.0.9m: 8/05 add time range 6 and 7, updated add_time code
|
||||
v1.8.0.9l: 5/05 update ncep 129 table, new levels done by D. Stokes
|
||||
v1.8.0.9k: 4/05 ec table 190, more ec diagnostics (ec_ext)
|
||||
v1.8.0.9j: 4/05 minor comment changes in ncep table 131 (RR)
|
||||
v1.8.0.9i: 12/04 fixed typo introduced 11/04 (table 129, entry 192)
|
||||
v1.8.0.9h: 11/04 updated table ncep-129 (strange entry)
|
||||
v1.8.0.9g: 9/04 fix if (gds && GDS_Harmonic_type(gds) == 1)
|
||||
found by Graziano Giuliani
|
||||
v1.8.0.9f: 8/04 added ecmwf table 151
|
||||
v1.8.0.9e: 8/04 changes of CFS time ranges
|
||||
v1.8.0.9d: 7/04 fixed reanal grib table NLON -> ELON
|
||||
v1.8.0.9c: 6/04 chaged UVI defn ncep opn table
|
||||
v1.8.0.9b: 6/04 added table 132 (global reanalysis)
|
||||
v1.8.0.9a: 6/04 updated table 129,130
|
||||
v1.8.0.9: 5/04 added new time codes 132-135, changed time code 51 (clim)
|
||||
v1.8.0.8: 4/04 added -ncep_ens option
|
||||
v1.8.0.7e: 3/04 multiple user tables (fix open)
|
||||
v1.8.0.7d: 3/04 extern minute -> extern int minute
|
||||
v1.8.0.7c: 3/04 for clim (51) don't print 'anl'
|
||||
v1.8.0.7b: 2/04 update NCEP grib table 129
|
||||
v1.8.0.7a: 11/03 update NCEP grib table 131
|
||||
v1.8.0.7: 10/03 Mods fron Norwegian Meteorological Institute
|
||||
fixed ec table 131, and enhansed ex_ext.c
|
||||
v1.8.0.6: 9/03 added time codes 128-131 (for RR)
|
||||
v1.8.0.5: 9/03 fix scan mode and change format
|
||||
v1.8.0.4: 9/03 new dwd tables and -dwdgrib option (thanks to Helmut P. Frank)
|
||||
updated formats_update.txt for -dwdgrib option
|
||||
v1.8.0.3k: 7/03 fixed N/S vs grid wind diagnostic with -v option
|
||||
found by Dusan Jovic
|
||||
v1.8.0.3j: 6/03 fixed level 206 (was 205)
|
||||
v1.8.0.3i: 5/03 updated ncep table 131
|
||||
v1.8.0.3h: 5/03 updated ncep table 131
|
||||
v1.8.0.3g: 4/03 ecmwf table 128, 140 (names from ECMWF web site), updated 131
|
||||
v1.8.0.3f: 4/03 updated ncep131, ncep130, ncep-opn
|
||||
v1.8.0.3e: 3/03 fix level 141, update tables 130 and 131
|
||||
v1.8.0.3d: 2/03 added prelim ncep grib tables 130 and 131
|
||||
v1.8.0.3c: 1/03 Reanalysis Project updates: scan mode in english,
|
||||
grid vs NS winds, and dusan.jovic@noaa.gov: ss2dEGRID support
|
||||
v1.8.0.3b: 1/03 minor update: changed units of CICE in NCEP tables
|
||||
v1.8.0.3a: 11/02 update ncep_opn and add ncep_129 table
|
||||
v1.8.0.3: 10/02 update levels and ncep_opn grib table
|
||||
v1.8.0.2: 10/02 check gds before grib_check, redid level 117
|
||||
v1.8.0.1: 10/02 added cptec gribtable 254
|
||||
v1.8: 4/1/02: Decode of simple packed spectral data and some cleanup of the
|
||||
triangular grid (Luis Kornblueh, Max-Plank Institute of Meteorology)
|
||||
v1.7.4.1a 12/01: added new entry to OMB grib table (REV)
|
||||
v1.7.4.1 12/01: D. Haalman (METEO SERVICE weather research GmbH)
|
||||
rewrote seekgrib.c
|
||||
v1.7.4 10/01: Merged changes made by Helmut P. Frank (DWD) to current
|
||||
source code. This adds DWD tables 1, 201, 202, and 203
|
||||
as well as support for triangular grids based on an icosahedron
|
||||
1.7.3.6: 5/01: added fractional mb, center to levels.c
|
||||
1.7.3.5: 2/01: Handle grib files with precision greater than 31 bits
|
||||
1.7.3.4a: 9/00: check for missing grib file
|
||||
1.7.3.4: 8/00: polar stereo + lambert, always print direction increments
|
||||
1.7.3.2: 6/00: undefined direction increments set to zero on -V output
|
||||
1.7.3.1: 8/99: added new levels
|
||||
1.7.3: 5/99: updated NCEP opn grib table
|
||||
1.7.2: 5/99: fixed fictious error message with thinned grids and bitmaps
|
||||
1.7.1: 2/99: fixed error in wrtieee_header affects only -H option
|
||||
1.7.0b7: 1/99: preliminary support for NCEP ensembles
|
||||
1.7.0b6: 1/99: changed "x12 hours" format to "hr" format
|
||||
1.7.0b5: 1/99: fixed 3/6/12 hour forecast time units
|
||||
1.7.0b4 11/98: updated (128,160) and new (129,130,131,140,150,170,180)
|
||||
ECMWF tables
|
||||
1.7.0b3 10/98: added new time units
|
||||
1.7.0b2 8/98: allow blank gribtab lines in definition, --v
|
||||
1.7.0b 8/98: added "km" to Mercator meta-data
|
||||
1.7: 7/98: fixed bitmap when nbits > 24 (theoretical bug)
|
||||
1.6.2.5 5/98: fixed -H code so that all of GDS is written
|
||||
1.6.2.4 4/98 beta: reanalysis ID code: needed for users of 1997 Reanalysis data
|
||||
1.6.2.2 2/98 beta: rotated lat long grid (10)
|
||||
1.6.2 1/98 added Arakawa E-grid meta-data
|
||||
1.6.1b changed 03TOT to O3TOT in ncep operational table
|
||||
note: typo originated in the original NCEP documentation
|
||||
1.6.1a 12/97 made ncep_opn the default table
|
||||
1.6.1 9/97 Added the "-d all" option
|
||||
1.6.0 9/97 non-beta version, added operational NCEP table,
|
||||
optimized the ieee writes (2.5x faster on Cray, 20% on linux),
|
||||
new help screen
|
||||
1.5.0b14 fix century mark: year=100 not 0
|
||||
1.5.0b13 -4yr, use 4 digit year code
|
||||
1.5.0b12 lat-long thinned grid support
|
||||
1.5.0b11 Added -H option (PDS/GDS output to binary files)
|
||||
1.5.0b10 Changed"0hr fcst" to "anl" for TR=10 and fcstlen = 0 (non-beta release)
|
||||
1.5.0b9 Thinned grids support (preliminary)
|
||||
1.5.0b8 Changed bitmap message
|
||||
1.5.0b7 -PDS -GDS work for all inventories
|
||||
1.5.0b6 Added -verf to print "verification" time, new grib2ctl for -verf
|
||||
1.5.0b5 Added Lambert Conformal, -PDS and -GDS
|
||||
1.5.0b1 Added ECMWF parameter table #128
|
||||
|
||||
1.5.0a wgrib failing with no GDS and constant field. Cannot determine
|
||||
(9/96) the size of data without a center-dependent lookup table.
|
||||
Set length size of data to 1.
|
||||
|
||||
1.5.0 -v option: major changes, now an inventory
|
||||
(9/96) -V option: added century to date code, list parameter table number,
|
||||
added description of variable
|
||||
Added parameter table (NCEP-128) for the ocean modeling branch of NCEP.
|
||||
Added user-defined parameter tables.
|
||||
Note: changes are incompatible with grib2ctl. Get new version.
|
||||
(old version works by changing "wgrib -v" to "wgrib -V".)
|
||||
V1.5.0 is the first version to be parameter-table aware. As a
|
||||
result, wgrib will give a warning if it cannot find a matching
|
||||
parameter table. The warning can be eliminated by either using
|
||||
a user-defined parameter table or by adding your table into
|
||||
the wgrib source. (Contact w. ebisuzaki, Wesley.Ebisuzaki@noaa.gov).
|
||||
Built-in tables: NCEP-2, NCEP-128, ECMWF-160.
|
||||
Much faster flt2ieee routine, changed rounding factor in flt2ieee
|
||||
so that IEEE machines gets the correct last bit.
|
||||
Increased NTRY to 100 to accommodate Automation div headers.
|
||||
The 1.4.x series didn't last long (1 revision, 3/96 to 7/96).
|
||||
|
||||
1.4.1a Several optimizations of the grib routines for reduced CPU usage.
|
||||
(6/96) Updated the NCEP parameter table and altered the print statement
|
||||
for climatological fields.
|
||||
|
||||
|
||||
1.4 ******************************************************************
|
||||
1.4
|
||||
1.4 BUG: Prior to v1.4, when the start of the grib message was less
|
||||
1.4 than 160 bytes from the end of the file, wgrib would not find
|
||||
1.4 the message. This would only occur if a short grib message (< 160 bytes)
|
||||
1.4 ended the file. Basically I had assumed that a grib message
|
||||
1.4 had to be 160+ bytes in length. Well someone at NCEP decided
|
||||
1.4 to write 84-byte grib messages! About the only field that
|
||||
1.4 can be described in a 84-byte message is uniform value of zero.
|
||||
1.4
|
||||
1.4 Fixed a bug in the return code, and made the code 10% faster.
|
||||
1.4
|
||||
1.4 Since this is a bug fix PLEASE upgrade to version 1.4.
|
||||
1.4 Why not? It's free! (3/96)
|
||||
1.4
|
||||
1.4 ******************************************************************
|
||||
|
||||
|
||||
1.3.4h Complaint about wgrib failing if the file has no GDS. Since a GDS
|
||||
(2/96) is recommended (and is in every file that I have seen) I've never
|
||||
included the code to create a GDS for prespecified grids. This
|
||||
version is a temporary fix. It sets the array size to NX x 1.
|
||||
[7/96: This temporary fix will have to do. The GDS prespecified
|
||||
grids are center dependent. Since I don't have the tables, nothing
|
||||
is planned.]
|
||||
|
||||
1.3.4f updated ECMWF parameter table (from M. Fiorino)
|
||||
(11/95) support for the ECMWF stream parameter
|
||||
clean compiles using acc (SunOS) (acc is pickier than gcc -Wall)
|
||||
|
||||
1.3.4e writing grib files made much faster
|
||||
(11/95)
|
||||
1.3.4d minor change in error statement format
|
||||
(9/95)
|
||||
1.3.4c didn't check for case where number of bits = 0! in NMC bug check
|
||||
(7/95)
|
||||
1.3.4 added check for bad bds "used bits" parameter (look for NMC bug)
|
||||
(7/95)
|
||||
1.3.3: (preliminary) ECMWF parameter table added
|
||||
(5/95)
|
||||
1.3.2: preliminary polar stereographics map support
|
||||
(4/95)
|
||||
|
||||
- from wgrib code -
|
||||
* 11/94 - v1.0
|
||||
* 11/94 - v1.1: arbitary size grids, -i option
|
||||
* 11/94 - v1.2: bug fixes, ieee option, more info
|
||||
* 1/95 - v1.2.4: fix headers for SUN acc
|
||||
* 2/95 - v1.2.5: add num_ave in -s listing
|
||||
* 2/95 - v1.2.6: change %d to %ld
|
||||
* 2/95 - v1.2.7: more output, added some polar stereographic support
|
||||
* 2/95 - v1.2.8: max min format changed %f to %g, tidying up more info
|
||||
* 3/95 - v1.3.0: fix bug with bitmap, allow numbers > UNDEFINED
|
||||
* 3/95 - v1.3.1: print number of missing points (verbose)
|
||||
* 3/95 - v1.3.2: -append option added
|
||||
* 4/95 - v1.3.2a,b: more output, polar stereo support (-V option)
|
||||
* 4/95 - v1.3.3: added ECMWF parameter table (prelim)
|
||||
* 6/95 - v1.3.4: nxny from BDS rather than gds?
|
||||
* 9/95 - v1.3.4d: speedup in grib write
|
||||
* 11/95 - v1.3.4f: new ECMWF parameter table (from Mike Fiorino), EC logic
|
||||
* 2/96 - v1.3.4g-h: prelim fix for GDS-less grib files
|
||||
* 2/96 - v1.3.4i: faster missing(), -V: "pos n" -> "n" (field 2)
|
||||
* 3/96 - v1.4: fix return code (!inventory), and short records near EOF
|
||||
* 6/96 - v1.4.1a: faster grib->binary decode, updated ncep parameter table, mod. in clim. desc
|
||||
* 7/96 - v1.5.0: parameter-table aware, -v option changed, added "comments"
|
||||
* increased NTRY to 100 in seek_grib
|
||||
* 11/96 - v1.5.0b: added ECMWF parameter table 128
|
||||
* 1/97 - v1.5.0b2: if nxny != nx*ny { nx = nxny; ny = 1 }
|
||||
* 3/97 - v1.5.0b5: added: -PDS -GDS, Lambert Conformal
|
||||
* 3/97 - v1.5.0b6: added: -verf
|
||||
* 4/97 - v1.5.0b7: added -PDS10, -GDS10 and enhanced -PDS -GDS
|
||||
* 4/97 - v1.5.0b8: "bitmap missing x" -> "bitmap: x undef"
|
||||
* 5/97 - v1.5.0b9: thinned grids meta data
|
||||
* 5/97 - v1.5.0b10: changed 0hr fcst to anal for TR=10 and P1=P2=0
|
||||
* 5/97 - v1.5.0b10: added -H option
|
||||
* 6/97 - v1.5.0b12: thinned lat-long grids -V option
|
||||
* 6/97 - v1.5.0b13: -4yr
|
||||
* 6/97 - v1.5.0b14: fix century mark Y=100 not 0
|
||||
* 7/97 - v1.5.0b15: add ncep opn grib table
|
||||
* 12/97 - v1.6.1.a: made ncep_opn the default table
|
||||
* 12/97 - v1.6.1.b: changed 03TOT to O3TOT in operational ncep table
|
||||
* 1/98 - v1.6.2: added Arakawa E grid meta-data
|
||||
* 1/98 - v1.6.2.1: added some mode data, Scan -> scan
|
||||
* 4/98 - v1.6.2.4: reanalysis id code: subcenter==0 && process==180
|
||||
* 5/98 - v1.6.2.5: fix -H code to write all of GDS
|
||||
* 7/98 - v1.7: fix decoding bug for bitmap and no. bits > 24 (theoretical bug)
|
||||
* 7/98 - v1.7.0.b1: add km to Mercator meta-data
|
||||
* 5/99 - v1.7.2: bug with thinned grids & bitmaps (nxny != nx*ny)
|
||||
* 5/99 - v1.7.3: updated NCEP opn grib table
|
||||
* 8/99 - v1.7.3.1: updated level information
|
||||
* 9/00 - v1.7.3.4a: check for missing grib file
|
||||
* 2/01 - v1.7.3.5: handle data with precision greater than 31 bits
|
||||
* 8/01 - vDWD : added DWD GRIB tables 201, 202, 203, Helmut P. Frank
|
||||
* 9/01 - vDWD : added output "Triangular grid", Helmut P. Frank
|
||||
* 9/01 - v1.7.4: merged Hemut P. Frank's changes to current wgrib source code
|
||||
* 3/02 - vMPIfM: added support for spectral data type
|
||||
* 4/02 - v1.8: merge vMPIfM changes, some fixes/generalizations
|
||||
* 10/02 - v1.8.0.1: added cptec table 254
|
||||
* 10/02 - v1.8.0.2: no test of grib test if no gds, level 117 redone
|
||||
* 10/02 - v1.8.0.3: update ncep_opn grib and levels
|
||||
* 11/02 - v1.8.0.3a: updated ncep_opn and ncep table 129
|
||||
* 9/03 - v1.8.0.4: update dwd tables (Helmut P. Frank), -dwdgrib option
|
||||
* 9/03 - v1.8.0.5: fix scan mode and change format
|
||||
* 10/03 - v1.8.0.7: Changes from Norwegian Met. Inst (ec tab #131, ex_ext)
|
||||
* 10/03 - v1.8.0.8: added -ncep_ens option
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
To Do:
|
||||
decode spherical harmonics (need some examples to test on)
|
||||
complex packing?
|
||||
|
||||
Adding new parameter tables is pretty easy and I'm willing to add new
|
||||
parameter tables for "operational centers". (Note, the GRIB center
|
||||
identification numbers are assigned by the WMO.)
|
||||
|
||||
|
||||
29
NOTICE
29
NOTICE
|
|
@ -1,29 +0,0 @@
|
|||
The following files are placed into the public domain. While
|
||||
you could legally do anything you want with the code, telling
|
||||
the world that you wrote it would be uncool. Selling it would
|
||||
be really uncool. The code was written for NMC/NCAR Reanalysis
|
||||
and may not work GRIB files from other sources. The code,
|
||||
as usual, is not warranteed to be fit for any purpose what so ever.
|
||||
Use at your own risk.
|
||||
|
||||
|
||||
Wesley Ebisuzaki November 25, 1995
|
||||
|
||||
|
||||
|
||||
BDS_unpack.c
|
||||
bds.h
|
||||
bms.h
|
||||
cnames.c
|
||||
cnames.h
|
||||
gds.h
|
||||
grib.h
|
||||
ibm2flt.c
|
||||
intpower.c
|
||||
pds3.h
|
||||
readgrib.c
|
||||
seekgrib.c
|
||||
testbin.c
|
||||
wgrib.c
|
||||
|
||||
|
||||
174
changelog
174
changelog
|
|
@ -1,174 +0,0 @@
|
|||
* Fri Jul 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.5-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
|
||||
|
||||
* Sat Jan 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.5-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
|
||||
|
||||
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.5-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
|
||||
|
||||
* Sun Jan 19 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.5-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
|
||||
|
||||
* Thu Sep 19 2024 Orion Poplawski <orion@nwra.com> - 1.8.5-4
|
||||
- Use SPDX license tag
|
||||
|
||||
* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.5-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
|
||||
|
||||
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.5-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Mon Sep 11 2023 Orion Poplawski <orion@nwra.com> - 1.8.5-1
|
||||
- Update to 1.8.5
|
||||
|
||||
* Mon Sep 11 2023 Orion Poplawski <orion@nwra.com> - 1.8.4-1
|
||||
- Update to 1.8.4
|
||||
|
||||
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.3-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Fri Jun 02 2023 Orion Poplawski <orion@nwra.com> - 1.8.3-2
|
||||
- Add ldflags to build for proper hardening
|
||||
|
||||
* Fri May 26 2023 Orion Poplawski <orion@nwra.com> - 1.8.3-1
|
||||
- Update to 1.8.3
|
||||
|
||||
* Fri Feb 17 2023 Florian Weimer <fweimer@redhat.com> - 1.8.2-10
|
||||
- Add missing #include <stdlib.h> for C99 compatibility
|
||||
|
||||
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.2-9
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.2-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.2-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.2-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.2-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.2-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.2-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.2-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Tue Apr 9 2019 Orion Poplawski <orion@nwra.com> - 1.8.2-1
|
||||
- Update to 1.8.2
|
||||
|
||||
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.1.2c-12
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Fri Jul 20 2018 Orion Poplawski <orion@nwra.com> - 1.8.1.2c-11
|
||||
- Add BR gcc
|
||||
|
||||
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.1.2c-10
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.1.2c-9
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.1.2c-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||
|
||||
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.1.2c-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
|
||||
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.1.2c-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
||||
|
||||
* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.1.2c-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||
|
||||
* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.1.2c-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
||||
|
||||
* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.1.2c-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
||||
|
||||
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.1.2c-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
||||
|
||||
* Fri Nov 15 2013 - Orion Poplawski <orion@cora.nwra.com> - 1.8.1.2c-1
|
||||
- Update to 1.8.1.2c
|
||||
|
||||
* Wed Oct 16 2013 - Orion Poplawski <orion@cora.nwra.com> - 1.8.1.2b-1
|
||||
- Update to 1.8.1.2b
|
||||
|
||||
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.1.2a-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||
|
||||
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.1.2a-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
|
||||
|
||||
* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.1.2a-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
|
||||
|
||||
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.1.2a-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
|
||||
|
||||
* Fri Jul 29 2011 - Orion Poplawski <orion@cora.nwra.com> - 1.8.1.2a-1
|
||||
- Update to 1.8.1.2a
|
||||
|
||||
* Thu May 26 2011 - Orion Poplawski <orion@cora.nwra.com> - 1.8.1.0h-1
|
||||
- Update to 1.8.1.0h
|
||||
|
||||
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.1.0d-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||
|
||||
* Sat Oct 2 2010 - Orion Poplawski <orion@cora.nwra.com> - 1.8.1.0d-1
|
||||
- Update to 1.8.1.0d
|
||||
|
||||
* Mon May 17 2010 - Orion Poplawski <orion@cora.nwra.com> - 1.8.1.0b-1
|
||||
- Update to 1.8.1.0b
|
||||
|
||||
* Tue Mar 30 2010 - Orion Poplawski <orion@cora.nwra.com> - 1.8.0.13f-1
|
||||
- Update to 1.8.0.13f
|
||||
|
||||
* Wed Feb 24 2010 - Orion Poplawski <orion@cora.nwra.com> - 1.8.0.13e-1
|
||||
- Update to 1.8.0.13e
|
||||
|
||||
* Thu Sep 24 2009 - Orion Poplawski <orion@cora.nwra.com> - 1.8.0.13d-1
|
||||
- Update to 1.8.0.13d
|
||||
|
||||
* Mon Aug 24 2009 - Orion Poplawski <orion@cora.nwra.com> - 1.8.0.13b-1
|
||||
- Update to 1.8.0.13b
|
||||
|
||||
* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.0.12u-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||
|
||||
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.0.12u-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
||||
|
||||
* Thu Sep 4 2008 - Orion Poplawski <orion@cora.nwra.com> - 1.8.0.12u-1
|
||||
- Update to 1.8.0.12u
|
||||
|
||||
* Fri Feb 8 2008 - Orion Poplawski <orion@cora.nwra.com> - 1.8.0.12q-1
|
||||
- Update to 1.8.0.12q
|
||||
|
||||
* Thu Aug 23 2007 - Orion Poplawski <orion@cora.nwra.com> - 1.8.0.12o-2
|
||||
- Rebuild for BuildID
|
||||
|
||||
* Wed Aug 8 2007 - Orion Poplawski <orion@cora.nwra.com> - 1.8.0.12o-1
|
||||
- Update to 1.8.0.12o
|
||||
|
||||
* Tue Dec 5 2006 - Orion Poplawski <orion@cora.nwra.com> - 1.8.0.12g-2
|
||||
- Compile testbin with -lm, needed on x86_64
|
||||
|
||||
* Fri Nov 17 2006 - Orion Poplawski <orion@cora.nwra.com> - 1.8.0.12g-1
|
||||
- Update to 1.8.0.12g
|
||||
- Ship testbin.c, testbin.f, and lang.grb for local testing
|
||||
|
||||
* Thu Nov 16 2006 - Orion Poplawski <orion@cora.nwra.com> - 1.8.0.12b-2
|
||||
- Add check
|
||||
|
||||
* Wed Nov 15 2006 - Orion Poplawski <orion@cora.nwra.com> - 1.8.0.12b-1
|
||||
- Initial version
|
||||
1
dead.package
Normal file
1
dead.package
Normal file
|
|
@ -0,0 +1 @@
|
|||
epel8-playground decommissioned : https://pagure.io/epel/issue/136
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
The builtin output formats for wgrib are
|
||||
|
||||
binary: single precision CPU native format
|
||||
ieee: single precision big-endian IEEE (32 bits)
|
||||
grib:
|
||||
text:
|
||||
|
||||
Someone had the need to produce double precision output. One
|
||||
may question their wisdom because probably all GRIB data have
|
||||
less precision than the single precision floating point
|
||||
format. Nevertheless it was easy to modify wgrib to output
|
||||
double precision floating point numbers as the standard binary
|
||||
format. (Writing dp ieee is much more difficult.)
|
||||
|
||||
|
||||
|
||||
Kludge number 102:
|
||||
|
||||
Edit the file wgrib.c by changing all occurances of float
|
||||
to double. Change the line
|
||||
|
||||
#include <double.h>
|
||||
|
||||
back to
|
||||
|
||||
#include <float.h>
|
||||
|
||||
Remember that you must change ALL occurances of "float" and
|
||||
that word may occur more than once on a line.
|
||||
|
||||
Compile normally and if all goes well, the "-bin" option
|
||||
will now produce double precision floating output. Don't
|
||||
forget the default format is "-bin".
|
||||
|
||||
Note: The kludge looks good but hasn't been examined with
|
||||
a fine-tooth comb. I should probably change "float" to
|
||||
FLOAT and use a typedef. However, this change is really
|
||||
low priority.
|
||||
|
||||
|
||||
END OF KLUDGE NUMBER 102
|
||||
|
||||
110
formats.txt
110
formats.txt
|
|
@ -1,110 +0,0 @@
|
|||
|
||||
wgrib v1.2 Wesley Ebisuzaki
|
||||
Portable Grib decoder for NMC Reanalysis
|
||||
|
||||
The program wgrib reads GRIB data and writes out data in the
|
||||
following different formats: text, GRIB, IEEE and binary (native cpu format).
|
||||
The easiest of the formats to read is text followed by binary, IEEE and
|
||||
finally GRIB. All except the GRIB format allows two flavors,
|
||||
with and without headers. You may be wondering why wgrib supports
|
||||
IEEE and GRIB. The IEEE was added so that the CRAY could produce
|
||||
`easy to read' binary files, and the GRIB option was added so that
|
||||
wgrib could extract and reorder records in a grib file.
|
||||
|
||||
|
||||
|
||||
|
||||
Text Format
|
||||
|
||||
|
||||
(grid 1) (nx) (ny) grid dimensions
|
||||
(grid value)
|
||||
(grid value)
|
||||
...
|
||||
(grid value) nx*ny values
|
||||
(grid 2) (nx) (ny) grid dimensions
|
||||
(grid value)
|
||||
(grid value)
|
||||
...
|
||||
(grid value) nx*ny values
|
||||
...
|
||||
|
||||
|
||||
Binary and IEEE, no header
|
||||
|
||||
(grid 1) (binary float value) grid value
|
||||
(binary float value)
|
||||
...
|
||||
(binary float value) nx*ny values
|
||||
|
||||
(grid 2) (binary float value)
|
||||
(binary float value)
|
||||
...
|
||||
(binary float value) nx*ny values
|
||||
etc
|
||||
|
||||
The no-header format is not a recommended format to use.
|
||||
The format does not indicate the size of the grid. If your program
|
||||
makes a mistake on the grid dimension, you could get interesting results.
|
||||
However, some fortran compilers require this format for binary files (Cray,
|
||||
ABSoft under AmigaOS). In addition, GrADs likes the binary/no-header
|
||||
format.
|
||||
|
||||
|
||||
|
||||
Binary and IEEE, with header
|
||||
|
||||
|
||||
(grid 1) (binary integer) nx*ny*sizeof(float)
|
||||
(binary float value)
|
||||
...
|
||||
(binary float value) nx*ny values
|
||||
(binary integer) nx*ny*sizeof(float)
|
||||
|
||||
(grid 2) (binary integer) nx*ny*sizeof(float)
|
||||
(binary float value)
|
||||
...
|
||||
(binary float value) nx*ny values
|
||||
(binary integer) nx*ny*sizeof(float)
|
||||
|
||||
|
||||
The binary-with-header format is commonly used by UNIX
|
||||
fortrans for their binary files. Some MS-DOS fortran compilers
|
||||
also support this format. The CRAY fortran supports the IEEE
|
||||
format by the "assign -Ff77 -Nieee u:iunit" command.
|
||||
|
||||
|
||||
Spectral Data
|
||||
|
||||
The format for spectral data is similar to the gridded data except
|
||||
nx = 2 * number of complex coefficients, and ny = 1. As you would
|
||||
expect, the real part is followed by the imaginary part. For more
|
||||
details, consult the GRIB format specifications.
|
||||
|
||||
Organization of the Grid
|
||||
|
||||
Standard NMC practice is to store the grids in fortran order
|
||||
starting from the north and working southward, and on the 0E and
|
||||
working eastward. No effort has been made in wgrib to implement
|
||||
the scan order option in GRIB. For lat-long grids, the dimensions
|
||||
are 144 x 73. The first point is 90N 0E, the second point is
|
||||
90N 2.5E, and you can figure out the rest. For Gaussian grids, the
|
||||
dimensions are 192 x 94. The first grid point is at 88.542N 0E,
|
||||
the second grid point is at 88.542N 1.875E. In theory, the Gaussian
|
||||
latitudes (for a Gaussian grid) are determined by the zeros of
|
||||
a long polynomial. In practice, the Gaussian latitudes are almost
|
||||
equally spaced. For plotting purposes, I assume that the Gaussian
|
||||
latitudes have a spacing of (88.542 - -88.542)/(94 - 1) degrees of
|
||||
latitude.
|
||||
|
||||
The above description of the grid format only applies to this
|
||||
version of Reanalysis. Future Reanalysis products may have different
|
||||
resolutions. If you use wgrib for non-Reanalysis products, then
|
||||
you are on your own. GRIB allows you to define specialized grids
|
||||
in different scanning orders. wgrib may or may not correctly
|
||||
decode these GRIB files and definitely will not try to make sense
|
||||
of the scanning order.
|
||||
|
||||
|
||||
Note: undefined values are set to 9.999e20.
|
||||
(see UNDEFINED in bds.h and/or all.c)
|
||||
|
|
@ -1,175 +0,0 @@
|
|||
v1.6 update 5/98 update 9/03
|
||||
|
||||
-H Option
|
||||
-- ------
|
||||
|
||||
Some people have fortran/C programs which read the binary/IEEE
|
||||
output from wgrib. They found that they needed a header to
|
||||
identify each record. I can see the need to identify each
|
||||
record but my choice would to have the fortran/C program
|
||||
open two files, the data file and the corresponding inventory.
|
||||
However, people have different styles.
|
||||
|
||||
The -H option adds a "universal" header to the binary/IEEE
|
||||
file. The header is "universal" because it contains all the
|
||||
meta-data (PDS and GDS). Nobody can complain that I left out
|
||||
some crucial information from the header.
|
||||
|
||||
The PDS (Product Definition Section) and GDS (Grid Definition
|
||||
Section) are documented in the GRIB references such as Office
|
||||
Note 388 by John Stackpole (available from the NCEP ftp site).
|
||||
|
||||
|
||||
Output Format
|
||||
|
||||
Case 1: (GRIB file has GDS)
|
||||
|
||||
integer: length of PDS + 4
|
||||
character*4: "PDS "
|
||||
PDS sequence of bytes
|
||||
integer: length of PDS + 4
|
||||
|
||||
integer: length of GDS + 4
|
||||
character*4: "GDS "
|
||||
GDS sequence of bytes
|
||||
integer: length of GDS + 4
|
||||
|
||||
(decoded GRIB message/record)
|
||||
|
||||
Case 2: (missing GDS)
|
||||
|
||||
integer: length of PDS + 4
|
||||
character*4: "PDS "
|
||||
PDS sequence of bytes
|
||||
integer: length of PDS + 4
|
||||
|
||||
integer: length of 4
|
||||
character*4: "GDS "
|
||||
integer: length of 4
|
||||
|
||||
(decoded GRIB message/record)
|
||||
|
||||
When the output file is IEEE, the "integer" is big-endian
|
||||
four byte integer. Otherwise it is the native format
|
||||
integer.
|
||||
|
||||
As you can see, the "universal" header is really two f77-style
|
||||
headers. The first header contains the string "PDS " along with
|
||||
the PDS. The second header contains the string "GDS " along with
|
||||
the GDS (if present).
|
||||
|
||||
The main complication in reading this header is that it is
|
||||
variable length. C programs will have no problems. Reading
|
||||
the file in fortran as an unformatted sequential file will
|
||||
require a trick.
|
||||
|
||||
c
|
||||
c sample of reading the PDS in a file created using
|
||||
c -H (include PDS & GDS) and -h (f77 style headers, default)
|
||||
c
|
||||
c example: wgrib -d 1 -H grib_file -o dump
|
||||
c
|
||||
|
||||
character*1 pds(100),c4(4),gds(1000)
|
||||
open(unit=1,file='dump',form='unformatted')
|
||||
c
|
||||
c Read "PDS " and Length of the PDS
|
||||
read(1) c4, (pds(i),i=1,3)
|
||||
c
|
||||
c Check for letters "PDS " in PDS
|
||||
if (c4(1).ne.'P') goto 9999
|
||||
if (c4(2).ne.'D') goto 9999
|
||||
if (c4(3).ne.'S') goto 9999
|
||||
if (c4(4).ne.' ') goto 9999
|
||||
c Calculate length of variable PDS
|
||||
lenpds=ichar(pds(1))*256*256+ichar(pds(2))*256+ichar(pds(3))
|
||||
c
|
||||
c Print out length
|
||||
write(*,*) 'Length of variable PDS in the header=', lenpds
|
||||
c
|
||||
c Backspace
|
||||
backspace(1)
|
||||
c
|
||||
c Read PDS using the length information
|
||||
read(1) c4, (pds(i),i=1,lenpds)
|
||||
c
|
||||
c Convert a character argument to an integer based on the character position
|
||||
c in the collating sequence
|
||||
idog1=ichar(pds(13))
|
||||
idog2=ichar(pds(14))
|
||||
idog3=ichar(pds(15))
|
||||
c
|
||||
write(6,20)idog1,idog2,idog3
|
||||
20 format('PDS :',i10,1x,i5,1x,i6)
|
||||
c
|
||||
c --------------------------------------------------------------------------
|
||||
c Read "GDS " and Length of the GDS
|
||||
read(1) c4, (gds(i),i=1,3)
|
||||
c
|
||||
c Check for letters "GDS " in the GDS
|
||||
if (c4(1).ne.'G') goto 9999
|
||||
if (c4(2).ne.'D') goto 9999
|
||||
if (c4(3).ne.'S') goto 9999
|
||||
if (c4(4).ne.' ') goto 9999
|
||||
c
|
||||
c Calculate length of variable GDS
|
||||
lengds=ichar(gds(1))*256*256+ichar(gds(2))*256+ichar(gds(3))
|
||||
c
|
||||
c Print out length
|
||||
write(*,*) 'Length of variable GDS in the header=', lengds
|
||||
c
|
||||
c Backspace
|
||||
backspace(1)
|
||||
c
|
||||
c Read GDS using the length information
|
||||
read(1) c4, (gds(i),i=1,lengds)
|
||||
c
|
||||
c Convert a character argument to an integer based on the character position
|
||||
c in the collating sequence
|
||||
idog1=ichar(gds(13))
|
||||
idog2=ichar(gds(14))
|
||||
idog3=ichar(gds(15))
|
||||
c
|
||||
write(6,22)idog1,idog2,idog3
|
||||
22 format('GDS: ',i10,1x,i5,1x,i6)
|
||||
c
|
||||
STOP
|
||||
c
|
||||
c Error Warning
|
||||
9999 write(*,*) 'Error in beginning of PDS or GDS'
|
||||
|
||||
STOP
|
||||
END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-dwdgrib OPTION
|
||||
-------- ------
|
||||
|
||||
The code for this option was submitted by Hulmut P. Frank (8/03) and completely
|
||||
rewritten by WNE for inclusion to wgrib v1.8.0.4. DWD (Deutscher Wetterdienst,
|
||||
the german weather service) has a particular formatting of grib files:
|
||||
|
||||
0 (4 bytes)
|
||||
rec_len #1 (4 byte integer, big endian, length of grib msg #1 in bytes)
|
||||
grib msg #1
|
||||
rec_len #1 (4 byte integer, big endian, length of grib msg #1 in bytes)
|
||||
rec_len #2 (4 byte integer, big endian, length of grib msg #2 in bytes)
|
||||
grib msg #2
|
||||
rec_len #2 (4 byte integer, big endian, length of grib msg #2 in bytes)
|
||||
...
|
||||
rec_len #N (4 byte integer, big endian, length of grib msg #N in bytes)
|
||||
grib msg #N
|
||||
rec_len #N (4 byte integer, big endian, length of grib msg #N in bytes)
|
||||
0 (4 bytes)
|
||||
|
||||
This format looks like a f77 format of grib with a leading/trailing zeros. Of
|
||||
course, this format is perfectly legal grib and older wgribs could read the dwd files.
|
||||
With v1.8.04, wgrib can write dwd format grib files.
|
||||
|
||||
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
|
||||
Decoding GRIB Data 7/97
|
||||
|
||||
(Conversion to IEEE by wgrib)
|
||||
|
||||
|
||||
GRIB is a format used to store binary data. While there are several other
|
||||
competing formats (IEEE, CDF, Net-CDF, etc), GRIB has been endorsed by
|
||||
the WMO and is the primary format at the operational centers (ECMWF,
|
||||
NCEP). GRIB has the advantages of being both an international standard
|
||||
and more space efficient than its main competing formats.
|
||||
|
||||
|
||||
A simple-to-use grib decoder can be obtained from wesley.ncep.noaa.gov
|
||||
/pub/wgrib/wgrib.c (source code)
|
||||
|
||||
(for NCEP users) The latest compiled versions can be found at
|
||||
|
||||
/wd5/wd51/rl51we/bin/wgrib (Cray YMP)
|
||||
~wd51we/bin.sun/wgrib (Sun workstation)
|
||||
~wd51we/bin.sgi/wgrib (SGI workstation)
|
||||
~wd51we/bin.hp/wgrib (HP workstation)
|
||||
~wd51we/bin.linux/wgrib (x86 linux)
|
||||
/wd2/cpc/cdrom/PROGRAMS/WGRIB/WGRIB.EXE (PC version, on Cray YMP)
|
||||
|
||||
Documentation and directions for compiling wgrib can be found at
|
||||
ftp://wesley.ncep.noaa.gov/pub/wgrib.
|
||||
|
||||
|
||||
The first step in decoding GRIB data is a file inventory. The simplest
|
||||
method is to type
|
||||
% wgrib -s grib_file -s is for the simple output format
|
||||
|
||||
Output format (-s option)
|
||||
field 1: record number
|
||||
field 2: position of record within the file
|
||||
field 3: time (yymmddhh)
|
||||
field 4: variable (see /wd2/ln/map/data/grib1.kpds5.vsn21 on the Cray YMP)
|
||||
field 5: level/layer
|
||||
following fields: description of record
|
||||
ex. mean, variance, forecast, analysis, etc
|
||||
|
||||
Now suppose we want to extract the 50 mb zonal winds for all dates. The
|
||||
following commands extract the data on a UNIX computer as f77 IEEE data.
|
||||
Note that zonal winds have the name "UGRD" in the file inventory.
|
||||
|
||||
% wgrib -s grib_file | grep ":UGRD:" | grep ':50 mb:' | wgrib -i -s -ieee -h grib_file
|
||||
|
||||
To understand the previous command, you need to consider all the steps.
|
||||
wgrib -s grib_file
|
||||
creates a simple file inventory
|
||||
in this example '-s' is optional
|
||||
grep ":UGRD:"
|
||||
selects only the records with ":UGRD:" in the record description
|
||||
grep ':50 mb:'
|
||||
selects only the records with ":50 mb:" in the record description
|
||||
note that ":50 mb:" was used rather than "50 mb" as the latter
|
||||
would also match the 850 mb level.
|
||||
wgrib -i -s -ieee -h grib_file
|
||||
-i ... read a file inventory
|
||||
-s ... short description of records written
|
||||
-ieee ... IEEE format numbers
|
||||
-h ... f77-style headers (default), -nh for no headers
|
||||
by default, the output format is binary with headers. On
|
||||
workstations, this is usually the "f77 IEEE" format which is
|
||||
often compatible with UNIX fortran programs.
|
||||
|
||||
|
||||
To convert all the records to a binary format with f77 style headers:
|
||||
% wgrib -s grib_file | wgrib -s -i grib_file
|
||||
|
||||
To determine the dimension and type of grid used in record N, type,
|
||||
|
||||
%wgrib -V -o /dev/null -d N grib_file
|
||||
|
||||
-V ... verbose output
|
||||
-o /dev/null ... write output (dump file) to bottomless pit
|
||||
-d N ... dump record N
|
||||
|
||||
NCEP's convention for fields produced by the MRF (operational forecasts,
|
||||
Reanalysis) is for the fields to be on a lat-long or Gaussian grid. The
|
||||
fields start at the northern most latitude and at the Greenwich meridian
|
||||
and go eastward. The data is stored in the fortran scanning order.
|
||||
This can be verified by using the -V option of wgrib which will tell you
|
||||
the dimension of the fields and how it is arranged.
|
||||
|
||||
A quick summary of the wgrib's options can be obtained by executing wgrib
|
||||
with no arguments. The undefined value is 9.999e20 (version 1.6.0) and
|
||||
more documentation can be found at ftp://wesley.ncep.noaa.gov/pub/wgrib.
|
||||
on the Cray-YMP at /wd2/cpc/cdrom/PROGRAMS/WGRIB/.
|
||||
|
||||
BIN
land.grb
BIN
land.grb
Binary file not shown.
37
misc.txt
37
misc.txt
|
|
@ -1,37 +0,0 @@
|
|||
Time Format updated 5/24/2004
|
||||
|
||||
|
||||
The time format is pretty obvious to me but that doesn't help
|
||||
the average person.
|
||||
|
||||
sec = seconds
|
||||
min = minute
|
||||
hr = hour
|
||||
d = day
|
||||
mon = month
|
||||
yr = year
|
||||
decade = 10 years
|
||||
normal = climatology (WMO standard is 30 years)
|
||||
|
||||
anl = analysis
|
||||
ave = average
|
||||
diff = difference
|
||||
fcst = forecast
|
||||
rms = averaged rms value
|
||||
fcst clim = forecast climatology (see Nave for number of years)
|
||||
same-hour,rms = averaged rms value only using quantities
|
||||
with the same hour/minute as reference time
|
||||
|
||||
ex.
|
||||
ave@1d = average taken at 1 day intervals
|
||||
The number in the average is Nave
|
||||
ave@1yr = average taken at 1 year intervals
|
||||
(this replaces "clim" notation)
|
||||
rms@1yr = average RMS value with average taken
|
||||
on values 1 year apart
|
||||
|
||||
|
||||
------------ removed 5/25/2004 ----------------
|
||||
clim = climatology (average over N years)
|
||||
clim (diurnal) = climatology (average over N years, hour important)
|
||||
|
||||
263
porting.txt
263
porting.txt
|
|
@ -1,263 +0,0 @@
|
|||
|
||||
wgrib v1.6 12/97 Wesley Ebisuzaki
|
||||
Portable Grib decoder Revised 4/2007, 8/2014
|
||||
|
||||
|
||||
|
||||
Introduction:
|
||||
|
||||
|
||||
The program wgrib is written in standard (ANSI/ISO) C. The last
|
||||
report of a compiler not being able to handle wgrib was several years
|
||||
ago. The code requires, at minimum, a 32-bit computer. (A user did
|
||||
port the code to a 286 but that was years ago.) However, if you plan
|
||||
to work with 2+ GB files, you should use a 64-bit computer (compile
|
||||
with 64-bit integers).
|
||||
|
||||
Compiling:
|
||||
|
||||
Version 1.6 introduces a compile-time option "DEF_T62_NCEP_TABLE".
|
||||
For the operational version of wgrib, DEF_T62_NCEP_TABLE=opn while
|
||||
Reanalysis uses DEF_T62_NCEP_TABLE=rean. For compatibility with
|
||||
earlier versions, the default is "reanalysis". The compile-time option
|
||||
determines whether to use the operational or reanalysis GRIB table for
|
||||
the T62 model when the subcenter is zero. Of course, the default can
|
||||
be changed at run time by the -ncep_opn and -ncep_rean options.
|
||||
|
||||
Compiling wgrib with the default option (Reanalysis):
|
||||
|
||||
ibm/sp (32 bit ints): c89 -O2 -o wgrib wgrib.c
|
||||
ibm/sp (64 bit ints): c89 -O2 -q64 -o wgrib wgrib.c
|
||||
apparently on some machines, try
|
||||
ibm/sp (32 bit ints): c89 -O2 -o wgrib wgrib.c -lm
|
||||
ibm/sp (64 bit ints): c89 -O2 -q64 -o wgrib wgrib.c -lm
|
||||
sun: acc -o wgrib wgrib.c -lm
|
||||
sun: gcc -o wgrib wgrib.c -lm
|
||||
(note: sun's cc is not an ANSI C compiler [ed this is a really old
|
||||
statement, may not be true today])
|
||||
cray C90: cc -o wgrib wgrib.c
|
||||
sgi: cc -o wgrib wgrib.c -lm
|
||||
hp risc: gcc -o wgrib wgrib.c -lm
|
||||
hp risc: cc -Aa -o wgrib wgrib.c -lm
|
||||
68K amiga: sc link math=ieee output=wgrib wgrib.c
|
||||
linux: gcc -o wgrib wgrib.c -lm
|
||||
OS X (Mavericks): install XCode, cc -O2 -o wgrib wgrib.c -lm
|
||||
Visual C++.net: (B. DeTracey 1/2006)
|
||||
|
||||
Visual C++.net compiling instructions. No optimisations. No debugging
|
||||
information.
|
||||
|
||||
From the Visual Studio .NET 2003 Command Prompt:
|
||||
1)Change to your wgrib source directory
|
||||
2)Compile and link using:
|
||||
cl /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /EHsc /ML /GS /W3
|
||||
/Wp64 /TP /Fewgrib.exe *.c
|
||||
|
||||
If you get an error message related to a file named wgrib_c.c, delete this
|
||||
file and try again. This file resulted from your previous attempt to build
|
||||
the application from within the Visual Studio .NET 2003 IDE (Windows
|
||||
application interface).
|
||||
|
||||
|
||||
Compiling wgrib for the operational version:
|
||||
|
||||
ibm/sp (32 bit ints): c89 -O2 -o wgrib -DDEF_T62_NCEP_TABLE=opn wgrib.c
|
||||
ibm/sp (64 bit ints): c89 -O2 -q64 -o wgrib
|
||||
-DDEF_T62_NCEP_TABLE=opn wgrib.c
|
||||
sun: acc -o wgrib -DDEF_T62_NCEP_TABLE=opn wgrib.c -lm
|
||||
sun: gcc -o wgrib -DDEF_T62_NCEP_TABLE=opn wgrib.c -lm
|
||||
cray: cc -o wgrib -DDEF_T62_NCEP_TABLE=opn wgrib.c
|
||||
sgi: cc -o wgrib -DDEF_T62_NCEP_TABLE=opn wgrib.c -lm
|
||||
hp: gcc -o wgrib -DDEF_T62_NCEP_TABLE=opn wgib.c -lm
|
||||
hp: cc -Aa -o wgrib -DDEF_T62_NCEP_TABLE=opn wgrib.c -lm
|
||||
|
||||
The value of "DEF_T62_NCEP_TABLE" can be defined as opn, opn_nowarn,
|
||||
rean (default), and rean_nowarn.
|
||||
|
||||
|
||||
Optimization:
|
||||
|
||||
You may have noticed that the previous compilation command lines
|
||||
do not include any optimizations. My suggestion is that one should
|
||||
avoid the compiler optimizations unless one is willing to make sure
|
||||
that the compiler optimizations do not break the code. Sure compilers
|
||||
have improved but optimization bugs still occur.
|
||||
|
||||
2014 revision: C compilers have improved and most C compilers
|
||||
enable some optimizations by default. I haven't encountered any
|
||||
problems with the default optimizations. I haven't played with
|
||||
higher levels of optimization because the program is more limited
|
||||
by the disk than CPU speeds.
|
||||
|
||||
|
||||
|
||||
Problems Compiling:
|
||||
|
||||
|
||||
If you have problems with compiling, you are probably using a non-standard
|
||||
C compiler or the compiler has been improperly set up.
|
||||
|
||||
Another possibility is that the source code was corrupted. There has
|
||||
been one case where the source code was obtained using a browser and the
|
||||
code would not compile cleanly. The problem was solved by obtaining the
|
||||
source code using anonymous FTP from
|
||||
|
||||
ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/wgrib.c
|
||||
|
||||
I suspect that the browser was converting the <cr> in to <cr><lf> which
|
||||
was incompatible with their C compiler.
|
||||
|
||||
If you have problems linking ("undefined ....") then you are not
|
||||
including a necessary library. On many UNIX machines, you need to include
|
||||
the math library ('-lm' option).
|
||||
|
||||
If you have problems compiling wgrib, consult a local wizard. I have
|
||||
compiled the code on sun, cray, sgi, hp, linux, amiga and even DOS. Others
|
||||
have used NT, OS/2, NEC supercomputers and Alpha (unix). If you have
|
||||
problem with one of the previous machine or any 32/64 bit unix machine, it is
|
||||
likely that you have a local problem.
|
||||
|
||||
|
||||
MS-DOS and Windows
|
||||
|
||||
revised 1/2006:
|
||||
The cygwin port of gcc compiles wgrib and that compiler is open source.
|
||||
At one time, it was rare for a Windows compiler to compile wgrib correctly.
|
||||
However, I haven't had a report of a deficient Windows compiler for
|
||||
several years.
|
||||
|
||||
|
||||
|
||||
Testing wgrib:
|
||||
|
||||
|
||||
Test 1:
|
||||
After you've compiled wgrib is simply type "wgrib." You should see the
|
||||
help screen which should be similar to the following:
|
||||
|
||||
|
||||
Portable Grib decoder for NCEP Operations etc.
|
||||
it slices, dices v1.6.0 prelim 2 (7-01-97) Wesley Ebisuzaki
|
||||
usage: ./wgrib [grib file] [options]
|
||||
|
||||
Inventory/diagnostic output selection
|
||||
-s/-v/-V short inventory/verbose inventory/very verbose non-inventory
|
||||
(default) regular inventory
|
||||
Options for inventory/diagnostic output
|
||||
-PDS/-PDS10/-GDS/-GDS10 print PDS/GDS in hex/dec
|
||||
-verf print forecast verification time
|
||||
-4yr/-ncep_opn/-ncep_rean see documentation
|
||||
|
||||
Decoding Grib selection
|
||||
-d [record number] dump record number
|
||||
-p [byte position] dump record at byte position
|
||||
-i dump controlled by stdin (inventory list)
|
||||
(none) no decode .. inventory only
|
||||
Options for decoding Grib
|
||||
-text/-ieee/-bin/-grib dump to a text/ieee/bin/grib file
|
||||
-h/-nh dump will have headers (default)/no headers
|
||||
-H dump will include PDS and GDS (-bin/-ieee only)
|
||||
-append append to dump file
|
||||
-o [file] output file name, 'dump' is default
|
||||
|
||||
|
||||
The first line of the "help" page should include the phrase "NCEP Operations"
|
||||
or "NCEP/NCAR Reanalysis" which indicates the default GRIB table (see
|
||||
"Compiling.")
|
||||
|
||||
Test 2:
|
||||
The second test is to see if wgrib will read a grib file. If the file
|
||||
"land.grb" is not with the source code, a copy can be obtained from
|
||||
ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/land.grb. 'land.grb' is the land-sea
|
||||
mask used by Reanalysis.
|
||||
|
||||
enter: wgrib land.grb
|
||||
see:
|
||||
1:0:d=87010100:LAND:kpds5=81:kpds6=1:kpds7=0:TR=0:P1=0:P2=0:TimeU=1:sfc:anl:NAve=1
|
||||
|
||||
Test 3
|
||||
The third test is read the grib file and decode the numeric data.
|
||||
|
||||
enter: wgrib land.grb -V
|
||||
see:
|
||||
1:0:date 1987010100 LAND kpds5=81 kpds6=1 kpds7=0 levels=(0,0) grid=255 sfc anl:
|
||||
LAND=Land-sea mask [1=land; 0=sea]
|
||||
timerange 0 P1 0 P2 0 TimeU 1 nx 192 ny 94 GDS grid 4 num_in_ave 1 missing 0
|
||||
center 7 subcenter 2 process 80 Table 2
|
||||
gaussian: lat 88.542000 to -88.542000
|
||||
long 0.000000 to -1.875000 by 1.875000, (192 x 94) scan 0 bdsgrid 1
|
||||
min/max data 0 1 num bits 4 BDS_Ref 0 DecScale 1 BinScale 0
|
||||
|
||||
|
||||
Test 4:
|
||||
This tests the wgrib's ability to extract a record and write it as a text file.
|
||||
|
||||
enter: wgrib land.grb -d 1 -text
|
||||
see: 1:0:d=87010100:LAND:sfc:anl:NAve=1
|
||||
The first 10 lines of the file 'dump' should be:
|
||||
192 94
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
|
||||
Text 5
|
||||
In this test a record is written as a f77 big-endian IEEE file.
|
||||
enter: wgrib land.grb -d 1 -ieee -s
|
||||
see: 1:0:d=87010100:LAND:sfc:anl:NAve=1
|
||||
Should find a file 'dump' which is which is 72200 bytes long.
|
||||
|
||||
Test 6
|
||||
In this test a record is written as native-format binary file.
|
||||
enter: wgrib land.grb -d 1 -s
|
||||
see: 1:0:d=87010100:LAND:sfc:anl:NAve=1
|
||||
Should find a new file 'dump' which is often 72200 bytes long.
|
||||
|
||||
Test 7
|
||||
Reading a binary file using a C program.
|
||||
Run test 6 to convert the land mask into a binary file.
|
||||
Compile the program testbin.c using a C compiler.
|
||||
Some possible compilation lines are
|
||||
|
||||
cc -o testbin testbin.c -lm (normal unix C)
|
||||
gcc -o testbin testbin.c -lm (GNU C)
|
||||
acc -o testbin testbin.c -lm (Sun's acc)
|
||||
sc link math=ieee output=testbin testbin.c (SAS C)
|
||||
|
||||
The program reads the binary file "dump" and should print out the land mask.
|
||||
|
||||
|
||||
Test 8
|
||||
Reading the binary file with fortran.
|
||||
Run test 6 to convert the land mask into a binary file.
|
||||
Compile and run the program testbin.f using your fortran 77 compiler.
|
||||
If everything went correctly, you should see the land mask. If it
|
||||
works, good. If it doesn't work, too bad. You are on your own.
|
||||
Suggestions: (1) if all else fails, read the fortran manual (RTFM),
|
||||
(2) change fortran compilers, (3) try reading the data with no
|
||||
headers (-nh option in wgrib), (4) give up and read the text dump
|
||||
instead. This step is very system dependent. Consult your local expert.
|
||||
|
||||
|
||||
|
||||
Support:
|
||||
|
||||
No support is necessary because the instructions are crystal clear
|
||||
and the code is bug free. If my directions are as clear as Mississippi
|
||||
mud, think how understandable my verbal directions will be! (Yes, I've
|
||||
been known to talk without nouns, adverbs and even adjectives.) Please,
|
||||
do not waste your dime and call me asking how to compile or link wgrib.
|
||||
You have to ask some one who knows YOUR SYSTEM. If tests 1-6 are
|
||||
successful then wgrib works. Test 7 is simply a test of your fortran
|
||||
compiler and you have to read the documentation.
|
||||
|
||||
4/2007: updated URLs for land.grb and test programs
|
||||
|
||||
If you really think that you found a bug in the code, then send me
|
||||
an e-mail (wesley.ebisuzaki@noaa.gov).
|
||||
|
||||
1
sources
1
sources
|
|
@ -1 +0,0 @@
|
|||
SHA512 (wgrib.c.v1.8.5) = c7c851e608fb46e467d68540dab03d5991f6f20129d3c70075c9eb4ea1fd0a0101fe56b9358a0e96c869e4dc65c28c5e07dd1bf81b745ab369fa3ea957a380be
|
||||
58
testbin.c
58
testbin.c
|
|
@ -1,58 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#define nx 192
|
||||
#define ny 94
|
||||
#define dx 3
|
||||
#define dy 3
|
||||
/* v1.2 wesley ebisuzaki */
|
||||
#define INT int
|
||||
/* if the default integer is 16 bit then */
|
||||
/* #define INT long int */
|
||||
|
||||
void main() {
|
||||
FILE *in;
|
||||
float land[nx];
|
||||
INT header;
|
||||
int i, j;
|
||||
char c;
|
||||
|
||||
printf("Test creation of a binary file\n");
|
||||
printf("before running this program, enter wgrib land.grb -d 1\n");
|
||||
|
||||
if ((in = fopen("dump","rb")) == NULL) {
|
||||
printf("could not find file: dump\n");
|
||||
printf("did you run wgrib land.grb -d 1?\n");
|
||||
exit(8);
|
||||
}
|
||||
|
||||
if (fread((void *) &header, sizeof(INT), 1, in) != 1) {
|
||||
printf("no data?\n");
|
||||
exit(8);
|
||||
}
|
||||
|
||||
if (header != nx*ny*sizeof(float)) {
|
||||
printf("wrong header size: %d\n", (int) header);
|
||||
exit(8);
|
||||
}
|
||||
|
||||
for (j = 0; j < ny; j++) {
|
||||
if (fread((void *) land, sizeof(float), nx, in) != nx) {
|
||||
printf("not enough data\n");
|
||||
exit(8);
|
||||
}
|
||||
for (i = 0; i < nx; i++) {
|
||||
c = '?';
|
||||
if (floor(land[i]*10000.0+0.5) == 0) c = ' ';
|
||||
if (floor(land[i]*10000.0+0.5) == 10000.0) c = 'x';
|
||||
if (c == '?') {
|
||||
printf("bad value: %g\n",land[i]);
|
||||
exit(8);
|
||||
}
|
||||
if (i % dx == 0 && j % dy == 0) {
|
||||
putchar(c);
|
||||
}
|
||||
}
|
||||
if (j % dy == 0) putchar('\n');
|
||||
}
|
||||
printf("should see continents -- if you do, it works\n");
|
||||
}
|
||||
29
testbin.f
29
testbin.f
|
|
@ -1,29 +0,0 @@
|
|||
c
|
||||
c sample program to read binary file in fortran
|
||||
c this may or may not work! (system dependent)
|
||||
c often works with UNIX fortrans
|
||||
c
|
||||
real array(192,94)
|
||||
character*1 line(192)
|
||||
|
||||
write(*,*) 'should first run wgrib -d 1 land.grb'
|
||||
|
||||
open(unit=1,file='dump',form='unformatted',status='old')
|
||||
read(1) array
|
||||
err=1e-6
|
||||
do 100 j = 1, 94
|
||||
do 90 i = 1, 192
|
||||
if (array(i,j).eq.0.0) then
|
||||
line(i) = ' '
|
||||
else if (abs(array(i,j)-1.0).lt.err) then
|
||||
line(i) = 'x'
|
||||
else
|
||||
write(*,*) 'bad values:',array(i,j)
|
||||
stop
|
||||
endif
|
||||
90 continue
|
||||
if (mod(j,3).eq.0) write(*,*) (line(i),i=1,192,3)
|
||||
100 continue
|
||||
write(*,*) 'should see continents'
|
||||
stop
|
||||
end
|
||||
35
testbin.out
35
testbin.out
|
|
@ -1,35 +0,0 @@
|
|||
Test creation of a binary file
|
||||
before running this program, enter wgrib land.grb -d 1
|
||||
|
||||
xx xxxx
|
||||
x xx xxxxxxxxx
|
||||
xxxxxxxxxxxxx xx x xxx xxxxxx
|
||||
xxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xx xxx xx
|
||||
xxx xxxxxxxxxxxxxxxxxxxxxxx x x xxxxxxxxx x
|
||||
xxxxxxxxxxxxxxxxxxxxxxx x xxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxx x
|
||||
x x x x xxxxxxxxxxxxxx xxxxxxxxxx x
|
||||
xxxxx xxxxxxxxxxxx x xxxxxxxx x
|
||||
xxx x xxxxxxxxxxxxxxx xxxxxx x
|
||||
xxxxxxxxxx xxxxxxxxxxx xx xx
|
||||
xxxxxxx xxx xxx xx x x xx
|
||||
xxxxxxxxx x xx xx xx
|
||||
xxxxxxxxx xxx xx
|
||||
xxxxxxx x xxxx
|
||||
xxxxxx x x xxxxxxx
|
||||
xxxxx xxxxxxxx
|
||||
xxxxx x xxxxxxx
|
||||
xxxx x xxxxx xxxxx
|
||||
xxx xxxxxxx xxxx
|
||||
xx xxxxxxx xxx
|
||||
xx xxx
|
||||
xx
|
||||
xx
|
||||
x
|
||||
|
||||
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x x
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxx xxxxx
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
should see continents -- if you do, it works
|
||||
407
tricks.wgrib
407
tricks.wgrib
|
|
@ -1,407 +0,0 @@
|
|||
6/04 Tricks for wgrib
|
||||
------ --- -----
|
||||
|
||||
Every once in a while, someone requests that I add some feature
|
||||
to wgrib. Usually I say no because I'm lazy. I then give the
|
||||
excuse that feature is already available with a bit of UNIX trickery.
|
||||
|
||||
|
||||
(1) How do I convert the entire file to binary?
|
||||
|
||||
wgrib grib_file | wgrib -i grib_file -o binary_file
|
||||
faster: wgrib grib_file -d all -o binary_file
|
||||
|
||||
(2) How do I get a verbose listing of the 20th record only?
|
||||
|
||||
wgrib -V -d 20 grib_file
|
||||
|
||||
(2') How about a verbose listing without a dump file?
|
||||
|
||||
wgrib -V -d 20 grib_file -o /dev/null
|
||||
|
||||
|
||||
(3) How do I extract the 20th and 30th records?
|
||||
|
||||
wgrib grib_file | egrep "(^20:|^30:)" | wgrib -i grib_file -o binary_file
|
||||
|
||||
(3'') How do I extract the 1, 9, 17, ... records into a new grib file?
|
||||
|
||||
wgrib grib_file | awk '{if ($1 % 8 == 1) print $0}' FS=':' |
|
||||
wgrib -s grib_file -i -grib -o new_grib_file
|
||||
|
||||
(3''') How do I remove the 2, 10, 18, ... records from a grib file?
|
||||
|
||||
wgrib grib_file | awk '{if ($1 % 8 != 2) print $0}' FS=':' |
|
||||
wgrib -s grib_file -i -grib -o new_grib_file
|
||||
|
||||
(4) How do I extract the first 10 records as a grib file?
|
||||
|
||||
wgrib grib_file | head -n 10 | wgrib -i grib_file -grib -o new_grib_file
|
||||
(note: on older systems you may have to use "head -10")
|
||||
|
||||
(4') How do I extract records 34-66 from a file as a grib file?
|
||||
|
||||
Here is an example of an awk filter.
|
||||
|
||||
wgrib -s grib_file | awk '{if ($1 > 33 && $1 < 67) print $0}'
|
||||
FS=':' | wgrib -i grib_file -o new_file -grib
|
||||
|
||||
FS=':' implies that arguments are separated by colons. As
|
||||
a result, the record number is the first argument ($1).
|
||||
The variable "$0" is the entire input line. Isn't awk fun?
|
||||
|
||||
(4'') How do I extract records 1 to 48 into separate binary files.
|
||||
|
||||
------------- start of script ----------
|
||||
#!/bin/sh
|
||||
# argument 1 = file name
|
||||
|
||||
file=$1
|
||||
gstart=1
|
||||
gend=48
|
||||
|
||||
# create inventory
|
||||
inv=$file.inv
|
||||
wgrib -s $file >$inv
|
||||
|
||||
# loop
|
||||
i=$gstart
|
||||
while [ "$i" -le "$gend" ]
|
||||
do
|
||||
grep "^$i:" <$inv | wgrib -i $file -s -o $file.bin.$i
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
-------------- end of script -----------
|
||||
|
||||
|
||||
(5) How do I extract the records on or after April 15, 1998?
|
||||
|
||||
Extracting a specific date is easy; i.e.,
|
||||
|
||||
wgrib -s -4yr grib_file | grep "d=1998041500" | wgrib -i grib_file
|
||||
-grib -o new_gribfile -s
|
||||
|
||||
To get a range of dates, you can use awk,
|
||||
|
||||
wgrib -s -4yr grib_file | awk '{d=substr($3,3); if (d >=2002091300
|
||||
&& d < 2002092000 ) print $0}' FS=':' | wgrib -i grib_file
|
||||
-s -grib -o new_gribfile
|
||||
|
||||
In the above example, awk was used to filter the inventory. BTW
|
||||
you should be using a new version of awk (gnu awk, nawk).
|
||||
|
||||
|
||||
(6) How do I extract the 500 Heights from a file (grib->grib)?
|
||||
|
||||
wgrib -s grib_file | grep ":HGT:500 mb:" | wgrib -i -grib \
|
||||
grib_file -o new_grib_file
|
||||
|
||||
|
||||
(7) How do I eliminate the 500 Heights from a file (grib->grib)?
|
||||
|
||||
wgrib -s grib_file | grep -v ":HGT:500 mb:" | wgrib -i -grib \
|
||||
grib_file -o new_grib_file
|
||||
|
||||
|
||||
(8) How do I extract the winds and temperatures from a file (grib->grib)?
|
||||
|
||||
wgrib -s grib_file | egrep "(:UGRD:|:VGRD:|:TMP:)" | wgrib -i -grib \
|
||||
grib_file -o new_grib_file
|
||||
|
||||
|
||||
(9) How do I extract the winds and temperatures from a file and get a
|
||||
specific order?
|
||||
|
||||
The GRID data can come in any order. For example if you try
|
||||
|
||||
wgrib grib_file | egrep "(:UGRD:|:VGRD:|:TMP:)" | wgrib -i \
|
||||
grib_file -o new_grib_file
|
||||
|
||||
the data will come in order of record number. NCEP, for example,
|
||||
considers the order of GRIB records irrelevant. So you can get
|
||||
UGRD before VGRD on Monday and UGRD after VGRD on Fridays. To
|
||||
get a specified order, you need to sort the inventory.
|
||||
|
||||
wgrib grib_file | egrep "(:UGRD:|:VGRD:|:TMP:)" | \
|
||||
(sort program) | grib_file -o new_grib_file
|
||||
|
||||
To get the output in sorted synoptic order, you can do
|
||||
|
||||
wgrib grib_file | egrep "(:UGRD:|:VGRD:|:TMP:)" | \
|
||||
sed 's/kpds7=//' | sort -t: -k3,3 -k4,4 -k6,6 -k7n,7 | \
|
||||
grib_file -o new_grib_file
|
||||
|
||||
The previous example uses the posix sort program.
|
||||
|
||||
|
||||
(10) How many records does this file have?
|
||||
|
||||
wgrib -s grib_file | wc -l
|
||||
|
||||
|
||||
(11) What is the range of values in this file?
|
||||
|
||||
wgrib -V grib_file | grep max
|
||||
|
||||
(11') What is the maximum of the 500 mb Heights for each record.
|
||||
|
||||
wgrib grib_file -s | grep ":HGT:500 mb:" | wgrib -i -V grib_file \
|
||||
-o /dev/null | grep max | awk '{print $4}'
|
||||
|
||||
For the minimum values, change "print $4" to "print $3".
|
||||
|
||||
|
||||
(12) How do I do a file transpose (rearrange the order) ?
|
||||
|
||||
See ts2synoptic. This script could be pared down to 3 lines!
|
||||
Other file transposes are done in a similar manner and many
|
||||
only need one line! Unfortunately finding that one line
|
||||
may require some effort.
|
||||
|
||||
|
||||
(13) My grib file has junk at the start/end. How do I get rid of it?
|
||||
|
||||
wgrib old_gribfile | wgrib old_gribfile -i -grib -o clean_gribfile
|
||||
faster: wgrib -d all old_gribfile -grib -o new_gribfile
|
||||
|
||||
(14) Don't forget that you can 'cat' grib files. That gives you another
|
||||
tool for making your own tricks.
|
||||
|
||||
|
||||
(15) My grib file has same data on different grids. How do I filter
|
||||
out all the grids but one? (new answer)
|
||||
|
||||
Currently the grid type is only shown in the -V (very verbose)
|
||||
option which is not useful in "inventory" operations. However,
|
||||
the grid type is contained in the GDS.
|
||||
|
||||
The -GDS options will add the GDS to the inventory. Each grid has
|
||||
a different GDS, so it is easy to filter out the different grids.
|
||||
For example, suppose that we find that our desired grid has a GDS of
|
||||
"GDS=00002000ff0000900049015f9000000080815f908009c409c409c40000000000"
|
||||
Then it is easy to remove all the other grids by
|
||||
|
||||
wgrib grib_file -GDS | grep \
|
||||
"GDS=00002000ff0000900049015f9000000080815f908009c409c409c40000000000" \
|
||||
| wgrib grib_file -i -grib -o new_grib_file
|
||||
|
||||
The GDS parameter can be found using wgrib.
|
||||
|
||||
|
||||
(15') My grib file has same data on different grids. How do I filter
|
||||
out all the grids but one?
|
||||
|
||||
The prespecified grid number is stored in octet 5 of the PDS. The
|
||||
following creates an inventory with the grid number (in hexidecimal)
|
||||
|
||||
wgrib gribfile -PDS -s | \
|
||||
sed 's/PDS=............\(..\)[0-9a-f]*:*/grid=\1h:/'
|
||||
|
||||
(15'') See (19) and (20)
|
||||
|
||||
|
||||
(16) I execute the following commands to extract TMP, and HGT to
|
||||
separate files. Can I make if faster.
|
||||
|
||||
wgrib pgb.grb | grep ":TMP:" | wgrib -i pgb.grb -grib -o tmp.grb
|
||||
wgrib pgb.grb | grep ":HGT:" | wgrib -i pgb.grb -grib -o hgt.grb
|
||||
|
||||
Try:
|
||||
|
||||
wgrib pgb.grb > inventory
|
||||
cat inventory | grep ":TMP:" | wgrib -i pgb.grb -grib -o tmp.grb
|
||||
cat inventory | grep ":HGT:" | wgrib -i pgb.grb -grib -o hgt.grb
|
||||
rm inventory
|
||||
|
||||
Of course, the second line from the previous example could be replaced by
|
||||
grep ":TMP:" inventory | wgrib -i pgb.grb -grib -o tmp.grb
|
||||
|
||||
|
||||
(17) My file is using ECMWF parameter table xxx which is not built into
|
||||
wgrib. What should be done?
|
||||
|
||||
(1) Adding a new table to wgrib is fairly simple. Just don't
|
||||
expect me to type it in. Submissions should in user-table
|
||||
format (grib number:name:description).
|
||||
|
||||
(2) If you have a electronic copy of the GRIB table, you could
|
||||
make a user table. (See documentation "usertables.")
|
||||
|
||||
(3) Changing the "last-resort" grib table is easy. Get a copy
|
||||
of ectab_xxx from ftp://wesley.ncep.noaa.gov/pub/wgrib,
|
||||
change the first line to "-1:-1:-1:-1" can then have the
|
||||
environment variable "GRIBTAB" point to the modified file.
|
||||
(See documentation "usertables")
|
||||
|
||||
(18) Can wgrib write the decoded GRIB file to stdout? Right now
|
||||
I create a temporary file (dump) which is read by another
|
||||
program. Instead I would like to do
|
||||
|
||||
process_data < wgrib grib_file -d all -bin [option to write to stdout]
|
||||
|
||||
instead of the slower
|
||||
|
||||
wgrib grib_file -d all -bin -o dump
|
||||
process_data <dump
|
||||
|
||||
The trick to avoid temporary files is to use "named" pipes which
|
||||
are available on modern UNIX machines. Named pipes are, of course,
|
||||
pipes with names, but look like a conventional file to the user program.
|
||||
To use a named pipe,
|
||||
|
||||
$ mkfifo mypipe make a named pipe
|
||||
$ wgrib grib_file -d all -bin -o mypipe & write to "mypipe"
|
||||
"&" to put in background
|
||||
$ process_data <mypipe read from named pipe
|
||||
|
||||
The named pipes are much faster than temporary files because
|
||||
the data are not written to disk but transferred through
|
||||
a memory buffer.
|
||||
|
||||
|
||||
(19) I want an inventory in my format. Should I send you my modifications
|
||||
to wgrib? If you add a new feature such as ECMWF ensemble information,
|
||||
I'll consider adding the code to wgrib. However, if you are simply
|
||||
rearranging the order of the data, it is doubtful that I'll include
|
||||
your modifications.
|
||||
|
||||
You are free to modify wgrib for your own purposes. However, the
|
||||
drawback is that your version of wgrib will slowly get out of date.
|
||||
Personally I would write a perl script.
|
||||
|
||||
In this example, someone wanted an inventory with the
|
||||
|
||||
1. record number
|
||||
2. grid number
|
||||
3. parameter type
|
||||
4. yyyymmddhhmm (note: minutes is not a standard wgrib output)
|
||||
5. p1 (time information)
|
||||
6. p2 (time information)
|
||||
7. time_range
|
||||
8. level
|
||||
9. min/max data
|
||||
|
||||
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
#
|
||||
# this script reads a "wgrib -V -PDS gribfile"
|
||||
# and creates a gribscan-like inventory
|
||||
# run by: my_inventory.pl grib_file
|
||||
|
||||
# for perl beginners
|
||||
# \d matches any digit
|
||||
# \d* matches any number of digits
|
||||
# \s matches any whitespace
|
||||
# \S matches any non-whitespace
|
||||
|
||||
# this program works by reading in the very verbose inventory until
|
||||
# it reads a blank line (end of record) and the parses the inventory
|
||||
# and writes what it wants
|
||||
|
||||
# the tricky part is getting the minutes field which
|
||||
# is not part of the normal inventory
|
||||
|
||||
open (IN, "wgrib -PDS10 -V $ARGV[0] |");
|
||||
|
||||
$line="";
|
||||
while (<IN>) {
|
||||
chomp; # strip record separator
|
||||
$line="$line $_";
|
||||
|
||||
# check if end of verbose inventory
|
||||
if ("$_" eq "") {
|
||||
$_=$line;
|
||||
|
||||
/rec (\d*):/;
|
||||
$rec = $1;
|
||||
|
||||
/ grid=(\d*) /;
|
||||
$grid = $1;
|
||||
|
||||
/ kpds5=(\d*) /;
|
||||
$kpds5 = $1;
|
||||
|
||||
/:date (\d*) /;
|
||||
$date = $1;
|
||||
|
||||
/ timerange (\d*) /;
|
||||
$timerange = $1;
|
||||
|
||||
/ P1 (\d*) /;
|
||||
$p1 = $1;
|
||||
|
||||
/ P2 (\d*) /;
|
||||
$p2 = $1;
|
||||
|
||||
/PDS10\S*=(\s*\S*){18}/;
|
||||
$minute=$1;
|
||||
|
||||
/ grid=\d* (\S*) /;
|
||||
$level = $1;
|
||||
|
||||
/ min\/max data (\S*) (\S*) /;
|
||||
$min = $1;
|
||||
$max = $2;
|
||||
|
||||
|
||||
printf "%3d %3d %3d %10d%2.2d %3d %3d %3d %7s min/max of data %9.9g %9.9g\n",
|
||||
$rec, $grid, $kpds5, $date, $minute, $p1, $p2, $timerange,
|
||||
$level, $min, $max;
|
||||
|
||||
$line="";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
(20) I want convert the very verbose (-V) into an inventory.
|
||||
|
||||
The -V option produces much more information but this output
|
||||
is on multple lines. So it cannot be used as input to wgrib.
|
||||
However, it is possible to create an -V inventory with sed.
|
||||
|
||||
Suppose I want the max value to be in the inventory. The -V option
|
||||
gives data like this. (Only the 1st record is shown.)
|
||||
|
||||
bash-2.05a$ wgrib -d 1 AWIP3200.1987070709
|
||||
1:0:d=87070709:MSLET:kpds5=130:kpds6=102:kpds7=0:TR=0:P1=0:P2=0:TimeU=1:MSL:anl:NAve=0
|
||||
bash-2.05a$ wgrib -d 1 AWIP3200.1987070709 -V
|
||||
rec 1:0:date 1987070709 MSLET kpds5=130 kpds6=102 kpds7=0 levels=(0,0) grid=221 MSL anl: bitmap: 990 undef
|
||||
MSLET=Mean sea level pressure (ETA model) [Pa]
|
||||
timerange 0 P1 0 P2 0 TimeU 1 nx 349 ny 277 GDS grid 3 num_in_ave 0 missing 0
|
||||
center 7 subcenter 0 process 84 Table 131 scan: EW/SN winds(grid)
|
||||
Lambert Conf: Lat1 1.000000 Lon1 -145.500000 Lov -107.000000
|
||||
Latin1 50.000000 Latin2 50.000000 LatSP 0.000000 LonSP 0.000000
|
||||
North Pole (349 x 277) Dx 32.463000 Dy 32.463000 scan 64 mode 8
|
||||
min/max data 100034 102632 num bits 12 BDS_Ref 100034 DecScale 0 BinScale 0
|
||||
|
||||
The following will give an inventory
|
||||
|
||||
wgrib -V AWIP3200.1987070709 | egrep "(^rec|max data)" | sed '$!N;s/\n/ /' | \
|
||||
sed -e 's/^rec //' -e 's/date /d=/' -e 's/ /:/' -e 's/ /:/'
|
||||
|
||||
The "wgrib -V" produces the inventory.
|
||||
The "egrep" picks up two lines, the first (necessary) and the line with the
|
||||
"max data" value (the one I want).
|
||||
The "sed '$!N;s/\n/ /'" combines pairs of lines.
|
||||
The last sed puts the line into a inventory format.
|
||||
|
||||
(21) How do I remove duplicate records (same PDS)
|
||||
|
||||
wgrib IN.grb -PDS | unique.pl | wgrib IN.grb -i -grib -o OUT.grb
|
||||
|
||||
where unique.pl is
|
||||
---------------------------------------------------------------
|
||||
#!/usr/bin/perl -w
|
||||
# print only lines where fields 3..N are different
|
||||
#
|
||||
while (<STDIN>) {
|
||||
chomp;
|
||||
$line = $_;
|
||||
$_ =~ s/^[0-9.]*:[0-9]*://;
|
||||
if (! defined $inv{$_}) {
|
||||
$inv{$_} = 1;
|
||||
print "$line\n";
|
||||
}
|
||||
}
|
||||
---------------------------------------------------------------
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
User Tables Wesley Ebisuzaki
|
||||
---- ------
|
||||
|
||||
GRIB files describe the contents (example, zonal wind, temperature) by
|
||||
a parameter table and parameter number. Since the size of the parameter
|
||||
table is limited to 255 entries, groups are finding (1) that they want
|
||||
to use their own parameter table and (2) large groups are finding that
|
||||
they have to use multiple parameter tables.
|
||||
|
||||
The parameter table used by wgrib is determined by (v1.5.0 and later)
|
||||
|
||||
use built-in tables
|
||||
use user-defined table if available
|
||||
use built-in NCEP-2 table (warning under certain conditions)
|
||||
|
||||
Alternatively, if wgrib is compiled with the "-D P_TABLE_FIRST"
|
||||
option, then the search order is,
|
||||
|
||||
use user-defined table if available
|
||||
use built-in tables
|
||||
use built-in NCEP-2 table (warning under certain conditions)
|
||||
|
||||
[This is the preferred search order for foreign-language parameter tables.]
|
||||
|
||||
|
||||
The name of the user-defined table is searched for in
|
||||
|
||||
1) the environment variable "GRIBTAB"
|
||||
2) the environment variable "gribtab"
|
||||
3) the file gribtab
|
||||
|
||||
Defining an environment variable depends on the operating system
|
||||
and on the shell.
|
||||
|
||||
example
|
||||
export GRIBTAB=~/data/gribtab (bash)
|
||||
setenv GRIBTAB ~/data/gribtab (csh)
|
||||
GRIBTAB=$HOME/data/gribtab ; export GRIBTAB (sh)
|
||||
|
||||
set GRIBTAB=c:\gribtab (windows)
|
||||
|
||||
|
||||
The format of the GRIBTAB file is
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-1:CENTER:SUBCENTER:PARAMETER_TABLE
|
||||
0:name:comment
|
||||
1:name:comment
|
||||
...
|
||||
255:name:comment
|
||||
|
||||
-1:CENTER:SUBCENTER:PARAMETER_TABLE
|
||||
0:name:comment
|
||||
1:name:comment
|
||||
...
|
||||
255:name:comment
|
||||
|
||||
(etc.)
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
"CENTER" is number between 0 and 255 with -1 being a wildcard.
|
||||
"SUBCENTER" is number between 0 and 255 with -1 being a wildcard.
|
||||
"PARAMETER_TABLE" is number between 0 and 255 with -1 being a wildcard.
|
||||
"name" is a string with the variable name "TMP".
|
||||
"comment" is a string such describing the variable such as "temperature [K]"
|
||||
Any missing parameter lines will be given a generic name and comment.
|
||||
|
||||
Each GRIB record contains the center (PDS octet 5), subcenter (PDS octet 26)
|
||||
and parameter_table (PDS octet 4). The names and comments from the
|
||||
first section to match the center-subcenter-parameter_name in the PDS
|
||||
are used. Currently the subcenter are not used in matching the
|
||||
built-in tables. This will probably change when sub-centers start using
|
||||
their own parameter tables.
|
||||
|
||||
Policy
|
||||
|
||||
The wgrib code is easily modified to add new built-in parameter tables.
|
||||
New tables will be added under the following conditions: a reasonable
|
||||
number of users, I don't have to type it in and the table is reasonably
|
||||
stable. (Rules subject to change.)
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
diff -up ./testbin.c.c99 ./testbin.c
|
||||
--- ./testbin.c.c99 2023-05-25 20:35:37.836859284 -0600
|
||||
+++ ./testbin.c 2023-05-25 20:41:27.615727850 -0600
|
||||
@@ -1,3 +1,4 @@
|
||||
+#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#define nx 192
|
||||
diff -up ./testbin.c.c99 ./testbin.c
|
||||
--- ./testbin.c.c99 2023-05-25 20:44:31.571380482 -0600
|
||||
+++ ./testbin.c 2023-05-25 20:45:41.341058038 -0600
|
||||
@@ -9,7 +9,7 @@
|
||||
/* if the default integer is 16 bit then */
|
||||
/* #define INT long int */
|
||||
|
||||
-void main() {
|
||||
+int main() {
|
||||
FILE *in;
|
||||
float land[nx];
|
||||
INT header;
|
||||
74
wgrib.spec
74
wgrib.spec
|
|
@ -1,74 +0,0 @@
|
|||
Name: wgrib
|
||||
Version: 1.8.5
|
||||
Release: %autorelease
|
||||
Summary: Manipulate, inventory and decode GRIB files
|
||||
|
||||
License: LicenseRef-Fedora-Public-Domain
|
||||
URL: https://www.cpc.ncep.noaa.gov/products/wesley/wgrib.html
|
||||
Source0: https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/wgrib.c.v%{version}
|
||||
Source1: https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/Changes
|
||||
Source2: https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/NOTICE
|
||||
Source3: https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/double_prec.txt
|
||||
Source4: https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/formats.txt
|
||||
Source5: https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/formats_update.txt
|
||||
Source6: https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/grib2ieee.txt
|
||||
Source7: https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/misc.txt
|
||||
Source8: https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/porting.txt
|
||||
Source9: https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/usertables.txt
|
||||
Source10: https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/tricks.wgrib
|
||||
Source11: https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/land.grb
|
||||
Source12: https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/testbin.c
|
||||
Source13: https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/testbin.f
|
||||
Source14: testbin.out
|
||||
# Include <stdlib.h> and set int return for main() for C99 compliance
|
||||
Patch0: wgrib-c99.patch
|
||||
BuildRequires: gcc
|
||||
ExcludeArch: %{ix86}
|
||||
|
||||
|
||||
%description
|
||||
WGRIB is a program to manipulate, inventory and decode GRIB files.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -c -T
|
||||
cp %SOURCE0 wgrib.c
|
||||
cp %SOURCE1 .
|
||||
cp %SOURCE2 .
|
||||
cp %SOURCE3 .
|
||||
cp %SOURCE4 .
|
||||
cp %SOURCE5 .
|
||||
cp %SOURCE6 .
|
||||
cp %SOURCE7 .
|
||||
cp %SOURCE8 .
|
||||
cp %SOURCE9 .
|
||||
cp %SOURCE10 .
|
||||
cp %SOURCE11 .
|
||||
cp %SOURCE12 .
|
||||
cp %SOURCE13 .
|
||||
%patch -P0 -p0 -b .c99
|
||||
|
||||
|
||||
%build
|
||||
gcc %{build_cflags} %{build_ldflags} -o wgrib wgrib.c
|
||||
|
||||
|
||||
%install
|
||||
install -d -m 755 $RPM_BUILD_ROOT%{_bindir}
|
||||
install -m 755 wgrib $RPM_BUILD_ROOT%{_bindir}/
|
||||
|
||||
|
||||
%check
|
||||
./wgrib land.grb -d 1
|
||||
gcc %{build_cflags} %{build_ldflags} -o testbin testbin.c -lm
|
||||
./testbin > testbin.out && diff %SOURCE14 testbin.out
|
||||
|
||||
|
||||
|
||||
%files
|
||||
%doc Changes *.txt tricks.wgrib testbin.[cf] land.grb
|
||||
%{_bindir}/wgrib
|
||||
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
Loading…
Add table
Add a link
Reference in a new issue