g2gdf.pl in GrADS1.9

Mark Sponsler msponsler at COMCAST.NET
Thu Apr 10 13:16:39 EDT 2008


Hi Arlindo,
Very helpful suggestion concerning 'appending' the path using the ;%PATH% command versus just setting it fully.  Learn something new every day. And I want to thank you for taking so much time on this issue.  This version of Grads is true astounding - so much functionality packed into one easy to use app.


>I am still puzzled that you can run g2ctl.pl from the DOS command line.  Is
>the g2gdf.exe not working for you? When I type "g2gdf.pl" on my cmd.exe it
>pops the perl script right into notepad. If you are not using the .exe
>version of the perl scripts, which perl distribution of perl are you using?
>This is important info for my FAQ. Probably I don't have my .pl extension
>being handled by ActivateState perl.

On the machine that is locked down (no access to Control Panel to change the path): On the comand line I set path (correctly this time) and then try to run g2gdf.pl, g2ctl.pl, g2gdf.exe and g2ctl.exe (with no arguments) with results listed below.  Note that the 'exe' version of the apps just return directly to a command prompt where the perl version appear to actually navigate to the apps and returns useage info.  Finally I try to run g2gdf.pl with arguments and receive errors :

Perl is installed on the locked-down machine: Active Perl 5.8.8 Build 817


P:\>set PATH=c:/Program Files/PCGrADS19/win32;%PATH%

P:\>path
PATH=c:/Program Files/PCGrADS19/win32;C:\Perl\bin\;C:\orant\Ora81\bin\;C:\WINNT\
system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Attachmate\E!E2K\;C:\P
rogram Files\PCGrADS\win32e\;C:\Program Files\GMT\bin;C:\Program Files\wgrib2\

P:\>g2gdf.pl
Usage:
     g2gdf.pl [-h] [-0|-verf] [-o gdf_fname] [-I inv_fname]  grib2_filename   #
-h for a full man page

P:\>g2ctl.pl
C:\Program Files\PCGrADS19\win32\g2ctl.pl 0.0.3d  wesley ebisuzaki
 makes a Grads control file for grib files
 usage: C:\Program Files\PCGrADS19\win32\g2ctl.pl [options] [grib_file] [optiona
l index file] [optional pdef file] >[ctl file]
 -verf           .. use forecast verification times
 -0              .. use analysis times
 -365            .. 365 day calendar
 -ts[timestep]   .. set timestep for individual time files (e.g. -ts6hr)
 -lc             .. set lowercase option for parameter names
 -iso_profile    .. set z coordinate to ocean isotherms
 -prs_profile    .. set z coordinate to pressure (mb)
 -m_profile      .. set z coordinate to meters above ground/msl
 -no_profile     .. no z coordinates
 -raw            .. raw grid
 -iso_profile    .. make profile using subsurface isoterms
Note 1: the index file will be generated by the gribmap program, default: grib_f
ile.idx
Note 2: the pdef file is only generated for thinned lat-lon grids, default: grib
_file.pdef

P:\>g2ctl.exe

P:\>g2gdf.exe -o c:\grib\input_new\multi_1.gdf  -I c:\grib\input_new\multi_1.inv
 c:\grib\input_new\multi_1.wc_4m.t12z.grib2

P:\>g2gdf.pl -o c:\grib\input_new\multi_1.gdf  -I c:\grib\input_new\multi_1.inv
c:\grib\input_new\multi_1.wc_4m.t12z.grib2

   g2gdf - control file/inventory for "g2" extension

         Descriptor: c:\grib\input_new\multi_1.gdf
          Inventory: c:\grib\input_new\multi_1.inv
           Data Dir: c:\grib\input_new\
         Grib files: multi_1.wc_4m.t12z.grib2

Access is denied.
Big problem:
  either c:\grib\input_new\multi_1.wc_4m.t12z.grib2 is missing or not a grib file
  or wgrib2 is not on your path or wgrib2 is too old.
cannot create c:\grib\input_new\multi_1.gdf --- is g2ctl.pl on path? at C:\Program Files\PCGrADS19\win32\g2gdf.pl line 52.

P:\>

The other thing that maybe is occuring is on the locked-down machine is maybe it is locked so tight it just doesn't allow a command prompt to be called from another program????

--
Thanks,
Mark

-------------- Original message --------------
From: Arlindo da Silva <dasilva at ALUM.MIT.EDU>
On Thu, Apr 10, 2008 at 12:25 AM, Mark Sponsler <msponsler at comcast.net> wrote:

Hi Arlindo,
Sorry - I was not clear.

I'm using your latest build of GrADS19 with the new cygintl-3.dll installed

I built a windows batch file that contains the following 2 statements:

set PATH=c:/Program Files/PCGrADS19/win32/

You should never reset the PATH entirely but rather append to it:

set PATH=c:/Program Files/PCGGrADS19/win32;%PATH%

then type path to make sure the windows system dirs are still there. This way all your other system programs can be found.



g2gdf.pl -o C:/grib/input_new/wc4m.gdf -I C:/grib/input_new/wc4m.inv C:/grib/input_new/multi_1.wc_4m.t00z.grib2


I am still puzzled that you can run g2ctl.pl from the DOS command line.  Is the g2gdf.exe not working for you? When I type "g2gdf.pl" on my cmd.exe it pops the perl script right into notepad. If you are not using the .exe version of the perl scripts, which perl distribution of perl are you using? This is important info for my FAQ. Probably I don't have my .pl extension being handled by ActivateState perl.


I did not have the ability to set the environmnet variable via Control Panel>System>Advanced>Envionment Variables>etc... because I did not had admin rights on the machine.

Then I double click the bat file. And receive the error message indicated in the previous email.

I've been using this trick of setting the path to Grads19 in the batch file (like above) on all sorts of scripts where GrADS19 is installed on either a flash drive or just placed somewhere on the hard drive and where I have no admin rights and no ability to set path via Control Panel, and everything has been going quite smoothly.  A totally portable application, even if I have no admin rights to the machine.  So I figured running g2gdf.pl would be no different.

Intersting, but on a different machine which I do have admin rights, I set the path in Control Panel to PCGrads19/win32/ as normal
then run the following command in a batch file (same as first time but with the set PATH command commented out) and everything works fine!

REM set PATH=c:/Program Files/PCGrADS19/win32/
g2gdf.pl -o C:/grib/input_new/wc4m.gdf -I C:/grib/input_new/wc4m.inv C:/grib/input_new/multi_1.wc_4m.t00z.grib2

So this leads me to beleive that there is something in the perl or gdf script that is not virtualized to read the Path command in the batch file.

Likewise if I try and run g2ctl,pl with the path set in Control Panel everything works fine.  But if I try to set the Path in the bat file (and do not have it set in Control Panel) it errors out:

set PATH=c:/Program Files/PCGrADS19/win32/
g2ctl.pl C:/grib/input_new/multi_1.wc_4m.t00z.grib2
Can't spawn "cmd.exe": No such file or directory at C:\Program

You see, perl cannot find the windows system files, like cmd.exe the command interpreter it uses for issuing a system() call.

Files\PCGrADS19\win32\g2ctl.pl line 238.
Big problem:
  either C:/grib/input_new/multi_1.wc_4m.t00z.grib2 is missing or not a grib file
  or wgrib2 is not on your path or wgrib2 is too old.

Hope this is useful.  Just hoping all the functionality can be totally portable, but maybe I'm being unrealistic.


It should be just as portable as the rest, I can't think of a reason why not.


  Arlindo

--
Arlindo da Silva
dasilva at alum.mit.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20080410/77cd8a3b/attachment.html 


More information about the gradsusr mailing list