회귀식? wetbulb.pro

게시판 IDL Q&A 회귀식? wetbulb.pro

1 답변 글타래를 보이고 있습니다
  • 글쓴이
    • #1111 Reply
      sabugisl
      회원

      wetbulb temperature 를 구하고 싶은데 방정식 양쪽에 변수가 다 있는 형태라 식을 구하기 어렵던 차에
      다음과 같은 코드를 찾았습니다.

      ; wetbulb.pro

      ; Written by S. Sherwood, 2010.

      ; Calculate theta_W from theta_E using eq 3.8 of Davies-Jones 2008.

      ; Inputs: theta_e (in K), p (in hPa)

      ; Output: wet bulb T (in C)

      ; /improve keyword does a second iteration.
      ; /getthetaw keyword calculates theta_w from theta_e; this can be
      ; returned if desired through the theta_w argument.

      function wetbulb, theta_e, p, getthetaw=getthetaw, theta_w=theta_w, improve=improve
      C=273.15
      X = theta_e/C

      if keyword_set(getthetaw) then begin
      a0 = 7.101574
      a1 = -20.68208
      a2 = 16.11182
      a3 = 2.574631
      a4 = -5.205688
      b1 = -3.552497
      b2 = 3.781782
      b3 = -0.6899655
      b4 = -0.5929340

      theta_w = theta_e-C – $
      exp((a0+a1*X+a2*X^2+a3*X^3+a4*X^4)/(1+b1*X+b2*X^2+b3*X^3+b4*X^4))
      endif

      pi = (p/1000.)^(1./3.504)

      Teq = theta_e*pi
      hot = Teq gt 355

      X = (C/Teq)^3.504

      k1 = -38.5*pi^2 +137.81*pi -53.737
      k2 = -4.392*pi^2 +56.831*pi -0.384

      ; This formula is for T_eq above 273
      Tw = k1-1.21-1.45*hot – (k2-1.21) * X + 0.58/X*hot

      k1=0 ; save memory
      hot=0
      X=0

      ; T_eq less than 273 but not too cold–see paper
      ; currently disabled — assume we are above freezing.
      ;Tw = k1 – k2 * X

      if keyword_set(improve) then begin
      slope = pi * (k2-1.21)*C^3.504*3.504*Teq^(-4.5)
      k2=0 & Teq=0
      _rrmixv, p, tw+C, tw*0+1.0, mrs
      _pott, p, tw+C, mrs*1000, pt, ept
      Tw = Tw+ (theta_e-ept) * slope
      endif

      return, Tw

      end

      여기서 궁금한 것은 굵게 표시한 부분이 회귀식 때문에 뭔가 반복하는 부분이 아닐까 싶은데
      특히 if문 안에 나열된 변수들이 어떤 역할을 하는지 궁금합니다.
      _rrmixv
      _pott
      이것이 어떤 옵션인지, 어떤 역할을 하는지요?

      getthetaw=getthetaw, theta_w=theta_w, improve=improve
      이 부분에서 만일 앞서 계산된 값들이 다음에 또 계산된다면, 처음에는 어떤 값이 들어가는지 궁금합니다.

    • #1112 Reply
      Sangwoo
      회원

      글쎄요. 그건 이 코드의 원저자가 따로 직접 만든 프로시저같은데, 전반적인 메커니즘에 대해서는 아무래도 직접 문의하셔야 할 것으로 생각됩니다.

1 답변 글타래를 보이고 있습니다
'회귀식? wetbulb.pro'에 답변달기
글쓴이 정보: