Re: decimalPlaces leading to loss of data

From: Bridget Thrasher <bthrasher_at_nyahnyahspammersnyahnyah>
Date: Tue Nov 10 2009 - 16:22:47 MST

Rick, I saw that, too, but I'm running the latest version, 5.1.1, so I'm
hoping the issue noted on that page is in fact gone.

Dennis, I'm not sure I understand how that relates to my example since I'm
not using any integers, but simply rounding my floats to 2 decimal places.
None of my values is anywhere close to -999, and my fill value is 1e20.

Either way, I got around the problem by using round(data_all*100.,0)/100.
But it would be nice to know why decimalPlaces didn't give the same result.

On Tue, Nov 10, 2009 at 9:10 AM, Dennis Shea <shea@ucar.edu> wrote:

> I see the issue. I generated 100,00 random numbers and was able
> to get one value that failed.
>
> In a nutshell,
>
> x = -9.9995
> shift = 100.
> xTmp = x*shift ;===> xTmp = -999.05
>
> iTmp = floattointeger(xTmp) ; iTmp = -999
>
> -999 is the default missing value for "floattointeger"
>
>
>
>
> Rick Brownrigg wrote:
>
>> Hi Bridget,
>>
>> Are you by chance running an earlier version of NCL? I noticed a comment
>> in the docs for "decimalPlaces" that
>> this function does not work correctly for NCL v. 5.0.0 and earlier, if the
>> data contain negative numbers. It does not spell out how "does not work"
>> manifests.
>>
>> http://www.ncl.ucar.edu/Document/Functions/Contributed/decimalPlaces.shtml
>>
>> Rick
>>
>> On Nov 9, 2009, at 4:18 PM, Bridget Thrasher wrote:
>>
>> I'm running a complete array (no missing values) through the
>>> decimalPlaces function and am getting an output array that contains missing
>>> values. Is this correct?
>>>
>>> data_all_f = doubletofloat(fdata->$var$)
>>> printVarSummary(data_all_f)
>>> print(num(ismissing(data_all_f)))
>>> printMinMax(data_all_f,True)
>>> data_all = decimalPlaces(data_all_f,2,True)
>>> printVarSummary(data_all)
>>> print(num(ismissing(data_all)))
>>> printMinMax(data_all,True)
>>>
>>>
>>> Variable: data_all_f
>>> Type: float
>>> Total Size: 116640000 bytes
>>> 29160000 values
>>> Number of Dimensions: 3
>>> Dimensions and sizes: [1800] x [90] x [180]
>>> Coordinates:
>>> Number Of Attributes: 1
>>> _FillValue : 1e+20
>>> (0) 0
>>> (0) (0) min=-73.7207 max=45.3083
>>>
>>>
>>> Variable: data_all
>>> Type: float
>>> Total Size: 116640000 bytes
>>> 29160000 values
>>> Number of Dimensions: 3
>>> Dimensions and sizes: [1800] x [90] x [180]
>>> Coordinates:
>>> Number Of Attributes: 1
>>> _FillValue : 1e+20
>>> (0) 2147
>>> (0) (0) min=-73.72 max=45.31
>>>
>>>
>>> --
>>> Bridget Thrasher, PhD
>>> Postdoctoral Researcher
>>> Climate Central
>>> www.climatecentral.org <http://www.climatecentral.org>
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
>
> --
> ======================================================
> Dennis J. Shea tel: 303-497-1361 |
> P.O. Box 3000 fax: 303-497-1333 |
> Climate Analysis Section |
> Climate & Global Dynamics Div. |
> National Center for Atmospheric Research |
> Boulder, CO 80307 |
> USA email: shea 'at' ucar.edu |
> ======================================================
>
>

-- 
Bridget Thrasher, PhD
Postdoctoral Researcher
Climate Central
www.climatecentral.org

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Nov 10 16:22:17 2009

This archive was generated by hypermail 2.1.8 : Wed Nov 11 2009 - 12:48:56 MST