# Re: regression at each station

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue, 18 Aug 2009 06:09:26 -0600

Hi Sunflower,

My guess is that "df" is a scalar [size=1]. The function requires
that the 'a' and 'b' arguments be the same dimensionality
as the 'x' variable.

DF = conform(x, df, 0)

You could also use

A = conform(x, 0.5, 0)

rather than

> A = new((/754,1/),"float")
> A = 0.5

Good luck
D

yanling_1220 wrote:
> Dear Dennis，
>
> Thanks for your last reply!I go out for something a half month，so
> I continue my research today，and encounter some problems in using
> "betainc" to calculate probabilities and outputing the regcof result in
> ascii.
>
> The VarSummary of "rc" retured from "rc = regCoef ( xObs
> ,fo(pts|:,time|:) )" is as below:
> Variable: rc
> Type: float
> Number of Dimensions: 1
> Dimensions and sizes: [754]
> Coordinates:
> Number Of Attributes: 4
> _FillValue : 1e+20
> nptxy : <ARRAY of 754 elements>
> rstd : <ARRAY of 754 elements>
> tval : <ARRAY of 754 elements>
>
> I uesed following to calculate probabilities for each station,
> A = new((/754,1/),"float")
> A = 0.5
> prob = betainc(df/(df+tval^2),df/2.0,A)
> but I got the error message ：fatal:betainc: The three input arrays must
> have the same number of dimensions
> What should I do to solve this problem?
>
> I tried to use "print" to look over the "nptxy" "rstd" "tval", why
> "print(tval)" display nothing,but the other show their values(754*1)? I
> want to output the "rc" " nptxy" "rstd " " tval "and "prob" of each
> station in a ascii(txt) file(that is say the output is a 754*5
> array),can this be achieved in ncl，and what and how should I do？I
> lookup many examples and functions，and still don't know how to
>
> sunflower
>
>
>>Hi Sunflower
>>
>>
>>However, if you have an ascii [text] file that has the data in
>>rows and columns, you should be able to use
>>
>>
>>
>> npts = 754,
>> ntim = ...
>> xObs = asciiread ( "...", (/npts, ntim/), "float")
>>
>>or
>> xx = asciiread ( "...", (/ntim,npts/), "float")
>> xx!0 = "time"
>> xx!1 = "pts"
>> xObs = xx(pts|:,time|:)
>>
>>
>>then
>> rc = regCoef ( xObs , fo(pts|:,time|:) )
>>
>>Good luck
>>D
>>
>>yanling_1220 wrote:
>>> Dear Dennis,
>>>
>>> I'm afraid my poor English expression have bring some trouble in our
>>> conmunication with this topic.I try to describe my problem clearly this
>>> time.
>>>
>>> I think your suggestion is how to gain the regression coefficients at
>>> each station only with the output from 'linint2_points' (that is to say
>>> only within each station's GCM timeseries），but What I want to know is
>>> how to gained "linear regression coefficients" "tval"and"tstd"
>>> between GCM and observed timeseries the two timeseries data sets at each
>>> station.
>>>
>>> So，I think if I try to use the "regCoef" to do waht I want to,I must do
>>> like below:
>>>
>>> Assuming the the output from 'linint2_points' is (say)
>>> fo(time,pts)
>>> then
>>> rc = regCoef ( x , fo(pts|:,time|:) )
>>> rc(754)
>>> Here "x" should be observed timeseries in my research ,which have a same
>>> format as fo and with "time" as the right dimension.My problem pop up at
>>> here,how to put my station observed timeseries data into NCL as "x".
>>>
>>> At first，I think I only have to conversion the observed timeseries data
>>> in .txt to netCDF format which also with the dimension as(time,pts),if
>>> it is successful,the other things is easy. I tried to convert my station
>>> data to the GrADS station type (.dat) via Fortran coed firstly,then
>>> tried to convert the .dat file(with the ".ctl") into nc file via the
>>> "lats4d" in GrADS,but it failed.
>>> and I don't know which other method can put the observed timeseries
>>> data with dimension(time,pts).Can you have any suggestion？
>>>
>>> I hope I have a clear expression about my problem this time,and wish
>>>
>>> Thanks！Everything goes well.
>>>