# Re: how to deal the negtive value?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu, 10 Sep 2009 09:43:07 -0600

The use of:
opt_at_zonal = True ; use zonal averages as a 1st guess

leads the negative values. I suggest not using this option.

Mary Haley wrote:
>
> On Thu, 10 Sep 2009, yanling_1220 wrote:
>
>> Hi??
>> When I use "obj_anal_ic" to interpolate the observed station rainfall
>> to grid??and find some grid with a negative value??and it's no
>> possible obviously,and how do you solve this problem usually? If I
>> want to using "0" to fill this value,how should modify the following
>> main segment of my script,any help will be appreciate.
>>
>
> Sunflower,
>
> I'm don't know obj_anal_ic well enough to know why it's returning
> negative values.
>
> However, it's easy to set the negative values to 0.0 using the "where"
> function. After your do loop, do this:
>
> fo = where(fo.lt.0.0,0.0,fo)
>
> Or, a more obscure way that people may not know about is using the ">"
> operator:
>
> fo = fo > 0
>
> --Mary
>
>
>> -------------------------------------------------------------
> fo =new((/nlat,nlon,ntim/),typeof(xObs),-999)
> do nmo =0,ntim-1
> rscan = (/5,3,2,1,0.5/)
> opt = True
> opt_at_zonal = True ; use zonal averages as a 1st guess
> fo(:,:,nmo) = obj_anal_ic(lon1,lat1,xObs(nmo,:),lon,lat, rscan,opt)
> ;(nlat*mlon*ntim) end do
>
> fo!0 = "lat"
> fo!1 = "lon"
> fo!2 = "time"
> pr_ratio =fo(time|:,lat|:,lon|:)
> dim_pr_ratio = dimsizes( pr_ratio)
> ntim = dim_pr_ratio(0) nlat = dim_pr_ratio(1)
> mlon = dim_pr_ratio(2)
>
> pr_ratio_at_original_name = " observed pr_ratio "
> pr_ratio_at_coordinates = " height"
> pr_ratio@_FillValue = 1e+20 ;define the FillValue of the pr_ratio in
> the output
> ;nc file,it can't be "1e+020 " with the quotes ("...") pr_ratio_at_units
> = " mm/d"
> pr_ratio_at_long_name = "observed grid pr_ratio " printVarSummary(pr_ratio)

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Sep 10 2009 - 09:43:07 MDT

This archive was generated by hypermail 2.2.0 : Tue Sep 15 2009 - 16:03:21 MDT