[ncl-talk] problem with missing values
Ipshita Majhi
ipmajhi at alaska.edu
Fri Dec 12 15:27:58 MST 2014
I will try the above mentioned loop that Dennis suggested and will let you
all know the outcome.
Thank you all for the support
Best Regards
Ipshita
On Fri, Dec 12, 2014 at 4:20 PM, Dennis Shea <shea at ucar.edu> wrote:
>
> printVarSummary(x364)
>
> What is the _FillValue ?
>
> ---
>
> et_default_fillvalue("float", -9999.0)
> pweek=new((/47,52/),"float") ; pweek at _FillValue
>
>
>
> do i=0,47-1
> do j=0,357,7
>
> pweek(i,j/7)=avg(x364(i,j:j+6))
>
> if x364 has an _FillValue of 9.92226e+36
> and the result of avg is a missing value,
> the _FillValue of x354 will transfer to pweek
> Also, 9.92226e+36 is the 'printed' value, This is not the
> actual value. Rounding has occurred for printing purposes.
>
> if x364 at _FillValue = 9.92226e+36
> and you prefer -9999.0 then set
> x364 at _FillValue == pweek at _FillValue *before* the loop
>
>
> ; end if
> end do
> end do
>
> I think the above should fix your issue.
>
> The whole loop below could be done much more efficiently
>
>
> pweek = where(pweek.gt. 1e25, pweek at _FillValue, pweek)
>
>
> do i=0,47-1
> do j=0,51
> print(i)
> print(j)
> if (pweek(i,j).eq.9.92226ee+36)then
> pweek(i,j)=9999.0
> end if
> end do
> end do
>
>
>
>
> On Fri, Dec 12, 2014 at 3:10 PM, Ipshita Majhi <ipmajhi at alaska.edu> wrote:
>>
>> Thank you
>>
>> Yes it is a typo in the code I fixed it yet it still gives max value as
>> 9.6921e+36 , and if I write to substitute it then it gives 9.92226e+36
>> as the max value.
>>
>> Best Regards
>> Ipshita
>>
>>
>>
>> On Friday, December 12, 2014, Gus Correa <gus at ldeo.columbia.edu> wrote:
>>
>>> Hi Ipshita
>>>
>>> Is this a typo in your email or in the code?
>>>
>>> > if (pweek(i,j).eq.9.92226ee+36)then
>>>
>>> Note the double "ee".
>>>
>>> Gus Correa
>>>
>>> On 12/12/2014 04:29 PM, Ipshita Majhi wrote:
>>> > Dear NCL ,
>>> >
>>> > I have written a code to write to convert 365 days into 52 weeks avg.
>>> > I am facing error regarding missing value. I have written statements
>>> > which have substituted missing value as -9999.0
>>> > Yet it gives the maximum value as 9.96921e+36 and when I write to
>>> > substitute that with -9999.0, it gives maximum value as 9.969222e+36.
>>> > Here is the snippet of my code. I am very confused about this. It will
>>> > be great if somebody could help me
>>> >
>>> > set_default_fillvalue("float", -9999.0)
>>> >
>>> > pweek=new((/47,52/),"float")
>>> >
>>> >
>>> > do i=0,47-1
>>> > do j=0,357,7
>>> >
>>> > pweek(i,j/7)=avg(x364(i,j:j+6))
>>> >
>>> > ; end if
>>> > end do
>>> > end do
>>> >
>>> >
>>> > do i=0,47-1
>>> > do j=0,51
>>> > print(i)
>>> > print(j)
>>> > if (pweek(i,j).eq.9.92226ee+36)then
>>> > pweek(i,j)=9999.0
>>> > end if
>>> > end do
>>> > end do
>>> >
>>> > printMinMax(pweek, 0)
>>> >
>>> > Thank You
>>> > Best Regards
>>> > Ipshita
>>> >
>>> >
>>> >
>>> > _______________________________________________
>>> > 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
>>>
>>
>> _______________________________________________
>> 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/20141212/096b14ff/attachment.html
More information about the ncl-talk
mailing list