[ncl-talk] Error in reading in multiple files
Dennis Shea
shea at ucar.edu
Thu Dec 28 07:47:54 MST 2017
Please, always include the version of NCL you are using.
%> ncl -V
Also, helpful would be to include (attach) a sample file dump:
%> ncl_filedump CAL_LID_L2_05kmAPro-Standard-V4-10.....hdf >!
dump.CAL_LID_L2
===========
I *speculate* that the following may be the issue:
f = addfiles(diri+fili,"r")
Since addfiles creates a variable (here, 'f') of type list: one loop
iteration may create a list containing (say) 10 files, the next may have a
list containing (say) 5 files. DIfferent sizes.
f the sizes change, you should use the NCL reassignment operator :=
-----
By default, NCL is a *strongly typed language*. It will not allow certain
operations.
float a(10)
double b(10)
float c(30)
By default:
a = b ; NCL will issue a FATAl error; it will not allow a double=>
float
a = c ; FATAL ... it will not allow an array of size 30 to be
reassigned to an array that is size 10
; This is where the
; "*Dimension sizes of left hand side and right hand side
of assignment do not match"*
a := b ; OK
a := c ; OK
-----
Try using NCL's reassignment operator *:=*
f *:=* addfiles(diri+fili,"r")
On Thu, Dec 28, 2017 at 2:12 AM, Shani Tiwari via ncl-talk <
ncl-talk at ucar.edu> wrote:
> Dear NCL users
> I want to read multiple CALIPSO data files (5444
> files) and add all file files in every five days average but I got the
> error.
> *Dimension sizes of left hand side and right hand side of assignment do
> not match*
> Here is my script following the calipso_3.ncl at
> https://www.ncl.ucar.edu/Ap
> <https://www.ncl.ucar.edu/Applications/calipso.shtml>
> plications/calipso.shtml
> <https://www.ncl.ucar.edu/Applications/calipso.shtml>. Kindly help me to
> overcome this problem.
>
> ;----------------------------------------------
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/ut_string.ncl"
> ;----------------------------------------------
> begin
>
> ;----------------------------------------------
> ; OPEN CALIPSO FILES of the selected year, month and days
> ;----------------------------------------------
> ; define year, month, date (yyyys, mms, dds) as strings
> ;----------------------------------------------
> yyyys = (/"2014"/)
> mms = (/"06","07","08","09","10","11","12"/)
> dds = (/"01","02","03","04","05","06","07","08","09","10", \
> "11","12","13","14","15","16","17","18","19","20", \
> "21","22","23","24","25","26","27","28","29","30", "31"/)
>
> ;kyy=14 ; year 20kyy
> jmm=7 ; month jmm
>
> ;----------------------------------------------
> ; setting directory of the data files
> ;----------------------------------------------
>
> diri = "/Volumes/OSX/CALIPSO/L2V410/2014/"
>
> ;----------------------------------------------
> ;----------------------------------------------
> ; LOOP TO GET FILE NAMES OF A DAY SEQUENTIALLY
> ; AND READ THE FILE
> ;----------------------------------------------
> ;----------------------------------------------
>
> do idd=0,5 ;30 ; loop for day
> (idd-1).
>
> fili = systemfunc("cd "+diri+" ; ls CAL_LID_L2_05kmAPro-Standard-V
> 4-10."+yyyys+"-"+mms(jmm-1)+"-"+dds(idd)+"*N.hdf ")
> nfil = dimsizes(fili) ; nfil = number
> of CALIPSO files, use for loop.
>
> ;print (nfil)
>
> f = addfiles(diri+fili,"r")
>
>
> end do
>
> ;print (f)
>
> end
>
> ------------------------------------------------------------
> Shani Tiwari, Ph.D.
> Graduate School of Environmental Studies,
> Nagoya University, Nagoya, Japan
> Mob: +91 9451952997 <+91%2094519%2052997>
> Skype ID: shani.tiwari2
> Research Gate: Dr. Shani Tiwari
> <https://www.researchgate.net/profile/Shani_Tiwari2>
> Google Scholar Web-page: Dr. Shani Tiwari
> <https://scholar.google.co.jp/citations?user=IjIjMTMAAAAJ&hl=en>
> -------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171228/c24016cf/attachment.html>
More information about the ncl-talk
mailing list