[ncl-talk] Fwd: Adding additional dimensions to an existing variable

Alan Brammer abrammer at albany.edu
Wed Jun 10 10:08:33 MDT 2015


The easiest way to do this is using the time functions and indexing.

ymdhms = cd_calendar(x, 0) ;

dec_ind = ind(ymdhms(:,1) .eq. 12) ;; find locations where month .eq. 12.

x_dec = x(dec_ind,:,:)

Adding another 2 dimensions, doesn't seem necessary. You can stack the
ind() function to be as specific or as broad as you like very easily. Will
be more flexible than multiple time dimension.


​Alan. ​



On 10 June 2015 at 11:58, Zachary Suriano <zsuriano at udel.edu> wrote:

>
> Ultimately I would like to pull out data from each month individually with
> a statement such as: dec=x( : , 12 , : , : , : ). With leap days present
> within the dataset, I cannot figure out a way to achieve this without
> having year, month, day being their own dimensions.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150610/e095257a/attachment.html 


More information about the ncl-talk mailing list