Re: Subscript out of range while reading z

From: Wei Huang <huangwei_at_nyahnyahspammersnyahnyah>
Date: Wed Jun 27 2012 - 18:46:04 MDT

Try change lines:

;grid point height
z = wrf_user_getvar(a,"z",time)
z_point = z(:,locY,locX)
;print(z_point)

uvmet = wrf_user_getvar(a,"uvmet",time)
uvmet_point = uvmet(:,locY,locX)
;print(uvmet_point)

To:

;grid point height
z = wrf_user_getvar(a,"z",times)
z_point = z(:,locY,locX)
;print(z_point)

uvmet = wrf_user_getvar(a,"uvmet",times)
uvmet_point = uvmet(:,locY,locX)
;print(uvmet_point)

Wei

huangwei@ucar.edu
VETS/CISL
National Center for Atmospheric Research
P.O. Box 3000 (1850 Table Mesa Dr.)
Boulder, CO 80307-3000 USA
(303) 497-8924

On Jun 27, 2012, at 5:32 PM, Nick Dawson wrote:

> Hello,
>
> I'm attempting to extract hourly wind speed from a specific location
> at a height of 80 meters. I get an error "Subscript out of range,
> error in subscript #1 An error occurred reading z on line 39 which is:
>
> z = wrf_user_getvar(a,"z",time)
>
> I cannot figure out how to fix this error. Here is my code:
>
> 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/wrf/WRFUserARW.ncl"
>
> begin
>
> all_files = systemfunc("ls wrfout_d02*") + ".nc"
> a = addfiles(all_files,"r")
> ListSetType (a,"cat")
> ;print(all_files)
> ;print(a)
>
> times = wrf_user_list_times(a)
> ntimes = dimsizes(times)
> wind80 = new(ntimes,float)
> ;print(ntimes)
>
>
> do it = 0,ntimes-1
> ;print("Working on time " + it )
>
> time = it
> llres = True
>
> ;Return integer values
> llres@ReturnInt = True
> locij = wrf_user_ll_to_ij(a, 65.1521,-220.1548, llres)
>
> ;array pointers in NCL space
> locij = locij - 1
> locX = locij(0)
> locY = locij(1)
> print(locX)
> print(locY)
>
> ;grid point height
> z = wrf_user_getvar(a,"z",time)
> z_point = z(:,locY,locX)
> ;print(z_point)
>
> uvmet = wrf_user_getvar(a,"uvmet",time)
> uvmet_point = uvmet(:,locY,locX)
> ;print(uvmet_point)
>
> wind80(it) = wrf_interp_1d(uvmet_point,z_point,80)
> print(U80(it))
>
> end do
>
> asciiwrite("wind80.dat",wind80(it))
> delete(a)
>
> end
>
> Thank you,
>
> Nick Dawson
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jun 27 18:46:19 2012

This archive was generated by hypermail 2.1.8 : Fri Jun 29 2012 - 15:46:14 MDT