comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: summation problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: summation problem [message #24549 is a reply to message #24548] Thu, 05 April 2001 04:15 Go to previous messageGo to previous message
Jaco van Gorkom is currently offline  Jaco van Gorkom
Messages: 97
Registered: November 2000
Member
Manish wrote:
...
> I have a program which produces an array of values of sunlight flux during
> the day. Unfortunately, it produces crazy numbers before the sunrises and
> after it sets(as expected). I'm summing the values throughout the day to
> get a total integrated day flux, but here's the problem - is there a way of
> telling the TOTAL function to ignore negative numbers and NaN numbers?

Yes, there is a way:
IDL> test = [0,-1,3,4,!values.f_nan]
IDL> print, total(test>0,/nan)
7.00000
% Program caused arithmetic error: Floating illegal operand

The 'illegal operand' error appears to be harmless, caused by comparing test>0:
IDL> print, test>0
0.00000 0.00000 3.00000 4.00000 NaN
% Program caused arithmetic error: Floating illegal operand

> I guess this is a simple problem, but would appreciate any help
It is simple enough, but only once you know the solution.

cheers,
Jaco
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Where's Liam Gumley
Next Topic: summation problem

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 21:39:17 PDT 2025

Total time taken to generate the page: 1.51915 seconds