本帖最后由 packard 于 2018-4-8 14:14 编辑
你说的函数是用Fortran和C编译好的,涉及以下文件,尤其是最后的那个文件。(rmsd.f 附在帖子最后)
[packard@rcnx01 ~]$ gncl dim_rmsd
/n/home05/packard/sw/ncl-6.4.0/lib/libnfp.a:statW.o:00000000000051d6 Tdim_rmsd_W
nfp
/n/home05/packard/sw/ncl-6.4.0/source-6.4.0/ni/src/lib/nfp
/n/home05/packard/sw/ncl-6.4.0/source-6.4.0/ni/src/lib/nfp/statW.c
/n/home05/packard/sw/ncl-6.4.0/source-6.4.0/ni/src/lib/nfp/wrapper.c
drmsd
/n/home05/packard/sw/ncl-6.4.0/lib/libnfpfort.a:rmsd.o:0000000000000000 Tdrmsd_
nfpfort
/n/home05/packard/sw/ncl-6.4.0/source-6.4.0/ni/src/lib/nfpfort
/n/home05/packard/sw/ncl-6.4.0/source-6.4.0/ni/src/lib/nfpfort/rmsd.f
/n/home05/packard/sw/ncl-6.4.0/source-6.4.0/ni/src/lib/nfpfort/rmsd.f:2: SUBROUTINE DRMSD(X,Y,NPTS,XMSG,YMSG,XYRMSD,NPTUSE,IER)
原装的 rmsd.f 在官网上的ncl 源代码包(不是precompiled 预编译的),如: https://www.earthsystemgrid.org/ ... _ncarg-6.4.0.tar.gz
我这里把它解压(tar -zxvf ncl_ncarg-6.4.0.tar.gz)到了 source-6.4.0/
以上搜索结果,是用我写的自动搜索代码产生的,代码在以下帖子:
http://bbs.06climate.com/forum.php?mod=viewthread&tid=58871
(原来我的代码搜索这个函数时有个bug,现在修复了,所以也谢谢你的提问。)
C NCLFORTSTART
SUBROUTINEDRMSD(X,Y,NPTS,XMSG,YMSG,XYRMSD,NPTUSE,IER)
IMPLICITNONE
c
c NCL: rmsd =dim_rmsd(x,y)
c interface mustchk that the length of x and y are the same
c input
INTEGERNPTS
DOUBLE PRECISIONX(NPTS),Y(NPTS),XMSG,YMSG
c output
INTEGERNPTUSE,IER
DOUBLE PRECISIONXYRMSD
C NCLEND
c this routine will calculate estimates of the first two moments
c . of the vector xcontaining missing data.
c input arguments:
c . x,y - input vectors
c . npts - length of x and y
c . xmsg,ymsg- missingcode: if there are no msg values
c . set xmsg to some value which will
c . not be encountered.
c output arguments:
c . xyrmsd - root-mean-square-difference
c . nptuse - no. of points used to calculate theestimates
c . ier - if (ier.ne.0) an error has occurred
c note :
c . uncalculatedquantities are set to xmsg (nptuse set to zero)
INTEGERN
DOUBLE PRECISIONRN
NPTUSE =0
XYRMSD =XMSG
IF(NPTS.LT.1) THEN
IER =1
RETURN
END IF
IER =0
XYRMSD =0.D0
RN =0.D0
DON = 1,NPTS
IF(X(N).NE.XMSG .AND.Y(N).NE.YMSG) THEN
RN =RN + 1.0D0
XYRMSD =XYRMSD + (X(N)-Y(N))**2
END IF
END DO
NPTUSE =RN
IF(RN.GT.0.D0) THEN
XYRMSD =SQRT(XYRMSD/RN)
ELSE
XYRMSD =XMSG
C error code for all msg values
IER =2
END IF
RETURN
END |