[Thread Prev][Thread Next][Index]
Re: getting netcdf filename in a string variable
Hi Delclaux Francois,
It is fairly easy with the key word "RETURN" and
the string utilities in Ferret. See the example below.
With Regards
Jaison
-------------example.jnl------------------------
\ cancel mode verify
! open a dataset in a different directory (...say from fer_dsets)
use coads_climatology
! get the full path of the dataset (fpath) & the name of the
! data file without the ".nc" & ".cdf" extention (fname)
! using "RETURN" on a variable in the file (sst)
define symbol fname = `sst,return=dset`
define symbol fpath = `sst,return=dsetpath`
! now suppose if you want to get the full file name (with ".cdf" or
! ".nc" extention and the path to the dataset without the last "/"
let fstart = STRINDEX("($fpath)","($fname)") ! first char of dset name
let flen = STRLEN("($fpath)") ! characters in the "path"
let fchars = flen - fstart + 1 ! characters in the dset name
let flname = SUBSTRING("($fpath)",`fstart`,`fchars`) ! full dset name
let flpath = SUBSTRING("($fpath)",1,`fstart-2`) ! path without last "/"
list/nohead flname
list/nohead flpath
!--------------end of example.jnl-----------------------------
On Wed, 16 Mar 2005, DELCLAUX Francois wrote:
> Hi,
>
> It's possible to get the current directory in a string variable using
> the commande :
> let dir = {spawn:"pwd"} :
>
> Now, I would like to put the current Netcdf filename in a string variable
> in a similar way. Is it possible , and how ?
>
> Thanks for your response.
>
--
___________________________________________________
Jaison Kurian
Centre for Atmospheric and Oceanic Sciences
Indian Institute of Science
B A N G A L O R E 560 012
Ph: +91-80-3942505
+91-80-3600450
Fax:+91-80-3600865
___________________________________________________
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement