[Python-porting] Tutor Digest, Vol 98, Issue 51

Boris Vladimir Comi glez_b at comunidad.unam.mx
Thu Apr 19 02:52:54 CEST 2012


Hi I have the following code that calculates the position and the value of each pixel of the image:

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 when his temperature infrared (TIR) is < 219 K

      for i in xrange(ad.getLines()):
          for j in xrange(ad.getElements()):
              if 552 < i < 900 and 244 < j < 572:
                  if (data[0][i][j]) > 206 and (data[0][i][j]) < 208:
                      print i, j, data[0][i][j];

 Where in the code I can add the condition: to only print those values ​​(206-208) to be maintained for three hours or more

Boris Vladimir Comi Gonzalez
Universidad Nacional Autónoma de México
Grupo de Tormentas Convecivas


 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-porting/attachments/20120419/1e36e0d1/attachment.html>


More information about the Python-porting mailing list