Help for to do a script

Boris Vladimir Comi <[email protected]> Fri, 16 Mar 2012 18:52:19 +0000
Newsgroups gmane.comp.python.image,gmane.comp.python.porting,gmane.comp.python.tutor
Message-ID <[email protected]>
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

_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig
TIR.py (text/x-python, 848 B)
# Call data from the directory(/home/mcidasv/Documentos/CLASS)

def scm(directory):
  import os;
  fs = os.listdir(directory);

  # now fs will be a list of all the files in directory

  from edu.wisc.ssec.mcidas import AreaFile;
  for name in fs:
      print "Reading in:",name
      af = AreaFile(directory+"/"+name);
      ad = af.getAreaDirectory();
      count = 0;
      data = af.getFloatData();

      # now look through the first band y count pixels
      # MCS detected whose his temperature infrared (TIR) is < 219 K
      
      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      
     
scm("/home/mcidasv/Documentos/CLASS")