Re: interpolate wrf data to lat/lon points

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon, 07 Apr 2008 10:39:18 -0600

[1] The documentation for linint2 and linint2_points states that the
      input x and y arrays be one-dimensional *monotonically
      {in/de}creasing* arrays. You made the input one dimensional
      but the arrays are not monotonic.

[2] Probably best for you to use a WRF provided function:

      http://www.ncl.ucar.edu/Document/Functions/wrf.shtml

      Specifically,

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

[3] Please note: wrfhelp_at_ucar.edu
     if the official WRF site for help. They may be better able to help.

Completely untested! If the variables have a time dimension, you will
have to
change accordingly.

a = addfile(dir+fil,"r")
rain_exp = wrf_user_getvar(a,"RAINNC",it2)
XLAT = wrf_user_getvar(a,"XLAT",it1)
XLONG= wrf_user_getvar(a,"XLONG",it1)

RAIN = asciiread("RAIN_OUT",(/283,3/),"float")
dimsR = dimsizes(RAIN)
nobs = dimR(0)

lat=RAIN(:,0)
lon=RAIN(:,1)
ij =wrf_latlon_to_ij(XLAT,XLONG,lat,lon)

do n=0,nobs-1
     print("n="+(n+1)+" XLAT="+ sprintf("%9.3f", XLAT(ij(n,0),ij(n,1)) \
                                +" XLON="+ sprintf("%9.3f",
XLONG(ij(n,0),ij(n,1)) \
                                +" rain="+ sprintf("%9.3f",
rain_exp(ij(n,0),ij(n,1)) \
                                 + RAIN="+ sprintf("%9.3f",
RAIN(ij(n,0),ij(n,1)) )
end do
Wolfgang Langhans wrote:
> Hi,
> I try to interploate bilinearly from the wrf output to certain lat/lon
> observation points. Therefor I convert the 2-dimensional XLAT and XLONG to
> 1-dimensional coordinates XLAT_1d and XLONG_1d. Then interpolating to the
> observation points does not work, because now the dimensions of rain_exp (WRF
> raindata) are different as the dimensions of XLAT_1d, XLONG_1d.
> Could you please help me?
> Thanks!
>
> This is my script:
>
> a = addfile(dir+fil,"r")
> rain_exp = wrf_user_getvar(a,"RAINNC",it2)
> XLAT = wrf_user_getvar(a,"XLAT",it1)
> XLONG= wrf_user_getvar(a,"XLONG",it1)
> XLAT_1d=ndtooned(XLAT)
> XLONG_1d=ndtooned(XLONG)
>
> RAIN = asciiread("RAIN_OUT",(/283,3/),"float")
>
> lat=RAIN(:,0)
> lon=RAIN(:,1)
> fo = linint2_points(XLONG_1d,XLAT_1d,rain_exp,False,lon,lat,0)
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Apr 07 2008 - 10:39:18 MDT

This archive was generated by hypermail 2.2.0 : Fri Apr 11 2008 - 11:01:25 MDT