Re: Issue with isfilepresent (NCL version 6.1.2)

From: Wei Huang <huangwei_at_nyahnyahspammersnyahnyah>
Date: Tue May 20 2014 - 09:28:35 MDT

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 09:28:50 2014

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