[Thread Prev][Thread Next][Index]
Re: How to extract file name to symbol?
Hi Andrew,
There will be a clean solution to this in Ferret V5.3 where you will have
`my_var,return=dset` - to get the data set name
`my_var,return=dsetnum` - to get the data set number
`my_var,return=dsetpath` - to get the full data set name&path
In V5.22 the following kludge will capture the data set name and title as
symbols
use coads_climatology
plot/set sst[i=1,j=1,l=1]
!show symbols ! the whole list of 'em
show symbol LAB($LABNUM_DATITL)
show symbol LAB($LABNUM_DSET)
The kludge needed to get the full path is uglier. I think you'd have to do
something like
use coads_climatology
list sst[i=1,j=1,l=1]
list/clobber/file=out.dat sst[i=1,j=1,l=1]
sp head -5 out.dat | tail -1 | sed 's/^.*DATA SET:/DEFINE SYMBOL
dpath/' >out.jnl
go out.jnl
show symbol dpath
Incidentally, V5.3 also has a way to grab the output of any Unix command as a
string variable. But that's just frustrating knowledge at this point, isn't
it!
- steve
============================================
Andrew Wittenberg wrote:
> Does anyone know how to get the complete file name corresponding to a
> dataset number, and place it in a string symbol? Ferret will display the
> info with, e.g.,
>
> yes? show data/brief 4
> currently SET data sets:
> 4> /net/atw/dynamic/predict/cz/diags/diag439/climatology.nc
>
> but I can't figure out how to get hold of that file name so I can use it
> in a script. Is it stored in an internal ppl symbol somewhere? Or is
> there any way to send the output of "show data" to a file?
>
> Thanks for any help you can give,
>
> Andrew
>
> ----------------------------------------------------------------------
> Andrew Wittenberg Program in Atmospheric and Oceanic Sciences
> andyw@splash.princeton.edu Sayre Hall, Forrestal Campus
> Princeton University
> Princeton, NJ 08544-0710
> ----------------------------------------------------------------------
--
| NOAA/PMEL | ph. (206) 526-6080
Steve Hankin | 7600 Sand Point Way NE | FAX (206) 526-6744
| Seattle, WA 98115-0070 | hankin@pmel.noaa.gov
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement