Lazy expression evaluation

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Fri, 12 Jun 2009 19:22:56 -0600

NCL team,

Is lazy expression evaluation supposed to work for array expressions?

See attached script. mask1 is scalar and shows the expected result.
  This is basically the example in the NCL manual under "If
statements", with assignment rather than if statement.

http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclStatements.shtml

For mask2 I expect True, False, True, but NCL returns True, Missing,
True. This creates problems for subsequent usage of the mask.

I checked this with NCL versions 5.0.1 (pre-release, ca. May 2008)
and 5.1.1 (pre-release). The problem was the same in both.

uname -a
Darwin mac56.psd.esrl.noaa.gov 9.7.0 Darwin Kernel Version 9.7.0:
Tue Mar 31 22:54:29 PDT 2009; root:xnu-1228.12.14~1/RELEASE_PPC
Power Macintosh powerpc PowerMac7,3 Darwin

Please advise. Thank you for taking a look.

Dave Allured
CU/CIRES Climate Diagnostics Center (CDC)
http://cires.colorado.edu/science/centers/cdc/
NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
http://www.cdc.noaa.gov/psd1/

; Test program for lazy expression evaluation.
; 2009-jun-13 By Dave Allured, NOAA/PSD/CU/CIRES/CDC.

begin
   a = (/ 1,2,3 /)
   a@_FillValue = 2
  
   i=1
   mask1 = (.not.ismissing(a(i)) .and. (a(i) .gt. 0))
   print (mask1)
  
   mask2 = (.not.ismissing(a) .and. (a .gt. 0))
   print (mask2)
end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 12 2009 - 19:22:56 MDT

This archive was generated by hypermail 2.2.0 : Tue Jun 16 2009 - 10:05:45 MDT