[ncl-talk] Incompatibility between addfile and isfilepresent
Kyle Griffin
ksgriffin2 at wisc.edu
Tue Sep 9 16:55:45 MDT 2014
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140909/68135f72/attachment.html
More information about the ncl-talk
mailing list