Re: correlation error (WRF vs. Obs)

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri, 02 Nov 2007 14:15:14 -0600

ccr = esccr(v_plane,v2({700},{latN:latS},{lonE:lonW}),maxlag)

I think you have a dimension mismatch problem.

v_plane is a WRF variable. Hence, it is on a curvilinear coordinate
system. It needs 2D arrays of coordinates to describe the grid.

v2 is a classic rectilinear grid.

Compare the output of

   printVarSummary( v2 )

and
   printVarSummary(v2({700},{latN:latS},{lonE:lonW}) )

This will show if the dimension sizes are consistent.
It is my speculation that you will have to interpolate
the WRF grid to the v2 grid or vice versa.

Perhaps, Example 3 at
             
http://www.ncl.ucar.edu/Applications/narr.shtml

or, ask wrfhelp if it has functions for interpolating to a rectilinear
coordinate system.

Erik Noble wrote:
> Hi. Thank you to both.
>
> Now I am getting this error which is a bit confusing.
>
> fatal:esccr: the rightmost dimension of x and y must be the same
> fatal:Execute: Error occurred at or near line 60 in file Test_Correlation.ncl
>
> Aren't my y and x variables the same already for this correlation?
>
> My error log is attached and my code is below.
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ; This creates a 3x1 Panel plot of Zonal wind, Meridionla wind and Streamlines
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>
> begin
>
> a=addfile("../../WRF-SOP3_Athena_3_1_2.nc","r")
> ; Which times and how many time steps are in this data set?
> times = wrf_user_list_times(a) ; get times in the file
> ntimes = dimsizes(times) ; number of times in the file
>
> lonW = -35.
> lonE = 35.
> latN = 35.
> latS = -20.
>
> pressure = 700.
>
> times = wrf_user_list_times(a)
> do it = 328,328 ;;;;;Time step you want!!!!
> print("Working on time: " + times(it) )
>
> v = wrf_user_getvar(a,"va",it) ; v averaged to mass points
> p = wrf_user_getvar(a, "pressure",it) ; pressure
>
> v_plane = wrf_user_intrp3d( v,p,"h",pressure,0.,False)
> v_plane_at_lat2d = a->XLAT(0,:,:) ; do you need XLAT_V, or XLAT?
> v_plane_at_lon2d = a->XLONG(0,:,:) ; do you need XLONG_V, or XLONG?
>
> printVarSummary(v)
> printVarSummary(v_plane)
>
> ;;;;;;;;;;;;;;;;;;;;;; 2nd file
> b=addfile("../../Boundary_Data/FNL_SOP3/FNL_09_grb/fnl_060913_00_00.grb","r")
> ;FILES = systemfunc ("csh -c ' ls "+ "FNL*.nc'") ; root of data
> file you want to plot
> ;numFILES = dimsizes(FILES)
> ;do ifil = 0, numFILES-1 ; BIG FILES LOOP ; NEW file loop
> ;b = addfile(FILES(ifil)+".nc","r")
>
> ; First get the variables we will need
> v2 = b->V_GRD_3_ISBL_10 ; V_Wind
> printVarSummary( v2 ) ; before lonFlip
> v2 = lonFlip( v2 )
> lon2d_Flip=v2&lon_3
> printVarSummary( v2 ) ; after lonFlip
>
>
> ;************************************************
> ; calculate cross correlations
> ;************************************************
> maxlag = 25 ; set lag
> ; note, the max lag should not be more than N/4
>
> ccr = esccr(v_plane,v2({700},{latN:latS},{lonE:lonW}),maxlag)
> ; calc cross cor
> x = ispan(0,maxlag-1,1) ; define x axi
> printVarSummary( x )
> ;************************************************
> ; plot the correlations
> ;************************************************
> wks = gsn_open_wks("x11","corel") ; open a ps plot
> res = True ; make plot mods
> res_at_tiMainString = "37.7N 180E vs 23.72S 149W" ; title
> res_at_tiXAxisString = "LAG" ; x-axis label
>
> plot = gsn_xy(wks,x,ccr,res) ; plot correlation
> ;************************************************
> end do
> end
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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 Fri Nov 02 2007 - 14:15:14 MDT

This archive was generated by hypermail 2.2.0 : Mon Nov 05 2007 - 12:07:45 MST