Bug in the wrf_user_ll_to_ij function ????????

From: BasitAli Khan <BasitAli.Khan_at_nyahnyahspammersnyahnyah>
Date: Tue Jun 12 2012 - 07:48:14 MDT

Hi all,

I am encountering this problem of converting latlon to ij coordinates using wrf_user_ll_to_ij function. When I convert max lat and long to ij coordinates, the function give me grid y_coordinates larger than total number of grid points in y_dimension. In the same way conversion of minimum longitude results in a negative number. However, the old latlon to ij conversion function "wrf_user_latlon_to_ij" does the conversion correctly.

I wrote the following small code to recheck this. I used both old and new functions to show the difference. There are 651 x 651 grid points in the wrfout file.

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin

 f1 = addfile("/wrfout_d01_2006-06-02_13:00:00.nc","r")

 opts = True

 xLat_f1 = wrf_user_getvar(f1,"XLAT", 0)
 xLong_f1 = wrf_user_getvar(f1,"XLONG", 0)

 xLat_min = min(xLat_f1)
 xLat_max = max(xLat_f1)

 xLong_min = min(xLong_f1)
 xLong_max = max(xLong_f1)

 ; New ll_to_ij function
 min_loc_ll = wrf_user_ll_to_ij(f1,xLong_min,xLat_min,opts)
 max_loc_ll = wrf_user_ll_to_ij(f1,xLong_max,xLat_max,opts)

 print("min. x-coord fm ll func.: "+min_loc_ll(0)+"; min. y_coord fm ll func.: "+min_loc_ll(1))
 print("max. x-coord fm ll func.: "+max_loc_ll(0)+"; max. y_coord fm ll func.: "+max_loc_ll(1))

 ; Old latlon_to_ij function
 min_loc_latlon = wrf_user_latlon_to_ij(f1,xLat_min,xLong_min)
 max_loc_latlon = wrf_user_latlon_to_ij(f1,xLat_max,xLong_max)

 print("min. x-coord fm latlon func.: "+min_loc_latlon(1)+"; min. y_coord fm latlon func.: "+min_loc_latlon(0))
 print("max. x-coord fm latlon func.: "+max_loc_latlon(1)+"; max. y_coord fm latlon func.: "+max_loc_latlon(0))

end
;;;

Output from wrf_user_ll_to_ij
min. x-coord fm ll func.: -16; min. y_coord fm ll func.: 0
max. x-coord fm ll func.: 651; max. y_coord fm ll func.: 657
Output from wrf_user_latlon_to_ij
       min. x-coord fm latlon func.: 0; min. y_coord fm latlon func.: 0
       max. x-coord fm latlon func.: 650; max. y_coord fm latlon func.: 650
;----------------------------------------------------------

I am just wondering if there is some bug in this function (wrf_user_ll_to_ij).

Cheers,

----
Basit A. Khan, Ph.D.
Postdoctoral Research Fellow
Division of Physical Sciences & Engineering
Office# 3204, Level 3, Building 1,
King Abdullah University of Science & Technology
4700 King Abdullah Blvd, Box 2753, Thuwal 23955 –6900,
Kingdom of Saudi Arabia.
Office: +966(0)2 808 0276,  Mobile: +966(0)5 0860 3617
E-mail: basitali.khan@kaust.edu.sa<mailto:basitali.khan@kaust.edu.sa>
Skype name: basit.a.khan

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jun 12 07:48:31 2012

This archive was generated by hypermail 2.1.8 : Tue Jun 12 2012 - 13:58:38 MDT