[ncl-talk] Errors in file opening

Guido Cioni guidocioni at gmail.com
Fri Dec 22 02:01:01 MST 2017


Arka,
did you take a look at the relevant page on the documentation? (https://www.ncl.ucar.edu/Document/Functions/Built-in/fbinread.shtml <https://www.ncl.ucar.edu/Document/Functions/Built-in/fbinread.shtml>).
The function is called fbinread and not fbiinread. 

Although there was a typo in my last e-mail you cannot just take for granted the informations without trying to understand the problem by yourself. Trying to stitch together a function read on an e-mail and some other informations found somewhere isn't going to help you, trust me. You HAVE to read the documentation in order to solve your problem.

After the suggestions of Barry and Dennis you know what your script is supposed to do, namely:

loop over the file, as suggested by Barry. The fact that he was using addfile (instead that fbinread) doesn't mean anything: he was trying to give you an example for the loop...you HAVE to modify this example to suit your needs
use fbinread (but first you HAVE to understand how it works) to read every file in the loop. Dennis already gave you a simple example of how the function works.

So, again, read the documentation available, try to figure out your problem and DON'T post a new question to ncl-talk whenever a new problem arises. You can solve these problems by yourself. 

Thanks 


> On 22. Dec 2017, at 09:51, Arka Banerjee <arka354deb at gmail.com> wrote:
> 
> Now this is the error coming after using fbiinread.
> 
> 
> Datadir=("/home/arkadeb/Arka/GMFD/GSMap/")
> diri=Datadir
> all_files=systemfunc("ls " + diri + "gsmap_nrt*")
> print(all_files)
> n_files=dimsizes(all_files)
> print(n_files)
> do n=0, n_files-1, 1
> filename=all_files(n)
> print(filename)
> fn=fbiinread(filename,0,-1,"float")
> ;print(fn)
> ;end do
> 
> errors are below:
> 
> Variable: filename
> Type: string
> Total Size: 8 bytes
>             1 values
> Number of Dimensions: 1
> Dimensions and sizes:   [1]
> Coordinates:
> (0)     /home/GSMap/gsmap_nrt.20100805.0600.dat
> fatal:Undefined identifier: (fbiinread) is undefined, can't continue
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 16 in file Gsmap.ncl
> 
> 
> 
> 
> 
> On Fri, Dec 22, 2017 at 2:12 PM, Arka Banerjee <arka354deb at gmail.com <mailto:arka354deb at gmail.com>> wrote:
> I also earlier make the same question to them. I already see the page link : https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml <https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml>
> 
> From where it is clear that addfiles/addfile cant be use for dat files. But I got one sample example following my question which gives addfile option inside.
> 
> I am testing with fbiinread now as you mentioned and will inform you.
> 
> Thanks,
> Arka
> 
> On Fri, Dec 22, 2017 at 2:06 PM, Guido Cioni <guidocioni at gmail.com <mailto:guidocioni at gmail.com>> wrote:
> Again.. Don't open a new thread when new problems arise!
> 
> As already told you by Dennis you CAN'T open binary files with addfile. You have to open them with fbiinread. Please read the documentation AND the mail that we are writing to you. 
> 
> Il 22 dic 2017 8:47 AM, "Arka Banerjee via ncl-talk" <ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>> ha scritto:
> Hello user..
> 
> I run the attached part in my script and getting the following error msgs;
> 
> begin
> 
> Datadir=("/home/GSMap/")
> diri=Datadir
> all_files=systemfunc("ls " + diri + "gsmap_nrt*")
> n_files=dimsizes(all_files)
> do n=0,n_files-1,1
> filename=all_files(n)
> fn=addfile(filename,"r")
> .......
> .......
> 
> warning:_NclOpenFile: Can not open file </home/GSMap/gsmap_nrt.20100805.0600.dat>; file format not supported or file is corrupted
> warning:_NclOpenFile: Can not open file </home/GSMap/gsmap_nrt.20100805.0900.dat>; file format not supported or file is corrupted
> warning:_NclOpenFile: Can not open file </home/GSMap/gsmap_nrt.20100805.1200.dat>; file format not supported or file is corrupted
> warning:_NclOpenFile: Can not open file </home/GSMap/gsmap_nrt.20100805.1500.dat>; file format not supported or file is corrupted
> warning:_NclOpenFile: Can not open file </home/GSMap/gsmap_nrt.20100805.1800.dat>; file format not supported or file is corrupted
> warning:_NclOpenFile: Can not open file </home/GSMap/gsmap_nrt.20100806.2100.dat>; file format not supported or file is corrupted
> 
> fatal:Could not coerce values for operation
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 30 in file Gsmap.ncl
> 
> 
> 
> print(filename) shows the following error msg for each files;
> 
> Variable: filename
> Type: string
> Total Size: 8 bytes
>             1 values
> Number of Dimensions: 1
> Dimensions and sizes:   [1]
> Coordinates:
> (0)     /home/GSMap/gsmap_nrt.20100805.0600.dat
> warning:_NclOpenFile: Can not open file </home/GSMap/gsmap_nrt.20100805.0600.dat>; file format not supported or file is corrupted
> 
> 
> 
> Please inform me how to fix it.
> 
> Thanks,
> Arka
> 
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
> 
> 
> 


Guido Cioni
http://guidocioni.altervista <http://guidocioni.altervista/>.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171222/c3c6d007/attachment.html>


More information about the ncl-talk mailing list