[ncl-talk] Finding out a file's path

Wei Huang huangwei at ucar.edu
Fri Aug 8 08:58:29 MDT 2014


Tom,

NCL does not have a function to return the file variable's related path.
We have never thought of such a function, as in NCL, one has to provide
explicitly a file name to addfile or files to addfiles, so it is assumed
that
the users know which the file path with correspond file-handle created.

Surely that each file variable created in NCL has its file-path info
associated
with, but there is no direct function to return the path back to the user
(as stated above that NCL assumes users already know this info).

By request, we can certainly create a function which will return the
file-path of the file variable.

Thanks,

Wei

================================================
1850 Table Mesa Dr.
Boulder, CO 80307
Phone: 303-497-8924


On Thu, Aug 7, 2014 at 8:51 PM, Tom Roche <Tom_Roche at pobox.com> wrote:

>
> http://www.ncl.ucar.edu/Support/talk_archives/2008/0230.html
> [Dennis Shea Tue, 12 Feb 2008 06:33:50 -0700]
> >> You can not determine the path/file to which "file" is pointing.
>
> Is this still the case, API-wise? Because certainly a file (or as I prefer
> to say, a filehandle) knows its path:
>
> $ ncl -V
> 6.2.0
> $ ncl
> ncl 0> refr_fp =
> "/project/inf35w/roche/met/24-layer/WRF_2008_24aL/12US1/mcip_out/METBDY3D_071222"
> ncl 1> refr_fh = addfile(refr_fp, "r")
> ncl 2> printVarSummary(refr_fh)
>
> Variable: refr_fh
> Type: file
> File path:
>  /project/inf35w/roche/met/24-layer/WRF_2008_24aL/12US1/mcip_out/METBDY3D_071222
> Number of global attributes:     33
> Number of dimensions:    5
> Number of variables:     18
>
> http://www.ncl.ucar.edu/Support/talk_archives/2008/0233.html
> [Jan Ploski Tue, 12 Feb 2008 14:38:51 +0100]
> > I can pass the path used to create the file object together with the
> [filehandle]
> > to my procedure [but it's] rather redundant and ugly
>
> agreed! Tom Roche <Tom_Roche at pobox.com>
> _______________________________________________
> 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/20140808/08c63ead/attachment.html 


More information about the ncl-talk mailing list