Question about the 'where' command

From: Gina Henderson <ginah_at_nyahnyahspammersnyahnyah>
Date: Thu, 21 May 2009 09:25:07 -0400

Hi there,

I am looking for advice on how to perform a calculation in ncl using the
where command. I have two global grids and am trying to find and replace
values from one grid based on calculations from other grids that are all the
same shape using the 'where' but I am getting an error of a division by 0
even though I stat that the opporation should only be done if the
denominator is greater than 0.

Here is what my code looks like:
 h2osno = where (.not. ismissing(snowdp_offset) .and.
((snowdp_clim*1000)/h2osno_clim) .gt. 0.,
snowdp/((snowdp_clim*1000.)/h2osno_clim), h2osno)

from this I get:
fatal:divide: Division by 0, Can't continue
fatal:Div: operator failed, can't continue

What I don't understand is, if I say that the calc should only take place if
((snowdp_clim*1000)/h2osno_clim) .gt. 0., then why is it attempting to
divide by h2osno_clim if this condition has failed?

Any help with regards this message would be greatly appreciated,
thanks, Gina.

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Thu May 21 2009 - 07:25:07 MDT

This archive was generated by hypermail 2.2.0 : Thu May 21 2009 - 16:54:57 MDT