Re: question about ncl-wrf

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Jan 11 2010 - 07:59:42 MST

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, Chinese Academy 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 Mon Jan 11 08:00:46 2010

This archive was generated by hypermail 2.1.8 : Tue Jan 12 2010 - 15:38:20 MST