Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95885
| Subject | error |
|---|---|
| Date | 2015-09-02 15:18 -0300 |
| From | jorge.conrado@cptec.inpe.br |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.27.1441217929.8327.python-list@python.org> (permalink) |
Hi,
I have a Python version: Python 2.7.8
I'm runing it on: Fedora release 21
Yesterday I a sent a question:
I'm starting in the Python scripts. I run this script:
import numpy as np
import netCDF4
f = netCDF4.Dataset('uwnd.mon.ltm.nc','r')
f.variables
and I had the message:
netcdf4.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'netcdf4' is not defined
I had two answers to my question. But I could not understand them. I
don't have expericence with Python. So I downloaded from the Web a code
to calcluate the dew point temperature:
import sys
import numpy as np
# approximation valid for
# 0 degC < T < 60 degC
# 1% < RH < 100%
# 0 degC < Td < 50 degC
# constants
a = 17.271
b = 237.7 # degC
# sys.argv[0] is program name
T=float(sys.argv[1])
RH=float(sys.argv[2])
def dewpoint_approximation(T,RH):
Td = (b * gamma(T,RH)) / (a - gamma(T,RH))
return Td
def gamma(T,RH):
g = (a * T / (b + T)) + np.log(RH/100.0)
return g
Td = dewpoint_approximation(T,RH)
print 'T, RH',T,RH
print 'Td=',Td
Then I run it and I had the message:
p2.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'p2' is not defined
Like the same error that I had for my first run.
Please, someone can help me. I have a commercial software and I would
like to use Python.
In advance. Thanks,
Conrado
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
error jorge.conrado@cptec.inpe.br - 2015-09-02 15:18 -0300
csiph-web