Re: get values from wrfout file for all lat,lon points

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Oct 01 2013 - 14:03:28 MDT

Hi Luis,

I'm not sure exactly sure of your question. You don't need to get individual point locations for one lat/lon pair at a time. You can simply do the calculation across all lat/lon values.

For example, instead of this do loop:

    do it = 0,ntimes-1

      time = it
      Latitude = 4.16
      Longitude = -74.87

      res = True
      res@returnInt = True
      point = wrf_user_ll_to_ij(in,Longitude,Latitude,res)

      x = point(0)
      y = point(1)

      U = wrf_user_getvar(in, "U", time)
      ua_in = wrf_user_unstagger(U,U@stagger)
      ua = ua_in(0:0,x,y)
      V = wrf_user_getvar(in, "V", time)
      va_in = wrf_user_unstagger(V,V@stagger)
      va = va_in(0:0,x,y)
      wind_speed(it) = sqrt(ua^2+va^2)
      copy_VarCoords(ua,wind_speed(it))
      wind_speed@Units= "m/s"

      T_in = wrf_user_getvar(in, "T2", time)
      T_k = T_in(x,y)
      T_C(it) = T_k-273.15
      T_C@Units="C"

      P_in = wrf_user_getvar(in, "PSFC", time)
      P(it) = P_in(x,y)
      P_rh=P_in(x,y)

      Q_in = wrf_user_getvar(in, "Q2", time)
      Q(it) = Q_in(x,y)
      Q_rh=Q_in(x,y)

      RH(it) = wrf_rh(Q_rh, P_rh, T_k)

    end do

I think you can just do this, using the special value of -1 for time:

     time = -1
      U = wrf_user_getvar(in, "U", time) ; This will get U across all times, lats, and lons
      ua = wrf_user_unstagger(U,U@stagger)
      V = wrf_user_getvar(in, "V", time)
      va = wrf_user_unstagger(V,V@stagger)
      wind_speed( = sqrt(ua^2+va^2)
      copy_VarCoords(ua,wind_speed)
      wind_speed@Units= "m/s"

      T = wrf_user_getvar(in, "T2", time)
      T_C = T-273.15
      T_C@Units="C"

      Q_rh = wrf_user_getvar(in, "Q2", time)
      P_rh = wrf_user_getvar(in, "PSFC", time)
      RH = wrf_rh(Q_rh, P_rh, T_k)

On Sep 30, 2013, at 4:47 PM, Luis Fernando Montana Roa <lfmontanar@unal.edu.co> wrote:

> Hi, I have this script to write the values of some variables to a single point. How do I adjust it for all points (lat, lon) available in the file?
> Thanks,
>
> --
> Fernando
> <w_v_x.ncl>_______________________________________________
> 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 Oct 1 14:03:49 2013

This archive was generated by hypermail 2.1.8 : Tue Oct 01 2013 - 14:41:43 MDT