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

From: Luis Fernando Montana Roa <lfmontanar_at_nyahnyahspammersnyahnyah>
Date: Tue Oct 01 2013 - 20:35:53 MDT

Thanks Mary, what I need is to write an ascii file with variable values
for each time step and grid point, as shown below.:

Time Lat Lon Temp Pres RH U V Wind_speed
   0 -10.0 -85.0 20.89 101.05 92.24 1.58 -1.26 2.02
   0 -10.0 -84.5 19.94 101.01 96.16 2.18 -1.6 2.7
...
   0 -9.5 -85.0 19.94 101.01 96.16 2.18 -1.6 2.7
   0 -9.5 -84.5 19.65 101.04 96.88 2.84 -1.4 3.17
...
   1 -10.0 -85.0 19.94 101.01 96.16 2.18 -1.6 2.7
   1 -10.0 -84.5 19.65 101.04 96.88 2.84 -1.4 3.17
...
   1 -9.5 -85.0 19.37 101015.75 97.29 3.09 -0.98 3.24
   1 -9.5 -84.5 19.08 101026.23 97.51 3.23 -0.76 3.32
...

I will appreciate any help in this regard.

-- Fernando

---------- Forwarded message ----------
From: Mary Haley <haley@ucar.edu>
Date: Tue, Oct 1, 2013 at 3:03 PM
Subject: Re: get values from wrfout file for all lat,lon points
To: Luis Fernando Montana Roa <lfmontanar@unal.edu.co>
Cc: ncl-talk@ucar.edu

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 20:36:04 2013

This archive was generated by hypermail 2.1.8 : Fri Oct 04 2013 - 16:45:17 MDT