[ncl-talk] Overwrite rstd in loop with regCoef
Dennis Shea
shea at ucar.edu
Fri Feb 10 15:07:02 MST 2017
[1] Maybe
coef = new((/nmon,nlat,nlon/),float)
rstd = new((/nmon,nlat,nlon/),float)
do i =0,11
coef(i,:,:) = regCoef(NAO(i,:),rTAS(i,:,:,:))
rstd(i,:,:) = onedtond(coef at rstd,(/nlat,mlon/)) ; make 2D
end do
[2] If you have NCL 6.2.1 (9/2014), I'd recommend looking at
http://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef_n.shtml
; TAS is (/nmon,nyrs,nlat,nlon/)
; NAO is (/nmon,nyrs/)
coef = new((/nmon,nlat,nlon/),float)
rstd = new((/nmon,nlat,nlon/),float)
do i =0,11
coef(i,:,:) = regCoef_n(NAO(i,:), TAS(i,:,:,:), 0, 0)
rstd(i,:,:) = onedtond(coef at rstd,(/nlat,mlon/))
end do
On Fri, Feb 10, 2017 at 2:47 PM, Lynch, Cary D <cary.lynch at pnnl.gov> wrote:
> NCL-talk,
>
> I am using the function “regCoef” in a do-loop. X is a 2 dimensional
> variable of size (/nmon,nyrs/). Y is a 4 dimensional variable of size
> (/nmon,nyrs,nlat,nlon/). The resulting regression coefficient is 3
> dimensional of size (/nmon,nlat,nlon/):
>
> ; TAS is (/nmon,nyrs,nlat,nlon/)
> ; NAO is (/nmon,nyrs/)
> ; nmon = 12; yrs = 30
>
> ; reorder TAS
> rTAS = TAS(month|:,lat|:,lon|:,year|:)
>
> coef = new((/nmon,nlat,nlon/),float)
> do i =0,11
> coef(i,:,:) = regCoef(NAO(i,:),rTAS(i,:,:,:))
> end do
>
>
> For each “i” I want to archive the *rstd* (standard error of the
> estimated regression coefficient), which will be in 1 dimension (nlat*
> nlon).
>
> Using the the special "$” syntax in the loop, doesn’t work. Is there
> some other special syntax I could use?
>
> Thank you
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> 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/20170210/10f843fa/attachment.html
More information about the ncl-talk
mailing list