[ncl-talk] curious indexing behaviour when reading an array

Will Hobbs will.hobbs at utas.edu.au
Tue Jun 25 01:22:28 MDT 2019


Hi all

I suspect this is some kind of Endian issue or something with netCDF4 and nothing much can be done, but I’ve a found a weird issue that I’ve never noticed in previous versions (I’m using v 6.6.2 on a Mac, OSX 10.11)

Reading in a rank 5 array from netCDF using addfile(), dimensioned (3, 2, nlev, nlat, nlon):

>fi = addfile(“filename.nc”,”r”)
>data = fi->thetao
>do i = 0, 2
   print(num(ismissing(thetao(i,:,:,:,:))))
>end do

;;;returns the numbers 971700, 952510, 0

;now use indexing

eInd = (/0,1,2/)
data := fi->thetao(eInd,:,:,:,:)
>do i = 0, 2
   print(num(ismissing(thetao(i,:,:,:,:))))
>end do

;;;returns the numbers 0, 952510, 971700 – i.e. the dimension has ‘flipped’ for no good reason

Has anyone else seen this? I couldn’t find anything in the NCL-talk archives

Will







University of Tasmania Electronic Communications Policy (December, 2014).
This email is confidential, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone outside the intended recipient organisation is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender. The views expressed in this email are not necessarily the views of the University of Tasmania, unless clearly intended otherwise.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190625/3967efe1/attachment.html>


More information about the ncl-talk mailing list