[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20010126: dcgrib2 problem decoding mrf




>From: "Arthur A. Person" <address@hidden>
>Organization: UCAR/Unidata
>Keywords: 200101261553.f0QFrIX19200

>Hi...
>
>We switched to gempak5.6.a yesterday afternoon and the overnight decoding
>of the mrf grid 003 appears in error.  To verify this, I used a raw grib
>data file (mrf.010126.drfmr.T00Z.PGrbF00) as test input to the old dcgrib
>decoder and plotted it with gempak5.6.a and got a correct result.  When I
>repeated this with dcgrib2 and plotted it, the field looks like a 500mb
>height (I tested 500mb height at the 00Z forecast hour only) but was very
>smooth with little or no correlation to reality.  Can you give me a clue
>what might be going on here?
>
>                                        Thanks.
>
>                                          Art.
>
>Arthur A. Person
>Research Assistant, System Administrator
>Penn State Department of Meteorology
>email:  address@hidden, phone:  814-863-1563
>


Art,

These international exchange grids have the GRIB scan mode in the
opposite sense from the other NCEP grids (jdrct = 0 rather than 1).
So, they'll have to be unpacked and flipped before storage
since the display programs can't handle this.

I've attatched an updated version of:
$NAWIPS/unidata/ldmbridge/dcgrib2/dcwppg.c

You should be able to replace the current version with this version. Then,
rebuild dcgrib2 with:

cd $NAWIPS/unidata/ldmbridge/dcgrib2
make clean
make all
make install
make clean

Thanks for pointing this out (same will exist for Grid 002).

Steve Chiswell
#include <stdio.h>
#include <string.h>
#include <math.h>

#include <gemprm.h>
#include <gbcmn.h>
#include <uscore.h>

#ifdef UNDERSCORE
#define na_rhdr na_rhdr_
#define gd_wppg gd_wppg_
#define lv_ccrd lv_ccrd_
#endif

extern int idrct,jdrct,consec;

void dcwppg(iflno,xgrid,subgrid)
int iflno,*xgrid,subgrid;
{
int lengrd,iret;
int ighdr[LLGDHD];
int itime[3],iaccm,ilevel[2];
char gdattm[2][20],parm[12];
int level[2],ivcord,iuscal;
float rmsval;
int lens,i;
float scale;
float difval=0,ref;
int loglev,numerr;
int nocoord=0,noparm=0;
int _itrue = TRUE, _ifalse = FALSE, packmeth=MDGGRB;
int reindex=0;
static char errgrp[]="DCGRIB";
char errstr[128],vcoord[20];

for(i=0;i<LLGDHD;i++) ighdr[i] = 0;

gb_ftim(itime,&iaccm,&iret);

gb_vlev(ilevel,&iret);


na_rhdr ( itime, &iaccm, &ilevel, &pds.vcoord, &pds.parameter, &pds.version, 
          gdattm, &level, &ivcord, parm, &iuscal, &rmsval, &pds.pdse, 
pds.extension, &iret,
          sizeof(gdattm[0]),sizeof(parm),strlen(pds.extension) );

errstr[0] = '\0';

if(iret == 0)
   {
   lengrd = (bds.length - 11) / sizeof(int);
   if(((bds.length - 11) % sizeof(int)) > 0) lengrd = lengrd + 1;

   ref = bds.ref_value * pow ( 10.0, (double) (iuscal - pds.dec_scale) );
   scale  = pow ( 2.0, (double) bds.binary_scale ) * pow ( 10.0, (double) 
(iuscal - pds.dec_scale) );

   if((idrct != 0)||(jdrct != 1)||(consec != 0)) reindex = 1;

   if(gds.grid_proj == 203)
      dcfillgrid(iflno,xgrid,lengrd,rmsval,iuscal, ighdr, gdattm, level, 
ivcord, parm,&iret);
   else if((subgrid != 0)||(pds.isbms)||(bds.num_bits<2)||(reindex != 0))
      dcsubgrid(iflno,xgrid,lengrd,rmsval,iuscal, ighdr, gdattm, level, ivcord, 
parm, subgrid);
   else
      {
      gd_wppg ( &iflno, xgrid, &lengrd, &gds.kx, &gds.ky, ighdr, gdattm, level, 
&ivcord, parm, 
         &_itrue, &packmeth, &bds.num_bits, &_ifalse, &ref, &scale, &difval, 
&iret,20,12 );
      }
   numerr = iret;
   loglev = 2;
   }
else
   {
   /* 3 no parm found in table */
   /* 2 no vert found */
   if(iret == 3) noparm = 1;
   if(iret == 2) nocoord = 1;
   numerr = iret;
   loglev = 0;
   }

if(noparm != 0)
   sprintf(errstr,"%03d\0",pds.parameter);
else
   {
   st_lstr(parm,&lens,&iret,12);
   strncat(errstr,parm,lens);
   }

strncat(errstr," ",1);

st_lstr(gdattm[0],&lens,&iret,20);
strncat(errstr,gdattm[0],lens);
strncat(errstr," ",1);

if(nocoord != 0)
   sprintf(errstr+strlen(errstr),"%03d\0",pds.vcoord);
else
   {
   lv_ccrd(&ivcord,vcoord,&iret,sizeof(vcoord));
   st_lstr(vcoord,&lens,&iret,sizeof(vcoord));
   strncat(errstr,vcoord,lens);
   }

sprintf(errstr+strlen(errstr)," %4d %4d %3d\0",level[0],level[1],pds.grid_id);

dc_wclg(loglev,errgrp,numerr,errstr,&iret);

}