[Tutor] Help for to do a script
Joel Goldstick
joel.goldstick at gmail.com
Fri Mar 16 19:58:44 CET 2012
On Fri, Mar 16, 2012 at 2:52 PM, Boris Vladimir Comi
<glez_b at comunidad.unam.mx> wrote:
> Hello, I am writing to request your help in the realization of a script. I
> am new to this and I'm just learning the wonderful world of python and this
> has made me a little difficult.
>
> Briefly I commented what I intend to do:
>
> I detect a class of atmospheric phenomena known as Mesoscale Convective
> Systems (MCS). To accomplish this, I have a database of satellites by 2004,
> every half hour. These data were downloaded from the server:
> unidata2.ssec.wisc.edu and data format is: 200404271515.goes12ir (Area
> Format)
>
> The first thing to do is detect a convective system in the satellite data,
> using the following characteristics:
>
> MCS Criteria
>
> Minimum Size: Continuous cold cloud shield (TIR <219 K and Must Have an
> area> 34000 km ²)
>
> Duration: Definition of Minimum Size Must Be A Period of Exceed or ≥ 3h
>
> Initiation: Time When the Minimum Size is met
>
> Maximum Extention: Time when the continuous cloud shield (TIR <219 K) is at
> its maximum size
>
> Termination: When the Time Minimun Size is not satisfied
>
> where: Temperature Infrarred is TIR
>
> To achieve this, first I created a script in python to identify a MCS in my
> database (script in attached)
>
> The script is run from a linux terminal ($ python TIR.py), to run it I get
> the following error:
>
>
> File "/home/mcidasv/JYTHON/TIR.py", line 22
> count = count + 1;
> ^
> SyntaxError: invalid syntax
>
> If anyone can help me with this script or any idea you suggest to improve
> it, I would greatly appreciate.
>
>
>
> Boris Vladimir Comi Gonzalez
> Universidad Nacional Autónoma de México
> Grupo de Tormentas Convecivas
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
Here is your code:
for i in xrange(ad.getLines()):
for j in xrange(ad.getElements()):
if (data[0][i][j] > 199.5 and (data[0][i][j] < 200.5
count = count + 1;
print "For file",name," count = ",count
Notice that this line is broken:
if (data[0][i][j] > 199.5 and (data[0][i][j] < 200.5
change it to this and try running again:
if (data[0][i][j] > 199.5) and (data[0][i][j] < 200.5)
--
Joel Goldstick
More information about the Tutor
mailing list