[ncl-talk] Error subscript when using indices output from dim_pqsort to reorder another array
YAN HUIPING
yanhp2009 at gmail.com
Thu May 28 16:49:03 MDT 2020
Thank you Laura, I tried, but it does not help.
and just now I created a simple script like the example of the function dim_pqsort ,and it came out the same errors.
“ fatal:Illegal subscript. Subscripts must be scalar or one dimensional vectors
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 12 in file test.ncl"
=========================================
begin
x=(/(/2,1,3/),(/4,6,5/)/)
printVarSummary(x)
print(x)
ip=dim_pqsort(x,-2)
print(x)
printVarSummary(ip)
y=(/(/2,1,3/),(/4,6,5/)/)
y=y(ip,:)
print(y)
end
> On May 29, 2020, at 6:35 AM, Laura Fowler <laura at ucar.edu> wrote:
>
> Hi Huiping:
> may be you need to add delete(TTnew) before the line:
>
> delete(TTnew)
> TTnew=y(ip,:,:,:);
> printMinMax(TTnew,0)
>
> since TTnew is originally a 4-dimensional array.
> Laura
>
>
>
>
> On Thu, May 28, 2020 at 4:23 PM YAN HUIPING via ncl-talk <ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>> wrote:
> Hi,
> I post the message
>
>
> the ncl script:
>
> ==========================================
> x=PPnew
> print(num(ismissing(x)))
> y=TTnew
> ip=dim_pqsort_n(x,-2,3)
> printVarSummary(x)
> printVarSummary(ip)
> printMinMax(ip,0)
> print(dimsizes(ip))
>
> TTnew=y(ip,:,:,:);
> printMinMax(TTnew,0)
> =========================================
>
> (0) missing number 0
>
> Variable: x
> Type: float
> Total Size: 31948800 bytes
> 7987200 values
> Number of Dimensions: 4
> Dimensions and sizes: [time | 12] x [lat | 160] x [lon | 320] x [LEV | 13]
> Coordinates:
> time: [20160116.875..20161216.875]
> lat: [89.14151942646112..-89.14151942646112]
> lon: [ 0..358.875]
> LEV: [107500..5000]
> Number Of Attributes: 7
> _FillValue : 1e+20
> institution : MPIMET
> cell_methods : time: mean
> table : 128
> code : 130
> units : K
> long_name : pressure
>
> Variable: ip
> Type: integer
> Total Size: 31948800 bytes
> 7987200 values
> Number of Dimensions: 4
> Dimensions and sizes: [12] x [160] x [320] x [13]
> Coordinates:
> (0) min=0 max=12
> (0) 12
> (1) 160
> (2) 320
> (3) 13
> fatal:Illegal subscript. Subscripts must be scalar or one dimensional vectors
>
> ====================
>
> Y has the same dimensions as X ([time | 12] x [lat | 160] x [lon | 320] x [LEV | 13]). And there is no missing value in X, but Y has some.
>
>
> Thus, I think there are some bugs here. Could you please help me look into it?
>
> Thanks,
> Huiping
>
>
>> On May 29, 2020, at 1:21 AM, Dennis Shea <shea at ucar.edu <mailto:shea at ucar.edu>> wrote:
>>
>> Whenever you encounter an error, you should add print statements to help you debug the issue.
>>
>> printVarSummary(x) ; overview of source variable
>> print("-----") ; visual break
>>
>> ip = dim_pqsort(x,-2) ;; descending order
>> printVarSummary(ip)
>> prinyMinMax(ip, 0)
>> print("-----")
>>
>> dim_ip = dimsizes(ip)
>> print(dim_ip)
>> print("-----")
>>
>> y=y(ip,:,:,:)
>> =============================
>> Are there grid locations that contain all missing values?
>>
>>
>>
>> On Tue, May 26, 2020 at 6:36 PM YAN HUIPING via ncl-talk <ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>> wrote:
>> Hi,
>> I am using the function dim_pqsort to reorder an array with dimensions of (time,nlat, nlon, nlev) following the instructions https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_pqsort.shtml <https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_pqsort.shtml>
>>
>> ip=dim_pqsort(x,-2);; descending order
>> y=y(ip,:,:,:)
>>
>> However, there are error messages: “fatal:Illegal subscript. Subscripts must be scalar or one dimensional vectors”.
>> Ps: the version of NCL I used is 6.5.0
>>
>> Could please help me on this problem?
>>
>> Thanks,
>> Huiping
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>
> --
> !-------------------------------------------------------------------------------------------------------------
> Laura D. Fowler
> Mesoscale and Microscale Meteorology Division (MMM)
> National Center for Atmospheric Research
> P.O. Box 3000, Boulder CO 80307-3000
>
> e-mail: laura at ucar.edu <mailto:laura at ucar.edu>
> phone: 303-497-1628
>
> !-------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200529/e22cc138/attachment.html>
More information about the ncl-talk
mailing list