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

[GEMPAK #EQC-587799]: GEMPAK: problems converting my code to use DG,GD 5.9.4 libraries



David,

Yes, you can still use GD_CREF to create the file. An example you might find 
useful here is the
$NAWIPS/unidata/programs/gdradr/gdradr.f program which does something similar 
to what 
you are doing to create the file.

After you set the gdfile name with DG_NFIL, you will have to call DG_INXT
to initialize the time of your grid calculation prior to calling DG_NREL.
This complexity has 2 purposes:
   1) enabling time dependent templates to be used
   2) allowing grid computations involving different grid navigations (output / 
reference)

I have created an example program (with makefile) in a tarfile:
 http://www.unidata.ucar.edu/software/gempak/GEMPAK5.9/newgrid_example.tar.gz

This program creates a file called new_gempak_fil.gem, then loads some
dummy data into urel and vrel grids for conversion to unor and vnor and
then writes these north relative grids to the output file.

Using gdplot2 with the UNOR and VNOR grids, I did a quick test to output the 
grids
back to relative to ensure that U's were 5 and V's were 10,
 GDPFUN   = vr(vecn(unor,vnor))
 TYPE     = p

 GDPFUN   =  ur(vecn(unor,vnor))
 TYPE     = p

Let me know if you still have problems,

Steve Chiswell
Unidata User SUpport





> Hello,
> 
> I have been really struggling the past few days in trying to convert
> some FORTRAN code I have written (mm5togem) that uses GEMPAK DG and GD
> libraries to work with the new 5.9.4 versions.  I have found the
> migration document
> http://www.unidata.ucar.edu/software/gempak/GEMPAK5.9/GEMPAK_Grid_library_upgrade.html
> but have not been able to modify my code to work.  No matter what I
> have done, my call to dg_nrel to convert MM5's grid-relative winds to
> north-relative fails with this message:
> 
> [DG -10]  Internal grid list is full; simplify function.
> dg_nrel iret =           -10
> 
> Here are the essentials of what the code did before:
> 
> call ip_init(respond,iret)
> call ginitp(1,istat,iret)
> c     Build navigation block for our new file...
> CALL GR_MNAV  ( cproj, ihorz-icross, ivert-icross
> $        , xlatll, xlonll,
> $        xlatur, xlonur, angle1, angle2, angle3, angflg,
> +        rnvblk, iret )
> c     Build analysis block
> CALL GR_MBAN  ( deltan, deltax, deltay,
> +        gbnds, ebnds, ebnds, anlblk, iret )
> c     Create the grid file
> call gd_cref(outnam,navsz,rnvblk,ianlsz,anlblk,ihdrsz,maxgrd,
> &        igdfln,iret)
> call gr_snav(navsz,rnvblk,iret)
> call dg_init(0,rnvblk,'first',iret)
> c     read some mm5 data....
> ......
> c     convert MM5 grid-relative winds to north-relative
> call dg_nrel(unor(:,:,kk),vnor(:,:,kk)
> $        ,unor(:,:,kk),vnor(:,:,kk),iret)
> 
> 
> This always worked great.  The migration document seems pretty
> confusing as to whether or not I can even used gd_cref anymore.  I
> know I cannot use dg_init.  Here's my best guess at what I should
> have:
> 
> c     initialize GEMPAK user interface
> call ip_init(respond,iret)
> call ginitp(1,istat,iret)
> c     594 addtions
> call dg_intl(iret)
> print *,'iret from dg_intl = ',iret
> call dg_nfil ( '', outnam, iret)
> print *,'iret from dg_nfil = ',iret
> c     NOTE:
> c     NOTE: I am getting a -51 return since outnam does not exist yet
> c     NOTE:
> call dgc_flno (' ', igdfln, iret)
> print *,'dgc_flno iret = ',iret,' igdfln = ',igdfln
> c     Build navigation block for our new file...
> CALL GR_MNAV  ( cproj, ihorz-icross, ivert-icross
> $        , xlatll, xlonll,
> $        xlatur, xlonur, angle1, angle2, angle3, angflg,
> +        rnvblk, iret )
> c     Build analysis block
> CALL GR_MBAN  ( deltan, deltax, deltay,
> +        gbnds, ebnds, ebnds, anlblk, iret )
> c     Create the grid file
> call gd_cref(outnam,navsz,rnvblk,ianlsz,anlblk,ihdrsz,maxgrd,
> &        igdfln,iret)
> call gr_snav(navsz,rnvblk,iret)
> call dg_nfil ( outnam, outnam, iret)
> c
> C     I have tried using the gd_open command, it has made no difference
> c
> c         call gd_open( outnam, writefile, LLNANL, LLNNAV,
> c     $        igdfln, anlblk, rnvblk, maxgrd, iret)
> c         print *,'gd_open for ',outnam,' before nrel '
> c     $        ,' has iret = ',iret
> call dg_nrel(unor(:,:,kk),vnor(:,:,kk)
> $        ,unor(:,:,kk),vnor(:,:,kk),iret)
> if (iret .ne. 0) then
> print *,'dg_nrel iret = ',iret
> call bail_out('bad grid to north-relative conversion')
> endif
> 
> 
> The file does get created and the navigation and analysis blocks are
> fine, but the dg_nrel failure is fatal for my code.  My best guess as
> to what is going wrong here is that the DG library is now getting
> confused about what file to use.  There was no file, it had to be
> created, and it is empty.  In pre 5.9.4 code, the DG package got all
> of its navigation info with the gr_snav and dg_init calls, but now that
> information is not getting passed to DG.  This is my best guess, but I
> don't really find the error
> 
> [DG -10]  Internal grid list is full; simplify function.
> 
> to be much help since I do not know what 'grid list' it could be
> talking about and since there should be no reason to 'simplify
> function' dg_nrel.
> 
> I would vote for adding a few more examples to the migration document
> that help people figure out how to replace a dg_init call.
> 
> Any help you can provide would be greatly appreciated.
> 
> Thank you,
> 
> David
> --
> David Ovens            e-mail: address@hidden
> Research Meteorologist    phone: (206) 685-8108
> Dept of Atm. Sciences      plan: Real-time MM5 forecasting for the
> Box 351640                        Pacific Northwest
> University of Washington          http://www.atmos.washington.edu/mm5rt
> Seattle, WA  98195               Weather Graphics and Loops
> http://www.atmos.washington.edu/~ovens/loops
> 
> 


Ticket Details
===================
Ticket ID: EQC-587799
Department: Support GEMPAK
Priority: Normal
Status: Closed