Re: ask about interpolate function

From: Xiaofeng Lou <lou_at_nyahnyahspammersnyahnyah>
Date: Fri, 21 Mar 2008 10:22:06 -0600

Hi,
I want to interploate wrf model output data to ncep data point. The wrf
is not golbal, it is (36,117,135). The ncep data is 30' of latitude and
longitude. So I should not use f2fsh. But when I use f2gsh, it also
doesn't work. The message is:
fatal:_NclBuildArray: each element of a literal array must have the same
dimension sizes, at least one item doesn't
fatal:Execute: Error occurred at or near line 77 in file la.ncl

the following is the source code:

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
directory="/home/fddasys/verification/"
directory4="/data/input/nam212/"
a = addfile(directory+"wrfout_d02_2008-03-14_11:00:00.GRM_F.nc","r")
b = addfile(directory4+"2008031912_fh.0072_tl.press_gr.awip3d.grib2","r")
   type = "ps"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; read in data from wrf model output
     time = 0
     xlat= wrf_user_getvar(a,"XLAT",time) ; laT
     xlon= wrf_user_getvar(a,"XLONG",time) ; lon
     tc = wrf_user_getvar(a,"tc",time) ; Tc in C

cct = new((/117,135/),float)
id=134
jd=116
kd=36
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; read in data from ncep data
sct=b->TMP_P0_L3_GLC0
gridlat=b->gridlat_0
gridlon=b->gridlon_0
dims=dimsizes(sct)
alat=dims(1)
alon=dims(0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;narrow ncep data in (35:40, -110:-105) as wrf output data
i=0
j=0
if (i.lt. alat) then
do while (gridlat(i,j) .lt. 35)
is=i
i=i+1
end do
end if
if (i.lt. alat) then
do while (gridlat(i,j) .lt. 40)
ie=i
i=i+1
end do
end if
j=0
if (j .lt. alon) then
do while (gridlon(i,j) .lt. -110)
j=j+1
js=j
end do
end if
if (j .lt. alon) then
do while (gridlon(i,j) .lt. -105)
j=j+1
je=j
end do
end if

scct=sct(is:ie,js:je)
print (gridlat(is:ie,js:je))
print (gridlon(is:ie,js:je))
scct!1 = "lonncep"
scct!0 = "latncep"
latncep=gridlat(is:ie,js)
lonncep=gridlon(is,js:je)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;convert tc to 2d array
cct=tc(1,:,:)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; interpolate grid to ncep point
;t2s = natgrid(slon, slat, t2, slon,slat)
ccts=f2gsh_Wrap(cct(:,:),(/latncep,lonncep/),0)
end

I am not sure that whether the cct(lat,lon)'s demension sizes of lat and
lon should be the same sizes of latncep and lonncep for f2gsh_Wrap.
Thank you!
Xiaofeng

Dennis Shea wrote:
> You have not included enough information.
>
> What are the grid types of the WRF and satellite data?
> If the WRF and satellite grids are not global, then f2fsh which uses
> spherical harmonics is not applicable [as noted in the documentation].
>
>
>
>
> Xiaofeng Lou wrote:
>> Hello,
>> I am using NCL in verification of model results with satellite data.
>> For the wrf model output is in grid net, and the satellite data is
>> more sparse, I need to interpolate model output to satellite data
>> point. I use f2fsh function as t2s= f2fsh
>> (t2(lat|:,lon|:),(/slat,slon/)), where lat and lon are dimension size
>> of t2, and slat and slon are dimension size of satellite data.
>> Dimension size of slat and slon is 6, the t2s size should be (6*6),
>> but the t2s size is (40*41).
>> Should I use another interpolate function or something is wrong in 2s=
>> f2fsh (t2(lat|:,lon|:),(/slat,slon/))?
>> Thank you!
>> xiaofeng
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Mar 21 2008 - 10:22:06 MDT

This archive was generated by hypermail 2.2.0 : Sun Mar 23 2008 - 15:01:36 MDT