- 积分
- 6
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2018-6-27
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
子程序源代码:
!双线性差值 :生成双线性 4个点的权重
program test
real ::A_lon,A_lat,B_lon,B_lat,C_lon,C_lat,D_lon,D_lat,X_lon,X_lat,a,b,c,d,E_lon,F_lon,M
call BilinearInterpolation(0.0,0.0,0.0,5.0,10.0,5.0,10.0,0.0,2.0,2.0,a,b,c,d)
print*,a*1.0+b*2.0+c*3.0+d*4.0
end program test
SUBROUTINE BilinearInterpolation(A_lon,A_lat,B_lon,B_lat,C_lon,C_lat,D_lon,D_lat,X_lon,X_lat,a,b,c,d)
!A B C D为包含X点的4个格点,从左下角开始顺时针排列,a,b,c,d是4个格点对X的权重系数
real ::A_lon,A_lat,B_lon,B_lat,C_lon,C_lat,D_lon,D_lat,X_lon,X_lat,a,b,c,d,E_lon,F_lon,M
E_lon=(B_lon-A_lon)*(X_lat-A_lat)/(B_lat-A_lat)+A_lon
F_lon=(C_lon-D_lon)*(X_lat-D_lat)/(C_lat-D_lat)+D_lon
M=(X_lon-E_lon)/(F_lon-E_lon)
a=(1-M)*(B_lat-X_lat)/(B_lat-A_lat)
b=(1-M)*(X_lat-A_lat)/(B_lat-A_lat)
c=M*(X_lat-D_lat)/(C_lat-D_lat)
d=M*(C_lat-X_lat)/(C_lat-D_lat)
! X=a*A_+b*B_+c*C_+d*D_
END SUBROUTINE BilinearInterpolation
http://bbs.06climate.com/forum.php?mod=attachment&aid=OTAyNzh8MzljYzBjYTQyYTk3NmUwOTdiYTE1MmJjODM1OTEyZGN8MTczMjk2NTE2Nw%3D%3D&request=yes&_f=.f90
BilinearInterpolation.f90
(979 Bytes, 下载次数: 13)
|
|