Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error 'Contour' not Defined
#4
I think contour is in the pylab module. You are not importing the pylab module. The line that imports the pylab module is commented out.

Are you going to be a project? If this is your first foray into Python I don't think you should start with scipy, numpy and matplotlib. Are you converting existing code from Python 2.7 to a new version of Python? This can be a difficult task for a new programmer. Not only do are you learning Python, but you are learning two very different version of Python and having to keep straight which version has which features. And I am leery about learning from this code. The wildcard imports make me think it was not written by a good programmer.

This is all bad:
 from scipy import *
#from pylab import *   # <- This import is commented out
from numpy import *
from degrees2utm import *
A good python programmer would write this as:
import scipy
import numpy
import pylab
import degrees2utm
Then when the programmer used the contour pylab contour function it would look like this:
cs = pylab.contour(kxx, kyy, -kelevation, [collapse_depth])
Now if there is a problem with countour at least you know which module is responsible. And maybe you would look at pyplot and controur and find out why the import is commented out. Then you would see that pyplot is an interface to matplotlib.pyplot, and that pyplot also has a contour.
Reply


Messages In This Thread
Error 'Contour' not Defined - by DaveG - Mar-12-2022, 10:56 PM
RE: Error 'Contour' not Defined - by deanhystad - Mar-12-2022, 11:27 PM
RE: Error 'Contour' not Defined - by DaveG - Mar-12-2022, 11:32 PM
RE: Error 'Contour' not Defined - by deanhystad - Mar-13-2022, 03:29 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Variable is not defined error when trying to use my custom function code fnafgamer239 4 655 Nov-23-2023, 02:53 PM
Last Post: rob101
Question Vertex(Contour) to mesh conversion JorgeRdz 1 764 Feb-06-2023, 02:00 AM
Last Post: Larz60+
  [variable] is not defined error arises despite variable being defined TheTypicalDoge 4 2,232 Apr-05-2022, 04:55 AM
Last Post: deanhystad
  Getting "name 'get_weather' is not defined error and no json_data returned? trthskr4 6 3,749 Sep-14-2021, 09:55 AM
Last Post: trthskr4
  Error when refering to class defined in 'main' in an imported module HeRo 2 2,459 Apr-13-2021, 07:22 PM
Last Post: HeRo
  Why does lambda throw 'name value_o is not defined' error? karabakh 3 2,249 Dec-14-2020, 05:45 PM
Last Post: karabakh
  name error "name"is not defined MaartenRo 1 3,488 Jul-28-2020, 02:39 AM
Last Post: bowlofred
  Name Error: name 'Stockton' is not defined Pinokchu 3 2,332 Jun-13-2020, 02:48 PM
Last Post: Yoriz
  python library not defined in user defined function johnEmScott 2 3,935 May-30-2020, 04:14 AM
Last Post: DT2000
  error ,,name append is not defined'' Killdoz 1 5,099 May-24-2020, 06:23 PM
Last Post: bowlofred

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020