Fw:Re:Re: question about ncl-wrf

From: nuistcd <nuistcd_at_nyahnyahspammersnyahnyah>
Date: Tue Jan 12 2010 - 20:23:05 MST

 Dear Mary Haley,

Thank you very much for your help! Now, in order to further find out my problem, I want to know the Fortran code of funtion 'wrf_interp_1d'.

Hope your further help! Thank you!

Regards!

Ms Dan Chen

ÔÚ2010-01-11 22:59:42£¬"Mary Haley" <haley@ucar.edu> дµÀ£º

On Jan 11, 2010, at 12:31 AM, nuistcd wrote:

Dear Sir/Miss
 
I am very grateful to you for reading my mail. I am a student of IAP-CAS (Institute of Atmospheric Physics, ChineseAcademy of Science).I have a question about ncl-wrf. The function of 'wrf_interp_3d_z' is called in the function 'wrf_user_intrp3d', but the function code of 'wrf_interp_3d_z' is not in the WRFUserARW.ncl. Is it built into ncl? I want to know which interpolating function method is used in funtion 'wrf_interp_3d_z' ? Linear or Lagrange interpolation?
Thank you very much for your help!
 
Regards!
 
Ms Dan Chen

Dear Ms. Chen,

The function "wrf_interp_3d_z" is indeed built into NCL. With any NCL function, if you go to it's function page:

http://www.ncl.ucar.edu/Document/Functions/Built-in/wrf_interp_3d_z.shtml

you can look at the "Prototype" section at the top, which will indicate whether you have to "load"
anything to use this function. If you don't have to load anything, then you know it's a built-in function.

I'll include the underlying Fortran code that is used for this function:

      SUBROUTINE DINTERP3DZ(V3D,V2D,Z,LOC,NX,NY,NZ)
      IMPLICIT NONE
      INTEGER NX,NY,NZ
      DOUBLE PRECISION V3D(NX,NY,NZ),V2D(NX,NY)
      DOUBLE PRECISION Z(NX,NY,NZ)
      DOUBLE PRECISION LOC

      INTEGER I,J,KP,IP,IM
      LOGICAL INTERP
      DOUBLE PRECISION HEIGHT,W1,W2

      HEIGHT = LOC

c does vertical coordinate increase or decrease with increasing k?
c set offset appropriately

      IP = 0
      IM = 1
      IF (Z(1,1,1).GT.Z(1,1,NZ)) THEN
          IP = 1
          IM = 0
      END IF

      DO I = 1,NX
          DO J = 1,NY
C Initialize to missing.
              V2D(I,J) = -999999
              INTERP = .false.
              KP = NZ

              DO WHILE ((.NOT.INTERP) .AND. (KP.GE.2))

                  IF (((Z(I,J,KP-IM).LE.HEIGHT).AND. (Z(I,J,
     + KP-IP).GT.HEIGHT))) THEN
                      W2 = (HEIGHT-Z(I,J,KP-IM))/
     + (Z(I,J,KP-IP)-Z(I,J,KP-IM))
                      W1 = 1.D0 - W2
                      V2D(I,J) = W1*V3D(I,J,KP-IM) + W2*V3D(I,J,KP-IP)
                      INTERP = .true.
                  END IF
                  KP = KP - 1

              END DO

          END DO
      END DO

      RETURN
      END

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jan 12 20:38:27 2010

This archive was generated by hypermail 2.1.8 : Fri Jan 15 2010 - 13:51:45 MST