[ncl-talk] fatal:divide: Division by 0, Can't continue

Will Hobbs Will.Hobbs at utas.edu.au
Thu Jan 15 15:17:32 MST 2015


Sunmin

You're on the right lines trying to mask out values which would cause division by zero, but your mask() statement is incorrect.

Since the denominator is (1-prob^2), you need to remove values of prob=1 (NOT prob = 0 as you have done). You can also use the where() function instead of mask(), i.e.

> probt = where(prob.ne.1., prob*sqrt((Nr-2)/(1-prob^2)), prob at _FillValue)

Hope that helps,

Will


From: Sunmin Park <mireiyue at gmail.com<mailto:mireiyue at gmail.com>>
Date: Friday, 16 January 2015 9:03 AM
To: "ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>" <ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>>
Subject: [ncl-talk] fatal:divide: Division by 0, Can't continue

probt = prob1*sqrt((Nr-2)/(1-prob1^2))


University of Tasmania Electronic Communications Policy (December, 2014).
This email is confidential, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone outside the intended recipient organisation is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender. The views expressed in this email are not necessarily the views of the University of Tasmania, unless clearly intended otherwise.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150115/400adf7b/attachment.html 


More information about the ncl-talk mailing list