Re: Maximum temp calculation

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Apr 14 2010 - 09:01:46 MDT

Dear Sahidul,

The error message is telling you the problem is with subscript #0
(the leftmost subscript)
in "temp", and that it's out of range.

That means you need to look at "temp(cntr:cntr+23,0,:,:)" and make sure
that "cntr" is being set correctly, and that the leftmost dimension
of temp is
what you expect.

Do a printVarSummary(temp) to see what the dimension sizes
are, and double check that "cntr" is not out-of-range.

--Mary

On Apr 14, 2010, at 6:34 AM, Sahidul wrote:

> Dear NCL users,
>
> I would like to calculate Daily Maximum Temperature contour
> variation plots from WRF model outputs.
> I am having 3 days forecast files (no. of files = 72).
>
> I tried to use following scripts; it is showing errors like:
>
> fatal:Subscript out of range, error in subscript #0
> fatal:An error occurred reading temp
> fatal:Execute: Error occurred at or near line 47 in file max-
> temp.ncl [[ the line is: dailymax(gg,:,:) = dim_max_n(temp
> (cntr:cntr+23,0,:,:),0) ]]
>
> ;;; script name is max-temp.ncl ====================
>
> 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/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
>
> begin
>
> datadir = "/scratch/WRF/2010041400/"
> FILES = systemfunc ("ls -1 " + datadir + "wrfout_d01_2010-04* " )
> numFILES = dimsizes(FILES)
> a = addfiles(FILES+".nc","r")
>
> wks = gsn_open_wks("ps","test")
>
> gsn_define_colormap(wks,"gui_default")
>
> P = a[:]->P ; perturbation
> Pb = a[:]->PB ; base state pressure
> Pt = P + Pb ; total pressure
> Tc = a[:]->T ; perturbation potential temperature(theta+t0)
> Tc = Tc + 300
>
> temp = wrf_tk(Pt,Tc)
>
> dailymax = temp(0::24,0,:,:) ; copy metadata
> printVarSummary(dailymax)
> dailymax = dailymax@_FillValue
>
> res = True ; plot mods desired
> res@gsnSpreadColors = True ; make cn span
> entire color map
> res@cnFillOn = True
> res@gsnAddCyclic = False
> res@cnLineLabelsOn = False
>
> plts = new (3 , "graphic")
>
> cntr = 0
> do gg = 0,dimsizes(temp(0::24,0,0,0))-1
>
> dailymax(gg,:,:) = dim_max_n(temp(cntr:cntr+23,0,:,:),0)
> cntr = cntr+24
>
> plts(gg) =gsn_csm_contour(wks,dailymax(gg,:,:),res)
>
> end do
> end
> ;;;=====================================
>
> Kindly help me to solve this.
>
> Thanking you.
> _______________________________________________
> 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 Apr 14 09:01:59 2010

This archive was generated by hypermail 2.1.8 : Wed Apr 14 2010 - 09:15:22 MDT