I believe NCL does all the computations, then it applies the mask.
Trick:
if (isatt(h20sno,"_FillValue")) then
saveFillValue = h2osno_clim@_FillValue
end if
h2osno_clim@_FillValue = 0.0
h2osno = where (.not. ismissing(snowdp_offset) .and. \
((snowdp_clim*1000)/h2osno_clim) .gt. 0., \
snowdp/((snowdp_clim*1000.)/h2osno_clim), h2osno)
delete(h2osno_clim@_FillValue)
if (isvar("saveFillValue")) then
h2osno_clim@_FillValue = saveFillValue
end if
On May 21, 2009 7:25:14 AM, Gina Henderson <ginah_at_udel.edu> wrote:
> 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:
> 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 Thu May 21 2009 - 07:53:54 MDT
This archive was generated by hypermail 2.2.0 : Thu May 21 2009 - 16:54:57 MDT