Mar-13-2022, 03:29 AM
(This post was last modified: Mar-13-2022, 03:29 AM by deanhystad.)
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:
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 degrees2utmThen 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.