pygridgen.Gridgen error

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Message
Author
fagundesmo
Posts: 51
Joined: Wed Dec 03, 2014 1:46 am
Location: University of Georgia

pygridgen.Gridgen error

#1 Unread post by fagundesmo »

Hi all,

I am learning how to make a simple grid to the Equator using pygridgen tool. Thus, it is normal that some error come up sometime so that it has shown me an error which I cannot find out what is wrong, hahaha. Hence, I was wondering if someone would help me.

this is my code I have gotten stuck:


from numpy import *
from pylab import *
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt

m=Basemap()
m.drawcoastlines()

x=array([-65.0,-65.0,15.0,15.0])
y=array([10.0,-10.0,-10.0,10.0])

pc=pygridgen.BoundaryInteractor(x,y)

Here is the command where I got the error:

grd=pygridgen.Gridgen(pc.x,pc.y,array([1.0,1.0,1.0,1.0]), (32,32))

And here is the error:

UnboundLocalError Traceback (most recent call last)
<ipython-input-82-eca8eac561e7> in <module>()
----> 1 grd=pygridgen.Gridgen(pc.x,pc.y,array([1.0,1.0,1.0,1.0]), (32,32))

/usr/local/lib/python2.7/dist-packages/pygridgen/grid.pyc in __init__(self, xbry, ybry, beta, shape, ul_idx, focus, proj, nnodes, precision, nppe, newton, thin, checksimplepoly, verbose)
932
933 self._gn = None
--> 934 self.generate_grid()
935
936 def __del__(self):

/usr/local/lib/python2.7/dist-packages/pygridgen/grid.pyc in generate_grid(self)
882 print 'step 5'
883
--> 884 if np.any(np.isnan(x)) or np.any(np.isnan(y)):
885 x = np.ma.masked_where(np.isnan(x), x)
886 y = np.ma.masked_where(np.isnan(y), y)

UnboundLocalError: local variable 'x' referenced before assignment

Thanks in advance,

Matheus

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: pygridgen.Gridgen error

#2 Unread post by kate »

I don't know that I have pygridgen, but did you import it? I followed your steps and got:

Code: Select all

pc=pygridgen.BoundaryInteractor(x,y)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-10-c47527743e99> in <module>()
----> 1 pc=pygridgen.BoundaryInteractor(x,y)

NameError: name 'pygridgen' is not defined

Post Reply