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

Dennis Shea shea at ucar.edu
Thu Mar 24 10:34:47 MDT 2016


FYI: I have updated the example at:

http://www.ncl.ucar.edu/Applications/HiResPrc.shtml
See: cpcuni_1.ncl
<http://www.ncl.ucar.edu/Applications/Scripts/cpcuni_1.ncl>

There are additional options: (i) create netCDF4 rather than the 'classic'
netCDF-3; (ii) Have the script invoke the netCDF Operatoe 'ncrcat' via
NCL's 'system' procedure.

The previous example (a) did not set the _FillValue (=-999.0) and (b) did
not scale the values (*0.1). This does both.

Cheers

On Fri, Mar 18, 2016 at 4:35 PM, Samar Min Allah <minallah at umich.edu> wrote:

> 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!
>
> ​​
>
>
>
>
>
> _______________________________________________
> 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/20160324/c2168987/attachment.html 


More information about the ncl-talk mailing list