Groups
Groups
Sign in
Groups
Groups
idl-pvwave
Conversations
Labels
About
Send feedback
Help
empty 'where(...,/null)' and compound operators
69 views
Skip to first unread message
markus.sc...@gmail.com
unread,
May 13, 2025, 9:15:35 AM
May 13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to idl-pvwave
Is the following behavior deliberate or a bug?
IDL> seed=1LL
IDL> for i=0,2000 do begin rn=randomn(seed,10) & rn[where(rn lt 0,/null)]*= -1
% Variable is undefined: <UNDEFINED>.
% Execution halted at: $MAIN$
IDL> a=findgen(10)
IDL> a[!null] *= -1
% Variable is undefined: <UNDEFINED>.
% Execution halted at: $MAIN$
alx
unread,
May 13, 2025, 10:10:29 AM
May 13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to idl-pvwave
IDL> a = findgen(10)
IDL> help, a[!null]
IDL> <Expression> UNDEFINED = !NULL
seems consistent to me, since: a[!null] *= -1 is equivalent to a[!null] = a[!null]*(-1)
markus.sc...@gmail.com
unread,
May 13, 2025, 10:45:48 AM
May 13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to idl-pvwave
yes, I know, but in NumPy it conveniently doesn't fail:
import numpy as np
x=np.arange(10)
x[x < 0] *= -1
x[np.zeros(10).astype(np.bool)] *= -1
Chris Torrence
unread,
Nov 4, 2025, 4:24:42 PM
Nov 4
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to idl-pvwave
This has now been fixed for IDL 9.3 - IDL will no longer throw an error for these cases.
-Chris
NV5 Geospatial Software
Reply all
Reply to author
Forward
0 new messages