[ncl-talk] Issue using reshape function
Anne
anne.seidenglanz at unive.it
Thu Jan 24 05:56:23 MST 2019
Hello everyone,
I am trying to use 'reshape' to convert a 60 x 180 x 360 matrix to a 6 x 10
x 18 x 360 matrix in the following way:
dir_s
="/work/as10017/CESM/archive/Ensemble_means/yearly_means_h0/1993/"
fil_s = systemfunc("ls "+dir_s+"/sps_199311_*_
icef.cam.h0.6mth_grid.surface.nc")
f_s = addfiles(fil_s,"r")
t2m_test2 = f_s[:]->TREFHT
printVarSummary(t2m_test2)
t2m_reshape = reshape(t2m_test2,(/6,10,180,360/))
copy_VarCoords(t2m_test2(0,:,:), t2m_reshape(0,0,:,:))
printVarSummary(t2m_reshape)
I am getting the 1st dimension of my 60 x 180 x 360 array by using a
wildcard (*) and 'systemfunc' so that it concatenates (in a folder) 10
files with each 6 x 180 x 360 dimensions (months x mlat x nlon). I then
reshaped the 60 x 180 x 360 array so as to reflect the original file
structure : 6 x 10 x 180 x 360 (months x member x mlat x nlon).
This worked fine, however, if I check with
print(t2m_test2(4,0,0))
print(t2m_reshape(4,0,0,0))
I do not get the same values (223 Kelvin vs. 221 Kelvin). Did I miss
something here?
thanks
Anne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190124/9122e4ab/attachment.html>
More information about the ncl-talk
mailing list