Re: Issue with isfilepresent (NCL version 6.1.2)

From: Saji Hameed <saji.nh_at_nyahnyahspammersnyahnyah>
Date: Tue May 20 2014 - 19:19:13 MDT

Hi Wei,

I like the idea of cleaning up the isfilepresent implementation. Right now
it is confusing as it is. For the time being,
I have my own fileexists function (incidentally the same name, but with
snake case, viz., file_exists). I will update my NCL
when the 6.2.1 release is published.

saji

On Wed, May 21, 2014 at 12: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
Received on Tue May 20 19:19:30 2014

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