[ncl-talk] stat_dispersion

Mary Haley haley at ucar.edu
Wed Dec 3 09:24:20 MST 2014


If you are getting an error "moment not found", then this sounds like you
might be referencing "moment" before you calculate it.

For example, if I wrote a script that had just one line in it:

  print(moment)

I will get this error, because "moment" hasn't been set yet:

  fatal:Variable (moment) is undefined

Is this what you're getting?  It would help if you could include the exact
error message, and the code that produces this error.

--Mary

On Wed, Dec 3, 2014 at 8:57 AM, jbuzan <jbuzan at purdue.edu> wrote:

> That’s what was confusing me.  It was saying something on the order of
> ‘moment not found’, and when I looked at the code:
>  moment   = dim_stat4( work )
>
> So I figure something is wrong with moment.  I commented out all instances
> related to moment.
>
> -Jonathan
>
>
>
> On Dec 3, 2014, at 10:49 AM, Mary Haley <haley at ucar.edu> wrote:
>
> Hi Jonathan,
>
> When you say dim_stat4 bombed, what exactly was the error message?  This
> is a built-in function, so you don't need to load any NCL scripts to use it.
>
> --Mary
>
>
> On Sat, Nov 29, 2014 at 3:47 PM, jbuzan <jbuzan at purdue.edu> wrote:
>
>> Hi Mary,
>>
>> Sorry for the delayed response!
>>
>> I realized there was a two problems:
>> 1) I had an error in the original dataset.
>> 2) I figured out how to use IND to feed only non-missing values to the
>> exceedance (the original issue).
>>
>> I did have a problem with dim_stat4.   When it was trying to calculate
>> kurtosis and skewness for stat_dispersion (dim_stat4 2,3), the contributed
>> file would blow up saying it cannot find dim_stat4.  I turned it off, but I
>> can’t seem to figure out why dim_stat4 bombed.
>>
>> -Jonathan
>>
>>
>>
>>
>> On Oct 9, 2014, at 6:38 PM, Mary Haley <haley at ucar.edu> wrote:
>>
>> Jonathan,
>>
>> Did anybody ever respond to this one?
>>
>> If not, the code is quite complex, and it would be useful if you could
>> provide a full script and data.
>>
>> --Mary
>>
>>
>> On Fri, Sep 26, 2014 at 3:30 PM, jbuzan <jbuzan at purdue.edu> wrote:
>>
>>> I am having some issues with stat_dispersion.
>>> Perhaps my code ‘fixes’ cause the issue.  I am not sure.
>>>
>>> I have 2 datasets:
>>> time: 1460 lat: 192, lon 288
>>> time: 2920 lat: 192, lon 288
>>> I have added a second year to the original year (both 1460 time steps).
>>> The stat_dispersion, in theory, should have the same minimum and maximum
>>> values.
>>>
>>> The data is partitioned by Temperature and by a difference field.
>>> Here is a snippet of the code that does the partitioning:
>>> do k = 0, dimsizes(numvar)-1
>>> ;do k = 16, 16
>>>    thresholdstart = k*5.d + 200.d
>>>    print(thresholdstart)
>>>    thresholdend = k*5.d + 205.d
>>>    print(thresholdend)
>>> ;   location = ind(temperature1d.lt.thresholdend)
>>>    location =
>>> ind(temperature1d.lt.thresholdend.and.temperature1d.ge.thresholdstart)
>>> ;   printVarSummary(location)
>>> ;   print(location)
>>>    if(.not.all(ismissing(location)))
>>>         tbin = wetbulb1d(location)
>>>         else
>>>         tbin = value
>>>         tbin at _FillValue = value
>>>    end if
>>>  ;  print(tbin)
>>>
>>>    if(.not.all(ismissing(tbin)))
>>>         tbin at _FillValue = -999.d
>>>         delete(tbin at _FillValue)
>>>         numarray(:,k) = stat_dispersion(tbin,opt)
>>>         else
>>>         numarray(:,k) = value
>>>    end if
>>>    delete(tbin)
>>>    delete(location)
>>>   ; print(numarray)
>>> end do
>>> numarray = where(numarray.eq.-999.d,value,numarray)
>>>
>>> replace_ieeenan (numarray, value, 0)
>>> numarray at _FillValue = value
>>> numarray at missing_value = numarray at _FillValue
>>> numarray!0 = "stat"
>>> numarray!1 = "bin"
>>> numarray&bin = numvar
>>> printVarSummary(numarray)
>>>
>>> Here is a snippet of the code that grabs the values:
>>> box_var = numvar
>>> box_var at long_name = longnamea
>>> box_var at units = unitsa
>>> ;box_var(:,0) = field1c(22,:)
>>> box_var(:,0) = field1c(2,:)
>>> box_var(:,1) = field1c(24,:)
>>> box_var(:,2) = field1c(8,:)
>>> box_var(:,3) = field1c(25,:)
>>> box_var(:,4) = field1c(14,:)
>>> ;box_var(:,4) = field1c(26,:)
>>>
>>> field1c of 14 and 2 are the maximum and minimums from Stat_Dispersion.
>>> I think the issue is that stat_dispersion field becomes too large, and
>>> drops something.  It might be how I characterize the missing values.
>>>
>>> Any help would be appreciated.
>>>
>>> -Jonathan
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141203/306ab1a4/attachment.html 


More information about the ncl-talk mailing list