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

Sunmin Park mireiyue at gmail.com
Thu Jan 15 15:03:46 MST 2015


Dear NCL users

I am trying to do cross-correlation and ttest between two files. Both of them are three dimensions. I used esccr to calculate cross correlation and then try to do ttest using this equation: r*sqrt[(n-2)/(1-r^2)] <https://www.ncl.ucar.edu/Document/Functions/Built-in/esccr.shtml>. But I am getting this following errors

fatal:divide: Division by 0, Can't continue
fatal:Div: operator failed, can't continue
fatal:["Execute.c":7743]:Execute: Error occurred at or near line 48 in file re_CMF_EXT_correl_sig.ncl

I tried to use where or mask function but it still shows same errors. I do appreciate any comments and helps.

Thank you in advance
Sun-

=SCRIPT
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

begin

   f  = addfile("/Users/spark/vertical/00_DATA/13_CAL_L3_NnD_Combined/all/CALIPSO_L3_2007-2013_monthly.nc/","r")       ;extinction all
   ext = f->data3avg
   ext at _FillValue = getFillValue(ext)              ; assign _FillValue
   ext!0 = "time"
   time = ispan(0,83,1)
   ext&time = time

   EXT = ext(lat|:,lon|:,time|:)

   f1  = addfile("/Users/spark/vertical/00_DATA/11_MERRA_Monthly2007-2013_CMF/reCMF07_13forCALIPSO_all.nc/","r")        ;mass flux all
   cmf = f1->CMF3co
   cmf at _FillValue = getFillValue(cmf)              ; assign _FillValue
;   cmf!2 = "time"
;   time = ispan(0,83,1)
;   cmf&time = time

  printVarSummary(cmf)
  printVarSummary(EXT)
;print(cmf(50:55,40:45,:))
;print(EXT(50:55,40:45,:))

  massvsext = esccr(cmf,EXT,0)
  massvsext at _FillValue = 1e+15
  massvsext1 = dim_avg_Wrap(massvsext)
printVarSummary(massvsext1)

  Nr = dimsizes(cmf&time)
printVarSummary(Nr)

  prob = rtest(massvsext1,Nr,0)
printVarSummary(prob)
  prob1 = mask(prob,prob.eq.0,False)
  probt = prob1*sqrt((Nr-2)/(1-prob1^2))
printVarSummary(probt)
end

==============
Variable: cmf
Type: float
Total Size: 2056320 bytes
            514080 values
Number of Dimensions: 3
Dimensions and sizes:	[LATITUDE | 85] x [LONGITUDE | 72] x [time | 84]
Coordinates:
            LATITUDE: [-85..85]
            LONGITUDE: [-180..180]
            time: [   0..   0]
Number Of Attributes: 9
  _FillValue :	1e+15
  missing_value :	1e+15
  time_statistic :	instantaneous
  grid_type :	linear
  grid_name :	grid-1
  units :
  long_name :	Upward moist convective mass flux
  comments :	Unknown1 variable comment
  average_op_ncl :	dim_avg over dimension(s): levels
==============
Variable: EXT
Type: float
Total Size: 2056320 bytes
            514080 values
Number of Dimensions: 3
Dimensions and sizes:	[lat | 85] x [lon | 72] x [record | 84]
Coordinates:
            lat: [-85..85]
            lon: [-180..180]
Number Of Attributes: 2
  average_op_ncl :	dim_avg over dimension(s): alt
  _FillValue :	-9999
warning:esccr: Non-fatal conditions encountered: all missing or constant values
==============
Variable: massvsext1
Type: float
Total Size: 24480 bytes
            6120 values
Number of Dimensions: 2
Dimensions and sizes:	[85] x [72]
Coordinates:
Number Of Attributes: 2
  _FillValue :	1e+15
  average_op_ncl :	dim_avg function was applied
===============
Variable: Nr
Type: integer
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:	[1]
Coordinates:
===========
Variable: prob
Type: float
Total Size: 24480 bytes
            6120 values
Number of Dimensions: 2
Dimensions and sizes:	[85] x [72]
Coordinates:
fatal:divide: Division by 0, Can't continue
fatal:Div: operator failed, can't continue
fatal:["Execute.c":7743]:Execute: Error occurred at or near line 48 in file re_CMF_EXT_correl_sig.ncl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150115/08e63323/attachment.html 


More information about the ncl-talk mailing list