Differences between revisions 11 and 12
Revision 11 as of 2008-07-10 12:50:29
Size: 2647
Editor: anonymous
Comment:
Revision 12 as of 2008-07-10 13:20:36
Size: 3793
Editor: anonymous
Comment:
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:
 . '''Am Dienstag erzeugtes Programm:'''  . '''Am Dienstag / Mittwoch erzeugtes Programm:'''
Line 11: Line 12:
#project_plot
Line 16: Line 18:
from matplotlib.patches import Ellipse
Line 17: Line 20:
nk=3 #number of classes
ndim=[100,100] #dimension of ASAR image in pixels
nk=5 #number of classes
ndim=[1000,1000] #dimension of ASAR image in pixels
res=12.5
freeb_asar_pixels=int(60./res)# footprint of freeboard is 60m
Line 20: Line 25:
fx0,fy0,fx2,fy2=[20.,100.,100.,10.] # freeboard coordinates from input file
nf=11 #number of freeboard footprints
fx0,fy0,fx2,fy2=[0.2,1.,1.,0.1]
fx0,fy0,fx2,fy2=fx0*ndim[0],fy0*ndim[0],fx2*ndim[0],fy2*ndim[0] # freeboard coordinates from input file
dist=sqrt((fx2-fx0)**2+(fy2-fy0)**2)*res
fdist=172 #distance of two freeboard footprints is 172m
nf=int(dist/fdist)
Line 27: Line 36:
# the x,y positions of the freeboard footprints # the x,y positions of the freeboard footprints   
Line 48: Line 57:
#select the class of footprints from ASAR Image #select the class of footprints from ASAR Image 
Line 56: Line 65:
for kl in (1,2,3): for kl in range(1,6):
Line 60: Line 69:
   std_kl[kl-1]=std(fh_kl)    std_kl[kl-1]=std(fh_kl) 
Line 63: Line 72:
kl=[1,2,3] kl=arange(nk)+1
Line 65: Line 74:


#calculate correlation coefficient
axis('tight')
savefig('kl_mean_std', orientation='portrait', format='png')
 
#calculate correlation coefficient
Line 71: Line 81:
#plot ASAR image class together with freeboard heights #plot ASAR image class together with freeboard heights 
Line 73: Line 83:
bar(x,fz,align='center')
ylim(0,6)
bar(x,fz,width=0.3,align='center')
ylim(0,10)
Line 76: Line 86:
plot(x,fz_h,'r+-')
xlim(-2,12)
plot(x,fz_h,'r+-',ms=10,linewidth=1)
ylim(0,70)
savefig('asar_fb', orientation='portrait', format='png')

#axis('tight')
Line 81: Line 94:
plot(fx,fy,'r+-',linewidth=2)
xlim(0,100)
ylim(0,100)
colorbar()
ct=zeros((nf,4))
for i in range(nf):
   ct[i]=cm.gist_rainbow(int(fz_h[i]))
ax=axes()
ells=[Ellipse(xy=[fx[i],fy[i]],width=freeb_asar_pixels,height=freeb_asar_pixels) for i in xrange(nf)]
n=0
for e in ells:
   ax.add_artist(e)
   e.set_clip_box(ax.bbox)
   e.set_alpha(0.5)
   e.set_facecolor(ct[n])
   n+=1
gray()
Line 87: Line 109:
#plot(fx,fy,'r+-',linewidth=2)
xlim(400,600)
ylim(500,700)
#xlim(0,1000)
#ylim(0,1000)
colorbar()
savefig('asar_fb_track', orientation='portrait', format='png')
Line 92: Line 121:

Figure 1 (class_mean_standard deviation):

{{attachment:kl_mean_std}}

Figure 2 (asar, freboard):

{{attachment:asar_fb.png}}

Figure 3 (asar, freeboard track):

{{attachment:image2b.png}}

Line 99: Line 142:

{{attachment:image2b.png}}

die Besprechung ergab fuer diese Gruppe:

  • Trockenprogrammierung: insbesondere die Konsistenz von Bildkoordinaten von ASAR und Freibord-Footprint klären die Klasseneinteilungen von ASAR und Freibordhöhen vergleichen Frage "welche Statistik will man anwenden" beantworten


  • Am Dienstag / Mittwoch erzeugtes Programm:

   1 #project_plot
   2 from pylab import *
   3 from scipy import *
   4 import time,calendar,os,pipes,struct,string
   5 import random
   6 import scipy.ndimage as ndi
   7 from matplotlib.patches import Ellipse
   8 
   9 nk=5 #number of classes
  10 ndim=[1000,1000] #dimension of ASAR image in pixels
  11 res=12.5
  12 freeb_asar_pixels=int(60./res)# footprint of freeboard is 60m
  13 
  14 fx0,fy0,fx2,fy2=[0.2,1.,1.,0.1]
  15 fx0,fy0,fx2,fy2=fx0*ndim[0],fy0*ndim[0],fx2*ndim[0],fy2*ndim[0] # freeboard coordinates from input file
  16 dist=sqrt((fx2-fx0)**2+(fy2-fy0)**2)*res
  17 fdist=172 #distance of two freeboard footprints is 172m
  18 nf=int(dist/fdist)
  19 
  20 fz_h=zeros(nf) #fz_h is the freeboard heights
  21 # produce a random array of freeboard heights
  22 for i in range(nf):
  23    fz_h[i]=random.random()*70
  24 
  25 # the x,y positions of the freeboard footprints   
  26 if fx2==fx0:
  27    fx=zeros(nf)+fx0
  28    fy=linspace(0,ndim[1],nf)
  29 else:
  30    teta=(fy2-fy0)/(fx2-fx0)
  31    fx=linspace(fx0,fx2,nf)
  32    fy=(fx-fx0)*teta+fy0
  33 #produce a random matrix of ASAR image classes (in 3 classes)
  34 
  35 a=zeros((ndim[0],ndim[1]))
  36 for i in range(ndim[0]):
  37    for j in range(ndim[1]):
  38       a[i,j]=int(random.random()*(nk)+1)
  39 
  40 #tranform from float to int
  41 
  42 #A=ndimage.gaussian_filter(a,1)+0.5
  43 #B=A.astype(int)
  44 B=a.astype(int)
  45 
  46 #select the class of footprints from ASAR Image 
  47 fz=zeros(nf)
  48 for i in range(nf):
  49    fz[i]=B[int(fx[i]-1),int(fy[i]-1)]
  50 
  51 #calculation of mean and standard deviation of freeboard heights in each class
  52 mean=zeros(nk)
  53 std_kl=zeros(nk)
  54 for kl in range(1,6):
  55    s=(fz==kl)
  56    fh_kl=fz_h[s]
  57    mean[kl-1]=fh_kl.sum()/fh_kl.shape[0]
  58    std_kl[kl-1]=std(fh_kl) 
  59 
  60 #plot mean and error bar
  61 kl=arange(nk)+1
  62 bar(kl,mean,yerr=std_kl,ecolor='r',align='center')
  63 axis('tight')
  64 savefig('kl_mean_std', orientation='portrait', format='png')
  65  
  66 #calculate correlation coefficient   
  67 #corr=xcorr(fz,fz_h,normed=True)[1][nf]
  68 
  69 figure()
  70 #plot ASAR image class together with freeboard heights 
  71 x=arange(nf)
  72 bar(x,fz,width=0.3,align='center')
  73 ylim(0,10)
  74 ax=twinx()
  75 plot(x,fz_h,'r+-',ms=10,linewidth=1)
  76 ylim(0,70)
  77 savefig('asar_fb', orientation='portrait', format='png')
  78 
  79 #axis('tight')
  80 
  81 #plot ASAR image with freeboard flight
  82 figure()
  83 ct=zeros((nf,4))
  84 for i in range(nf):
  85    ct[i]=cm.gist_rainbow(int(fz_h[i]))
  86 ax=axes()
  87 ells=[Ellipse(xy=[fx[i],fy[i]],width=freeb_asar_pixels,height=freeb_asar_pixels) for i in xrange(nf)]
  88 n=0
  89 for e in ells:
  90    ax.add_artist(e)
  91    e.set_clip_box(ax.bbox)
  92    e.set_alpha(0.5)
  93    e.set_facecolor(ct[n])
  94    n+=1
  95 gray()
  96 imshow(B,origin='lower',interpolation=None)
  97 hold(True)
  98 #plot(fx,fy,'r+-',linewidth=2)
  99 xlim(400,600)
 100 ylim(500,700)
 101 #xlim(0,1000)
 102 #ylim(0,1000)
 103 colorbar()
 104 savefig('asar_fb_track', orientation='portrait', format='png')
 105 
 106 #figure()
 107 #imshow(a)
 108 show()

Figure 1 (class_mean_standard deviation):

kl_mean_std

Figure 2 (asar, freboard):

asar_fb.png

Figure 3 (asar, freeboard track):

Ziele für Mittwoch:

  • Vom gestern erzeugte Graphen verfeinen
  • Programm für ASAR-Rohdaten & Freiborddaten Vergleich

Mittwoch

Ziele für Donnerstag

  • Farbtabelle für Freibordhöhen eibauen
  • Programpaketen der anderen Gruppe übernehmen und ins Programm einbauen
  • Testen und erste Ergebnisse liefern
  • Bericht schreiben

Donnerstag

LehreWiki: \AG3_Zusammensetzung (last edited 2008-07-11 11:15:06 by anonymous)