[ncl-talk] Error in calculating trend

Maria Gehne - NOAA Affiliate maria.gehne at noaa.gov
Fri Aug 1 12:34:08 MDT 2014


Hi Ipshita,

try adding this line before your trend analysis loop:

;=========================================
;Doing trend analysis
;=========================================

z = new(12,"float")

do nmo=0,11
    z(nmo)=regline(years,air(:,nmo))
end do

The error you are getting is likely due to the fact that you didn't define
the variable z before you try to access it.

Hope this helps,
Maria


On Thu, Jul 31, 2014 at 5:36 PM, Ipshita Majhi <ipmajhi at alaska.edu> wrote:

> Hi,
>
> I am interested in the following steps:-
> 1) I have a 2 D matrix where there are 133 rows and 12 columns called air
> 2) I want to c alculate trend between years which go row 1880:2012 and
> eachcolumn of air.
> 3) Error is unidentified z
>
>
> ;======================================
> ; create year
> ;======================================
>
>   years=ispan(1880,2012,1)
>
> ;======================================
> ; read data; add some meta data
> ;======================================
>
>   diri   = "~/Documents/PhD_June_2015/Data_AIR/"
>   fili   = "air.txt"
>   air    =  readAsciiTable(diri+fili, nmos, "float",2)
>   air at _FillValue = msg
>
>   air at long_name = "All India Precip"
>   air at units     = "mm"
>                 ;
>   opt = True
>   opt at fout = "all_india_data"
>
>   write_matrix(air, nmos+"f7.2", opt)
> ;=========================================
> ;Doing trend analysis
> ;=========================================
>
> do nmo=0,11
>     z(nmo)=regline(years,air(:,nmo))
> end do
>
> ;======================================
> ; create year
> ;======================================
>
>   years=ispan(1880,2012,1)
>
> ;======================================
> ; read data; add some meta data
> ;======================================
>
>   diri   = "~/Documents/PhD_June_2015/Data_AIR/"
>   fili   = "air.txt"
>   air    =  readAsciiTable(diri+fili, nmos, "float",2)
>   air at _FillValue = msg
>
>   air at long_name = "All India Precip"
>   air at units     = "mm"
>                 ;
>   opt = True
>   opt at fout = "all_india_data"
>
>   write_matrix(air, nmos+"f7.2", opt)
> ;=========================================
> ;Doing trend analysis
> ;=========================================
>
> do nmo=0,11
>     z(nmo)=regline(years,air(:,nmo))
> end do
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140801/c51b4b28/attachment.html 


More information about the ncl-talk mailing list