correlation error (WRF vs. Obs)

From: Erik Noble <enoble_at_nyahnyahspammersnyahnyah>
Date: Thu, 1 Nov 2007 23:42:22 -0400

 Dear NCL world.
I am trying to do a correlation between v at 700mb from WRF data and
reanalysis data.

I use the function ccr =
esccr(v_plane,v2({700},latN:latS,lonE:lonW),maxlag) similar to
example 1 at: http://www.ncl.ucar.edu/Applications/corel.shtml
I get the error:
fatal:An error occurred reading v2
fatal:Execute: Error occurred at or near line 60 in file Test_WRF_FNL_Corr.ncl

Am I calling this variable incorrectly? Below are both the errors and
my code. The PrintVarSummary(v2) shows that the v2 variable ha sthe
following dimensions :
Dimensions and sizes: [lv_ISBL3 | 26] x [lat_3 | 181] x [lon_3 | 360]

Any advice would be greatly appreciated.
-Erik

Copyright (C) 1995-2007 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 4.3.1
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.

Variable: times
Type: string
Total Size: 3896 bytes
            487 values
Number of Dimensions: 1
Dimensions and sizes: [487]
Coordinates:
Number Of Attributes: 2
  description : times in file
  _FillValue : missing

(0) Working on time: 2006-09-11_00:00:00

Variable: v
Type: float
Total Size: 1636308 bytes
            409077 values
Number of Dimensions: 3
Dimensions and sizes: [27] x [109] x [139]
Coordinates:
Number Of Attributes: 2
  description : v Velocity
  units : m/s

Variable: v_plane
Type: float
Total Size: 60604 bytes
            15151 values
Number of Dimensions: 2
Dimensions and sizes: [109] x [139]
Coordinates:
Number Of Attributes: 6
  lon2d : <ARRAY of 15151 elements>
  lat2d : <ARRAY of 15151 elements>
  description : v Velocity
  units : m/s
  _FillValue : -999999
  PlotLevelID : 700 hPa

Variable: v2
Type: float
Total Size: 6776640 bytes
            1694160 values
Number of Dimensions: 3
Dimensions and sizes: [lv_ISBL3 | 26] x [lat_3 | 181] x [lon_3 | 360]
Coordinates:
            lv_ISBL3: [10..1000]
            lat_3: [90..-90]
            lon_3: [ 0..359]
Number Of Attributes: 12
  center : US National Weather Service - NCEP (WMC)
  long_name : v-component of wind
  units : m/s
  _FillValue : -999
  level_indicator : 100
  grid_number : 3
  parameter_table_version : 2
  parameter_number : 34
  model : Spectral Statistical Interpolation (SSI) analysis from "Final" run.
  forecast_time : 0
  forecast_time_units : hours
  initial_time : 09/13/2006 (00:00)

Variable: v2
Type: float
Total Size: 6776640 bytes
            1694160 values
Number of Dimensions: 3
Dimensions and sizes: [lv_ISBL3 | 26] x [lat_3 | 181] x [lon_3 | 360]
Coordinates:
            lv_ISBL3: [10..1000]
            lat_3: [90..-90]
            lon_3: [-180..179]
Number Of Attributes: 13
  lonFlip : longitude coordinate variable has been reordered via lonFlip
  initial_time : 09/13/2006 (00:00)
  forecast_time_units : hours
  forecast_time : 0
  model : Spectral Statistical Interpolation (SSI) analysis from "Final" run.
  parameter_number : 34
  parameter_table_version : 2
  grid_number : 3
  level_indicator : 100
  units : m/s
  long_name : v-component of wind
  center : US National Weather Service - NCEP (WMC)
  _FillValue : -999
fatal:Subscript out of range, error in subscript #1

fatal:An error occurred reading v2

fatal:Execute: Error occurred at or near line 60 in file Test_WRF_FNL_Corr.ncl

***NCL****Code***********************************************************************************
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This creates a cross-correlation of v at 700mb between WRF output
and FNL reanalysis data
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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 axis
;************************************************

end do
end
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Nov 01 2007 - 21:42:22 MDT

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