ASAR_seaice_mixed_20080421_f32_1000x1000.dat

   1 from scipy import float32,int16,tan,sin,array,zeros,arange,pi,fromfile,reshape,ones,clip,log10
   2 from pylab import rc,imshow,show,gray,figure,cm,hold,colorbar,title,savefig,subplot,hist,title,close,xlabel,ylabel
   3 import scipy.ndimage as ndi
   4 import scipy.misc as misc
   5 
   6 rc('image',origin='lower',interpolation='nearest')
   7 
   8 def ql(img,vmin,vmax):
   9     figure()
  10     imshow(img,vmin=vmin,vmax=vmax)
  11     gray()
  12     show()
  13     
  14 img=reshape(fromfile('ASAR_seaice_mixed_20080421_f32_1000x1000.dat',dtype=float32),(1000,1000))
  15 
  16 close('all')
  17 ql(img,vmin=0,vmax=0.3)
  18 colorbar()
  19 title('Sea ice radar backscatter intensity')
  20 dbimg=10*log10(img)
  21 
  22 figure()
  23 subplot(2,1,1)
  24 hist(img,bins=500)
  25 xlabel('Intensity')
  26 ylabel('Occurrence')
  27 subplot(2,1,2)
  28 hist(dbimg,bins=500)
  29 xlabel('Intensity [dB]')
  30 ylabel('Occurrence')
  31 
  32 
  33 ql(dbimg,-30,0)
  34 colorbar()
  35 title('Sea ice radar backscatter intensity [dB]')

LehreWiki: Python/Lesson5/ExampleCode (last edited 2008-11-30 20:39:24 by anonymous)