[ncl-talk] sip error

Dawit Abebe dawit.kan at gmail.com
Tue Apr 4 08:48:24 MDT 2017


Dear nil-talk group,

I’m trying to calculate SPI but failing to produce the intended result. I pasted below the commands used and the respective returns from the interactive apprach below. The lines I need help with are those highlighted blue:

1. on line 20) as per the examples provided in https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_spi_n.shtml <https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_spi_n.shtml> the use of the missing value of the variable (prc at _FillValue) returns an error. When I removed the prc at _FillValue, it  seems okay, which according to the NCL documentation on missing values (,https://www.ncl.ucar.edu/Document/Functions/Built-in/new.shtml <https://www.ncl.ucar.edu/Document/Functions/Built-in/new.shtml>) omitting the parameter from the command line leads to NCL to use the default missing value of the variable (i.e. pcr in this case). I’m just wondering if this is correct and appropriate path to the result I am expecting?    

2. on line 26-28: the command gives me an error. I tried to figure out this but failed to fix it. 

I’m calling upon anyone to help me out on this two issues.

Thank you so much

Dawit

——————————————————————————————
(my_ncl) Dagemawes-MacBook-Pro:~ dawitabebe$ ncl -Q
ncl 0> 
ncl 1> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" 
ncl 2> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"   
ncl 3> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
ncl 4> 
ncl 5>    diri = "./"
ncl 6>    fili = "pre_1901_2014.nc"
ncl 7>    f    = addfile(diri+fili, "r")
ncl 8> 
ncl 9>    prc  = f->pre
ncl 10>   printVarSummary(prc)

Variable: prc
Type: double
Total Size: 393984 bytes
            49248 values
Number of Dimensions: 3
Dimensions and sizes:	[time | 1368] x [lat | 4] x [lon | 9]
Coordinates: 
            time: [ 380..41987]
            lat: [3.75..5.25]
            lon: [36.75..40.75]
Number Of Attributes: 5
  correlation_decay_distance :	 450
  long_name :	precipitation
  units :	mm/month
  missing_value :	9.96920996839e+36
  _FillValue :	9.96920996839e+36
ncl 11> 
ncl 12> 
ncl 13> dimp = dimsizes(prc)
ncl 14> ntim = dimp(0)
ncl 15> nlat = dimp(1)
ncl 16> mlon = dimp(2)
ncl 17> 
ncl 18> len  = (/3, 12, 17, 24, 29, 36/)
ncl 19> klen = dimsizes(len)
ncl 20> spi  = new((/klen, ntim, nlat, mlon/), float, prc at _FillValue)
warning:New: Could not coerce missing value parameter into appropriate type, using default
ncl 21> spi  = new((/klen, ntim, nlat, mlon/), float)                 
ncl 22> 
ncl 23> opt  = True
ncl 24> opt at spi_typee = 3
ncl 25> 
ncl 26> do k=0,klen-1
ncl 27>    spi(k,:,:,:) = dim_spi_n(prc, len(k), True, 0)
ncl 28> end do
fatal:Assignment type mismatch, right hand side can't be coerced to type of left hand side
fatal:["Execute.c":8638]:Execute: Error occurred at or near line 27

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170404/2008c475/attachment.html 


More information about the ncl-talk mailing list