Re: Issue with isfilepresent (NCL version 6.1.2)

From: Dave Allured - NOAA Affiliate <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Thu May 22 2014 - 12:35:50 MDT

NCL support team,

Thank you for introducing the upcoming fileexists function, this is much
needed.

Here are some more suggestions to reduce ongoing confusion with the old
isfilepresent function.

Consider deprecating the function under the name isfilepresent. Replace it
with a new name that clearly indicates it is for supported file formats,
not general file system queries. Something like "issupportedfile".

At the same time, please revise the existing documentation for
isfilepresent as well as for the proposed new function. Please indicate
clearly:

1. issupportedfile and isfilepresent are for testing for supported addfile
formats, NOT general file presence.

2. Two conditions must be satisfied to return True. The named file must
exist on the file system, and it must be one of the addfile supported
formats.

3. The functions return False when a file is present with the given name,
but is not one of the addfile supported formats. This is a restatement of
(3) to try to make the behavior extremely clear. I think this needs to be
stated explicitly.

4. Please include a hyperlink to documentation for addfile supported
formats.

5. Please indicate that in some cases, isfilepresent and issupportedfile
will also check for files with alternate file name extensions. Please
include information or a link on how alternate names are determined by NCL.

6. Please include a cross-referencing note that fileexists should be used
for general file name testing, for supported files as well as all other
possible file types.

Thanks for your consideration.

--Dave

On Tue, May 20, 2014 at 9:28 AM, Wei Huang <huangwei@ucar.edu> wrote:

> Saji,
>
> There are some issues with "isfilepresent(xxx)" in 6.2.0, and earlier
> versions.
>
> The original idea of "isfilepresent(xxx)" is to check if file "xxx" can be
> handled by NCL.
> If NCL can read (more specifically with NetCDF, HDF, HDFEOS),
> then "isfilepresent(xxx)" should return True, otherwise it returns False.
> But sometimes, users, even the developers, may misunderstand this
> function, and misuse it.
>
> To clear the above, we are introducing a new function: "fileexists(xxx)".
> Which will be just like a Unix command to check if file "xxx" exists.
> And "isfilepresent(xxx)" will check if file "xxx" can be handled/read by
> NCL.
>
> In your example:
>
> print(fileexists("../test")) will be True
> print(fileexists("../test2")) will be False.
>
> and
>
> print(isfilepresent("../test")) and print(isfilepresent("../test2") will
> both return False.
> As a side effects, since NCL will do a lot of checks on these two case,
> where the first case will cause some error message, and the second one
> cause
> a lot of error message.
>
> Unfortunately, all these changes will be in 6.2.1 release later.
>
> If you want the most recent NCL executable (beyond 6.2.0), please let us
> know.
>
> If you have any concerns/suggestions regarding this issue, please feedback
> to ncl-talk.
>
> Thanks,
>
> Wei
>
> On May 15, 2014, at 7:47 PM, Saji Hameed <saji.nh@gmail.com> wrote:
>
> Dear NCL developers.
>
> The return value from isfilepresent is wrong when using relative paths. In
> my
> case I am trying to see if a certain file is present in the parent
> directory, for e.g
> isfilepresent.
>
> An example
>
> $ touch ../test
>
> Copyright (C) 1995-2013 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 6.1.2
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> ncl 0> print(isfilepresent("../test"))
> (0) True
> ncl 1> print(isfilepresent("../test2"))
> (0) True
> ncl 2> exit
>
> The file "../test2" does not really exist. The following from the linux
> command line
> returns the correct answers.
>
> $ test -f ../test ; echo $?
> 0
>
> $ test -f ../test2 ; echo $?
> 1
>
> The function isfilepresent returns correct answers if I use the full path.
>
> Here are the NCL and system details
>
> NCL version 6.1.2
>
> $ uname -a
> Linux enformtk 2.6.32-41-server #90-Ubuntu SMP Tue May 22 12:41:40 UTC
> 2012 x86_64 GNU/Linux
>
>
> saji
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu May 22 12:36:03 2014

This archive was generated by hypermail 2.1.8 : Tue May 27 2014 - 15:45:08 MDT