Re: Division by zero?

From: Yang Yang <yang123yang_at_nyahnyahspammersnyahnyah>
Date: Mon Feb 18 2013 - 16:42:44 MST

Hi Dennis:
 
Thanks very much for your help!
Your suggestion works.
But what is wrong with ssnow = where(x2.gt.0.01, x1/x2, -999.)? Thanks!
 
Regards
Ed 

----- Original Message -----
From: Dennis Shea <shea@ucar.edu>
To: Yang Yang <yang123yang@yahoo.com>
Cc: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
Sent: Tuesday, February 19, 2013 11:43 AM
Subject: Re: Division by zero?

http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml

As noted, the 'true_value' and 'false_value' expression get executed.

    x1 = sim->snow_liq_gb(:,0,0)
    x2 = sim->snow_mass_gb(:,0,0)
    x2 = where(x2.gt.0.01, x2, x2@_FillValue)
    ssnow  = where(x2.gt.0.01, x1/x2, x2@_FillValue)

On 2/18/13 3:00 PM, Yang Yang wrote:
> Dear All:
>
> I have a NCL script contains the following:
>
>    sim    = addfile("Mt_Cook.day_38102.nc","r")
>    x1 = sim->snow_liq_gb(:,0,0)
>    x2 = sim->snow_mass_gb(:,0,0)
>    ssnow  = where(x2.gt.0.01, x1/x2, -999.)
>
> When I ran it, I had the following errors:
> fatal:divide: Division by 0, Can't continue
> fatal:Div: operator failed, can't continue
> fatal:Execute: Error occurred at or near line 19 in file snow_sim_mass_1_ratio.ncl
>
> Line 19 is: ssnow  = where(x2.gt.0.01, x1/x2, -999.)
>
> I cannot figure out why "where" cannnot work here? Any help is appreciated. Thanks!
>
> Ed
> _______________________________________________
> 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
Received on Mon Feb 18 16:42:55 2013

This archive was generated by hypermail 2.1.8 : Thu Feb 21 2013 - 11:26:43 MST