[ncl-talk] Combine Array
Walter Kolczynski
walter.kolczynski at noaa.gov
Fri Jun 12 17:04:55 MDT 2015
Please always reply to the list and not to people individually.
Please make sure the arrays you are passing into array_append_record are
the correct dimensionality. Looking at your example again, x1=a(0,:,:)
will automatically remove the degenerate time dimension, reducing the
rank from 3 to 2, so when you try to use array_append_record to combine
with x2 (which is still rank 3), you get an error. You could use conform
to add the extra dimension back on to x1, but a better way is still to
give all the indexes you want at once:
inds = array_append_record( 0, ispan(2,29,1), 0 )
x = a(inds,:,:)
That way you keep all of the metadata.
- Walter
On 12-Jun-15 18:42, Taufik Samudra wrote:
>
> i had already try for function array_append_record, but this function
> must be have same amount of each dimention.. Can explain how to
> modified this function while I had different amount of time dimention?
> thanks..
>
> On Jun 13, 2015 5:26 AM, "Walter Kolczynski"
> <walter.kolczynski at noaa.gov <mailto:walter.kolczynski at noaa.gov>> wrote:
>
> array_append_record should do what you're looking for. For this
> specific example, you could also just pass in an array of the
> indexes you want instead of making the two intermediate arrays.
>
> - Walter
>
> On 12-Jun-15 18:20, Taufik Samudra wrote:
>>
>> Hello,
>> I have variable a(time=30,lat=80,lon=180)
>> I want to get a new variabel like
>> x1=a(0,:,:)
>> x2 =a(2:29,:,:)
>> how to combine x1 and x2 and get a new variabel?x1 and x2 has
>> difereent amount for dimentiobln time.. Is it possible in NCL?
>> this for my project about cross validation
>> thanks..
>>
>>
>>
>> _______________________________________________
>> 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
>
> --
> Walter Kolczynski, Jr.
> Global Ensemble Team
> NOAA/NWS/NCEP/EMC (via I.M. Systems Group)
> (301) 683-3781
>
>
> _______________________________________________
> 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
>
--
Walter Kolczynski, Jr.
Global Ensemble Team
NOAA/NWS/NCEP/EMC (via I.M. Systems Group)
(301) 683-3781
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150612/7ad241c0/attachment.html
More information about the ncl-talk
mailing list