[ncl-talk] Incompatibility between addfile and isfilepresent

Mary Haley haley at ucar.edu
Thu Sep 18 12:37:04 MDT 2014


Hi Kyle,

My apologies, it appears that nobody responded to your post, unless they
did so offline.

I'm scratching my head over this bug, because I'm sure I've been using
"isfilepresent" in the manner that you described, but yet it's not working
for me at the moment.

I consider this a serious bug and will file a report on it shortly.  If we
get it fixed, do you want an updated "ncl" binary with the fix?  I would
only need to give you a new "ncl" executable.

--Mary

On Tue, Sep 9, 2014 at 4:55 PM, Kyle Griffin <ksgriffin2 at wisc.edu> wrote:

> Just setting up 6.2.1 today, and finding that files that CAN be opened
> with addfile does not register with isfilepresent. While I could use
> filexists to duplicate the old functionality of the command, it would be
> nice to be able to take advantage of the "is this an openable file" check
> before feeding it to addfile later in my script.
>
> Specifically, the files that are causing this issue are ones that are
> GRIB2 files but do not contain a file extension. While I can give it the
> appropriate file extension to make addfile work (it checks for
> 'file_name.grb2' as well as simply 'file_name'), this feature does not seem
> to exist with isfilepresent and the function returns false for all calls
> with or without file extensions.
>
> I feel this isn't the desired implementation of this change to the
> function, and I think it might be an easy fix. Any insights? I've included
> some command-line interaction with the file below (specific file doesn't
> matter, as this issue should be true for any GRIB or GRIB2 file that is on
> the file system but has no extension).
>
> Let me know if I can/should provide further evidence, and thanks!
>
>
> Kyle
>
>
>
> ncl 0>
> print(isfilepresent("/cas2/unidata/GRIB/gfs0p5deg/GFS_140909_18_000.grb"))
>
> fatal:NetCDF: Unknown file format
>
> fatal:Could not open (/cas2/unidata/GRIB/gfs0p5deg/GFS_140909_18_000)
>
> (0) False
>
> ncl 1>
> print(isfilepresent("/cas2/unidata/GRIB/gfs0p5deg/GFS_140909_18_000.grb2"))
>
> fatal:NetCDF: Unknown file format
>
> fatal:Could not open (/cas2/unidata/GRIB/gfs0p5deg/GFS_140909_18_000)
>
> (0) False
>
> ncl 2>
> a=addfile("/cas2/unidata/GRIB/gfs0p5deg/GFS_140909_18_000.grb","r")
>
> ncl 3> printVarSummary(a)
>
>
> Variable: a
>
> Type: file
>
> File path: /cas2/unidata/GRIB/gfs0p5deg/GFS_140909_18_000
>
> Number of global attributes: 0
>
> Number of dimensions: 15
>
> Number of variables: 108
>
> ncl 4>
> print(isfilepresent("/cas2/unidata/GRIB/gfs0p5deg/GFS_140909_18_000"))
>
> fatal:NetCDF: Unknown file format
>
> fatal:Could not open (/cas2/unidata/GRIB/gfs0p5deg/GFS_140909_18_000)
>
> (0) False
> ----------------------------------------
> Kyle S. Griffin
> Department of Atmospheric and Oceanic Sciences
> University of Wisconsin - Madison
> Room 1421
> 1225 W Dayton St, Madison, WI 53706
> Email: ksgriffin2 at wisc.edu
>
> _______________________________________________
> ncl-talk mailing list
> 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/20140918/8acedbc0/attachment.html 


More information about the ncl-talk mailing list