Hi Russ, There are a couple reasons why these products are not being decoded; one is simple to fix, the other, a bit more challenging. First, the $GEMTBL/grid/g2varswmo2.tbl needs to have an entry added for this type of GRIB2 product: 000 001 029 009 P of Snow Exceeding Amount % SN 0 -9999.00 Second, the function that builds the string for the GEMPAK parameter name needs to be rewritten to handle the case when the value of the target amount (in this case, .0254 meters + multiples thereof) gets translated into a string that has too many leading zeroes, causing the GEMPAK parameter names to not be unique for each target amount. I'm sure there is a cleaner way to do this, but I simply added a scale factor test in the function in the file $GEMPAK/source/griblib/gb/gb2prob.c: 25d24 < * K. Tyle/UAlbany 11/13 Updated case 1 sprintf format * 55,60d53 < /* < * Special Case if scale factor results in a number < * too large to fit in param string < */ < if (scale < -2.0 ) sfact= 1.0; < To get this incorporated into NAGRIB2, after you edit gb2prob.c in the $GEMPAK/source/griblib/gb directory, do the following: Type make (this will build the gb2prob.o file) Type ar rv $GEMLIB/gemlib.a gb2prob.o (this will update the gemlib.a library archive) cd to $GEMPAK/source/programs/na/nagrib2 Type make clean install Then give it a try!! I've attached the two files. Maybe Michael @ Unidata or Scott @ NCEP can determine a better method. My work is all based on the GEMPAK6.10 package, but suspect it will work for earlier versions of GEMPAK 6 as well. --Kevin _____________________________________________ Kevin Tyle, Systems Administrator Dept. of Atmospheric & Environmental Sciences University at Albany Earth Science 235, 1400 Washington Avenue Albany, NY 12222 Email: ktyle@xxxxxxxxxx Phone: 518-442-4578 _____________________________________________ -----Original Message----- From: gembud-bounces@xxxxxxxxxxxxxxxx [mailto:gembud-bounces@xxxxxxxxxxxxxxxx] On Behalf Of Russ Schumacher Sent: Wednesday, November 20, 2013 11:37 PM To: gembud@xxxxxxxxxxxxxxxx Subject: [gembud] WPC winter probabilities Hey gembuds, Has anyone successfully decoded the WPC winter precip probability GRIB files, which are located here: ftp://ftp.hpc.ncep.noaa.gov/pwpf/conus/pwpf_24hr/ ? When running them through NAGRIB2 I get the following errors: [GB 1] No GEMPAK parameter name defined for this grid. [GB -34] Could not convert GRIB2 message to GEMPAK grid. The GRIB2 messages looks like this, which I realize probably doesn't convert in a straightforward way to a GEMPAK field name: 1:0:d=2013112100:ASNOW:surface:CodeTable 4.11=missing:prob >0.0254 2:23442:d=2013112100:ASNOW:surface:CodeTable 4.11=missing:prob >0.0508 3:41685:d=2013112100:ASNOW:surface:CodeTable 4.11=missing:prob >0.1016 4:52983:d=2013112100:ASNOW:surface:CodeTable 4.11=missing:prob >0.1524 5:60796:d=2013112100:ASNOW:surface:CodeTable 4.11=missing:prob >0.2032 6:65559:d=2013112100:ASNOW:surface:CodeTable 4.11=missing:prob >0.3048 7:67086:d=2013112100:ASNOW:surface:CodeTable 4.11=missing:prob >0.4572 If there's an easy way to decode these, I'd appreciate you sending it along (but if not, it's not a huge deal -- the WPC's web graphics for these products are very nice.) Thanks! Russ -- Russ S. Schumacher Assistant Professor Department of Atmospheric Science Colorado State University e-mail: russ.schumacher@xxxxxxxxxxxxx phone: 970.491.8084 _______________________________________________ gembud mailing list gembud@xxxxxxxxxxxxxxxx For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/
#include "gb2def.h" void gb2_prob( gribfield *gfld, char *param ) /************************************************************************ * gb2_prob * * * * This function adds probability info to the GEMPAK parameter string. * * * * gb2_prob( gfld, param ) * * * * Input parameters: * * *gfld struct gribfield Decoded GRIB2 structure * * * * Input/Output parameters: * * *param char GEMPAK Parameter string * ** * * Log: * * D.W.Plummer/NCEP 2/96 New * * M. Linda/GSC 10/97 Corrected the prologue format * * S. Jacobs/NCEP 12/00 Added prototypes * * S. Gilbert/NCEP 12/04 Modified from gbensemble.c for use w/ * * GRIB2 * * S. Gilbert/NCEP 10/05 Corrected overwrite error w/ param name * * S. Chiswell/Unidata 4/07 Updated case 2 sprintf format * * K. Tyle/UAlbany 11/13 Updated case 1 sprintf format * ***********************************************************************/ { int prob_type; float lower, upper; double scale,sfact; char cpds[32]; int ext_flag, num; /*---------------------------------------------------------------------*/ ext_flag = 0; cpds[0] = '\0'; switch ( gfld->ipdtnum ) { case 5 : /* Probability fcst */ case 9 : /* Probability fcst */ ext_flag = 1; prob_type = gfld->ipdtmpl[17]; switch (prob_type) { case 0 : scale= (double)(-1.0*gfld->ipdtmpl[18]); sfact= pow((double)10.0,scale); lower = (float)(gfld->ipdtmpl[19]) * sfact; sprintf( cpds, "%04dPB", (int) lower ); break; case 1 : scale= (double)(-1.0*gfld->ipdtmpl[20]); sfact= pow((double)10.0,scale); /* * Special Case if scale factor results in a number * too large to fit in param string */ if (scale < -2.0 ) sfact= 1.0; upper = (float)(gfld->ipdtmpl[21]) * sfact; sprintf( cpds, "%04dPA", (int) upper ); break; case 2 : scale= (double)(-1.0*gfld->ipdtmpl[18]); sfact= pow((double)10.0,scale); lower = (float)(gfld->ipdtmpl[19]) * sfact; scale= (double)(-1.0*gfld->ipdtmpl[20]); sfact= pow((double)10.0,scale); upper = (float)(gfld->ipdtmpl[21]) * sfact; sprintf( cpds, "%04d%04d", (int) lower, (int) upper ); break; } break; } if ( ext_flag == 1 ) { num = 12 - strlen(param); strncat ( param, cpds, (size_t)num ); } return; }
Attachment:
g2varswmo2.tbl
Description: g2varswmo2.tbl
gembud
archives: