[ncl-talk] (Error:conform) Weighting observations before applying EOF

Dennis Shea shea at ucar.edu
Sun Feb 12 13:32:50 MST 2017


Well ... I was just about to hit 'Send' when Mary's email was received.
My response:

====

Without downloading the data, I can see the issue. You have

  y        = wgt_runave_Wrap (x(lat|:,lon|:,time|:), wgt, 0)

If you did the following, you wuld see
  printVarSummary(y)           ;   y(lat,lon,time)
                                             ;     ( *0 , 1  ,  2  *) ...
so 'lat' is dimension *0*  'y'

;***
  pw     = y
  pw     = y*conform(y, clat, *0*)

Good Luck

On Sun, Feb 12, 2017 at 1:27 PM, Mary Haley <haley at ucar.edu> wrote:

> Hi Lyndon,
>
> I think the problem is simply that "conform" is not being used correctly.
> The error is giving you a hint as to what the problem is:
>
> *fatal:conform: the dimensions sizes of the second argument do not match
> those indicated by the third argument*
>
> The way conform works is that the first argument represents an array that
> you want to conform a smaller array (the second argument) to. The third
> argument must be a list of dimension indexes where the dimensions of the
> small array match the larger array.
>
> For example, if you have a 3D array (arr3d) of size 10 x 20 x 30, and a 1D
> array (arr1d) of size 20 that you want to expand to the size of arr3d, then
> the dimension index you need to use is 1 (dimension numbering starts at 0):
>
>   arr1d_expand = conform(arr3d,arr1d,1)
>
> Or, if you have a 2D array of size 10 x 30 then the dimension indexes
> would be (/0,2/):
>
> arr2d_expand = conform(arr3d,arr2d,(/0,2/))
>
> In your case, you are trying to copy a 1D array of latitudes to a larger
> array, and using "1" as your dimension index. However, y is dimensioned lat
> x lon x time, so you should be using "0" as the dimension index:
>
>    pw     = y*conform(y, clat, 0)
>
> As for your second question, if you are asking how to create an XY plot
> with multiple curves, then see our XY plotting page:
>
> http://www.ncl.ucar.edu/Applications/xy.shtml
>
> To get "nice" time labels on the X axis, you can use the
> "time_axis_labels" function. See:
>
> http://www.ncl.ucar.edu/Applications/time_labels.shtml
>
> --Mary
>
>
>
>
> On Fri, Feb 10, 2017 at 2:01 AM, Lyndon Mark Olaguera <
> olagueralyndonmark429 at gmail.com> wrote:
>
>> Dear fellow NCL users,
>>
>> I am trying to perform an EOF analysis on daily olr anomalies. I tried to
>> extract the values of eof_ts but they are very large (-100 to 100). Based
>> from the documentation (http://www.ncl.ucar.edu/Docum
>> ent/Functions/Contributed/eofunc_Wrap.shtml), the values should be
>> weighted first.  Attached is the script that I am using.
>>
>> Here is the link to the data:
>>
>> [Link to the anomalies] https://drive.google.com/file/
>> d/0B9faET7Bc2o8eHZKSi1qX3JLeFU/view?usp=sharing
>>
>> [Link to the raw data] https://drive.google.com
>> /file/d/0B9faET7Bc2o8RjhGM2E1Ni1MTVU/view?usp=sharing
>>
>> I encountered the following errors:
>>
>> *fatal:conform: the dimensions sizes of the second argument do not match
>> those indicated by the third argument*
>>
>> This part of the code is the problem.
>>
>>   rad    = 4.*atan(1.)/180.
>>   clat   = f->lat
>>   clat   = sqrt( cos(rad*clat) )
>> ;************************************************
>> ;Weight all observation
>> ;************************************************
>>   pw     = y
>>  * pw     = y*conform(y, clat, 1)*
>>
>>   xw     = pw({lat|latS:latN},{lon|lonL:lonR},time|:)
>>
>>   eof    = eofunc_Wrap(xw,neof, False)
>>   eof_ts = eofunc_ts_Wrap(xw,eof,False)
>>
>>
>> Also, I would like to plot a similar figure attached to this mail. The
>> attached figure is Amplitude of the PC's (y axis) versus the days (x) axis
>> averaged from 1979-1992.
>>
>> Any suggestion on how can I do this correctly?
>> I'll appreciate any help.
>>
>>
>> Sincerely,
>>
>> Lyndon
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
> _______________________________________________
> 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/20170212/f3659307/attachment.html 


More information about the ncl-talk mailing list