c routine pour interpoler une matrice de illumina
c sous echantillonnee a partir de quelques mesures ponctuelles
c le schema d interpolation est en 1/r^2
c une valeur negative est interpretee comme une absence de valeur
c
c les axes sont definis comme suit
c x = direction nord = degres
c y = direction est = degres
c
c On suppose qu une valeur negative represente une absence
c de donnees et donc une valeur a interpoler
c
c copyright Martin Aube 21/09/2009
c
c -----------------
c identification des variables
c
c
c --------------------
c
c programme principal
c
subroutine interpolation(valin,valout,nx,ny)
c
c ----------
c
c declaration des variables
c
real valin(1024,1024),valout(1024,1024)
real distan,dtotal
integer nx,ny,i,j,ii,jj
integer percent,pcentold
c
c ----------
c
c initialisation des variables
c
c -----------
c
c Interpoler la matrice
c
print*,'Interpolating...'
do i=1,nx
do j=1,ny
valout(i,j)=-1.
if (valin(i,j).lt.0.) then
valout(i,j)=0.
dtotal=0.
do ii=1,nx
do jj=1,ny
if (valin(ii,jj).gt.0.) then
distan=sqrt(real(ii-i)**2.+real(jj-j)**2.)
valout(i,j)=valin(ii,jj)/distan**2.+valout(i,j)
dtotal=1./distan**2.+dtotal
endif
enddo
enddo
valout(i,j)=valout(i,j)/dtotal
else
valout(i,j)=valin(i,j)
endif
enddo
percent=int((real(i)/real(nx))*100./5.)*5
if (percent.ne.pcentold) then
print*,percent,'%'
endif
pcentold=percent
enddo
return
end
c sous echantillonnee a partir de quelques mesures ponctuelles
c le schema d interpolation est en 1/r^2
c une valeur negative est interpretee comme une absence de valeur
c
c les axes sont definis comme suit
c x = direction nord = degres
c y = direction est = degres
c
c On suppose qu une valeur negative represente une absence
c de donnees et donc une valeur a interpoler
c
c copyright Martin Aube 21/09/2009
c
c -----------------
c identification des variables
c
c
c --------------------
c
c programme principal
c
subroutine interpolation(valin,valout,nx,ny)
c
c ----------
c
c declaration des variables
c
real valin(1024,1024),valout(1024,1024)
real distan,dtotal
integer nx,ny,i,j,ii,jj
integer percent,pcentold
c
c ----------
c
c initialisation des variables
c
c -----------
c
c Interpoler la matrice
c
print*,'Interpolating...'
do i=1,nx
do j=1,ny
valout(i,j)=-1.
if (valin(i,j).lt.0.) then
valout(i,j)=0.
dtotal=0.
do ii=1,nx
do jj=1,ny
if (valin(ii,jj).gt.0.) then
distan=sqrt(real(ii-i)**2.+real(jj-j)**2.)
valout(i,j)=valin(ii,jj)/distan**2.+valout(i,j)
dtotal=1./distan**2.+dtotal
endif
enddo
enddo
valout(i,j)=valout(i,j)/dtotal
else
valout(i,j)=valin(i,j)
endif
enddo
percent=int((real(i)/real(nx))*100./5.)*5
if (percent.ne.pcentold) then
print*,percent,'%'
endif
pcentold=percent
enddo
return
end
Page last modified on September 27, 2009, at 03:26 am UTC
Powered by
PmWiki