Re: ncl script problem

From: Chao Luo <cluo_at_nyahnyahspammersnyahnyah>
Date: Tue, 11 Jul 2006 15:51:59 -0700

Thanks much! it solved my previous problem. But there is memory
allocation problem now. I check the array size. It is not too big.
very appreciate any help.

Chao

fatal:ContourPlotInitialize: dynamic memory allocation error
fatal:ContourPlotInitialize: error getting contour level information
fatal:ContourPlotInitialize: error initializing dynamic arrays
fatal:Unable to initialize layer-Can't Create
fatal:Unable to access object with id:-4
fatal:PID #-4 can't be found in NhlSetValues
(0) spread_colors: invalid plot: defaulting
fatal:PID #-4 can't be found in NhlSetValues
warning:overlay: bad HLU id passed in, ignoring
fatal:PID #-4 can't be found in NhlSetValues
fatal:PID #-4 can't be found in NhlSetValues
fatal:NhlGetValues:PID #-4 is invalid
fatal:Execute: Error occurred at or near line 1873 in file
$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl

fatal:Execute: Error occurred at or near line 5049 in file
$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl

On Tue, 2006-07-11 at 16:25 -0600, Dennis Shea wrote:
> >I am trying to plot fraction of each dust bin emission to total
> >emission. Since in many regions the total emissions are zero. So I need
> >to set Fill value for zero numbers in these region in case of divided
> >by zero. But the error message: Subscript out of range. Is there any
> >better ways for this?
> >
> >Thanks,
> >
> >Chao
> >
> > part of my script is like:
> >
> > diri = "/data3/chaoluo/camdst/cam3019aersombf/"
> > fl_mdl_3 = addfile(diri+"cam3019aersombf_annual.nc","r")
> > sfmbl = fl_mdl_3->DSTSFMBL(0,:,:)
> > sfmblx01 = fl_mdl_3->DSTX01SF(0,:,:)
> >
> > sfmbl@_FillValue=1.e+36
> > nlon=128
> > nlat=64
> >
> > frc1 = new((/nlat,nlon/),float)
> > do ilon=0,nlon-1
> > do ilat=0,nlat-1
> > if (sfmbl(ilon,ilat).ne.0.) then
> > frc1(ilon,ilat)=sfmblx01(ilon,ilat)/(ilon,ilat)
> > else
> > frc1(ilon,ilat)=sfmbl@_FillValue
> > end if
> > end do
> > end do
> > print (frc1)
> >_______________________________________________
>
>
> frc1 = sfmbl ; copy of sfmbl
> frc1 = frc1@_FillValue ; initialize all to _FillValue
>
> temp0 = ndtooned( frc1 ) ; a bit cumbersome but fast
> temp1 = ndtooned( sfmbl )
> temp2 = ndtooned( sfmblx01 )
> i = ind(temp1.ne.0.)
> temp0(i) = temp2(i)/temp1(i)
>
> frc1 = onedtond( temp0 )
> frc1_at_long_name = "ratio: sfmblx01/sfmbl"
> frc1_at_units = ""
>
> printVarSummary(frc1)
> printMinMax(frc1, True ) ; contributed.ncl
>
> nmsg = num( ismissing( frc1 ) )
> print("frc1: nmsg="+nmsg)
>
> delete(temp0)
> delete(temp1)
> delete(temp2)
>
> good luck
> D
>
> =============================
> P.S.
>
> You do not have to do stuff like this:
>
> > sfmbl@_FillValue=1.e+36
> > nlon=128
> > nlat=64
> > frc1 = new((/nlat,nlon/),float)
>
> frc1 = new ( dimsizes(sfmbl), typeof(sfmbl), 1e20)
> or
> frc1 = new ( dimsizes(sfmbl), typeof(sfmbl), getFillValue(sfmbl)
>
> The above initializes all
> frc1 to 1e20 or the _FillValue associated with 'sfmbl'
>
> http://www.ncl.ucar.edu/Document/Functions/Contributed/getFillValue.shtml
>
> Then
>
>
>

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jul 11 2006 - 16:51:59 MDT

This archive was generated by hypermail 2.2.0 : Thu Jul 13 2006 - 09:59:49 MDT