[ncl-talk] Fwd: Reading multiple binary files using addfiles

Samar Min Allah minallah at umich.edu
Fri Mar 18 16:35:56 MDT 2016


I am trying to convert multiple binary files (CPC_Unified precip data) to
netcdf format using the following NCL script:
https://www.ncl.ucar.edu/Applications/Scripts/cpcuni_1.ncl

I modified the script to read multiple files together by adding the
following;

diri   = "./"
fil   = systemfunc("cd "+diri+" ; ls PRCP_CU_GAUGE_V1.0GLB_0.50deg.lnx.*")
nfil = dimsizes(fil)

do nf = 0,nfil-1
   fili = addfiles(diri+fil(nf),"r")
netCDF = True
   PLOT   = False

   if (netCDF) then
       ncDir   = "./"
       ncFil   = fili+".nc"
   end if
.
.
. *(the remaining code is same as the script)*
end do

When I run the code; I get this error "*Could not coerce values for
operation*"
Also, I believe addfiles require a file extension but when I add .bin next
to the file name I get the message "*...has no file extension, can't
determine type of file to open*"

I have also attached two sample files.

Thanks!

​​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160318/7d5b0561/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PRCP_CU_GAUGE_V1.0GLB_0.50deg.lnx.19790101.gz
Type: application/x-gzip
Size: 171064 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160318/7d5b0561/attachment-0002.gz 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PRCP_CU_GAUGE_V1.0GLB_0.50deg.lnx.19790102.gz
Type: application/x-gzip
Size: 157214 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160318/7d5b0561/attachment-0003.gz 


More information about the ncl-talk mailing list