# Dimensionality problem

From: Lizz Ultee <lultee_at_nyahnyahspammersnyahnyah>
Date: Thu Jul 07 2011 - 12:42:42 MDT

Hi NCL-Talk,
I have emailed with a related problem before, but I hope you will be able
to help me with this. I was debating between regCoef and regline for a
particular application; regline gives errors but regCoef returns
unrealistic values. What I want to do is get a linear trend on some data
that has dimensions time, latitude, and longitude--I only want the trend
as it relates to time (getting secular trend of seasonally varying data).
The relevant section of code is:

water = in->water
lat=in->latitude
lat@units="degrees_north"
lon=in->longitude
lon@units="degrees_east"
time=in->time
wt = water(latitude|:,longitude|:,time|:) ; reorder
variable
;************************************************
; create x and calculate the regression coefficient
; note regline works on one dimensional arrays.
;************************************************
; x = ispan(0,dimsizes(wt&time)-1,1)*1. ; I have this
commented out currently, can be
;
used
only
if
wt
is
defined
beforehand
x = ispan(0, 381, 1)*1. ; the time dimension
is of size 382 so this is equiv

do latitude=-59.5, 89.5, 1
do longitude=-179.5,179.5, 1
; wt = water(latitude|:,longitude|:,time|:) ; reorder
variable inside do-loop?
rc = regline(x,wt)
rc!0 = "latitude"
; trying to assign dimensionality to rc
rc!1 = "longitude"
end do
end do

The error I get is:
fatal:Number of dimensions in parameter (1) of (regline) is (3), (1)
dimensions were expected

But to my mind, using a do-loop should plug in pairs of constants in wt
and thus make it 1-dimensional. I would like to have values on a lat/lon
grid. Thanks in advance for any suggestions!

Best,
Lizz Ultee

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jul 7 12:42:48 2011

This archive was generated by hypermail 2.1.8 : Tue Jul 12 2011 - 15:03:53 MDT