[Thread Prev][Thread Next][Index]

Re: [ferret_users] String in functions

Hi Carlos,
The syntax of quotes can be confusing.  You need to use grave accents to evaluate bn, and then because the file names include the path, enclose that in double quotes.

yes? use "`bn[i=1]`"

If you want to do this in a REPEAT loop, then

yes? REPEAT/RANGE=1:3/NAME=m (let aname = bn[i=`m`]; set data "`aname`")

Carlos Szembek wrote:

We are having trouble reading strings in from an array.

We've generated an array of character strings which contain the names of files we want to read from called bn[i]

yes? list bn
             VARIABLE : {SPAWN: "ls /gulfstream/cmb243/carlos/xcj*TS.nc"}
             SUBSET   : 20 points (X)
 1    /  1:"/gulfstream/cmb243/carlos/xcjha_TS.nc"
 2    /  2:"/gulfstream/cmb243/carlos/xcjhb_TS.nc"
 3    /  3:"/gulfstream/cmb243/carlos/xcjhc_TS.nc"
 4    /  4:"/gulfstream/cmb243/carlos/xcjhd_TS.nc"
 5    /  5:"/gulfstream/cmb243/carlos/xcjhe_TS.nc"
 6    /  6:"/gulfstream/cmb243/carlos/xcjhf_TS.nc"
 7    /  7:"/gulfstream/cmb243/carlos/xcjhg_TS.nc"
 8    /  8:"/gulfstream/cmb243/carlos/xcjhh_TS.nc"
 9    /  9:"/gulfstream/cmb243/carlos/xcjhi_TS.nc"
 10   / 10:"/gulfstream/cmb243/carlos/xcjhj_TS.nc"
 11   / 11:"/gulfstream/cmb243/carlos/xcjva_TS.nc"
 12   / 12:"/gulfstream/cmb243/carlos/xcjvb_TS.nc"
 13   / 13:"/gulfstream/cmb243/carlos/xcjvc_TS.nc"
 14   / 14:"/gulfstream/cmb243/carlos/xcjvd_TS.nc"
 15   / 15:"/gulfstream/cmb243/carlos/xcjve_TS.nc"
 16   / 16:"/gulfstream/cmb243/carlos/xcjvf_TS.nc"
 17   / 17:"/gulfstream/cmb243/carlos/xcjvg_TS.nc"
 18   / 18:"/gulfstream/cmb243/carlos/xcjvh_TS.nc"
 19   / 19:"/gulfstream/cmb243/carlos/xcjvi_TS.nc"
 20   / 20:"/gulfstream/cmb243/carlos/xcjvj_TS.nc"

We want to read these files sequentially but are unable to even have ferret recognize the contents of the string array. We have tried:

use "bn[i=1]"

use bn[i=1]

let bb = bn[i=1]
use "bb"

with the error:
 **TMAP ERR: non-existent or not on line
             Searched $FER_DESCR and $FER_DATA for bn[i=1](.des,.cdf,.nc)

 **TMAP ERR: non-existent or not on line
             Searched $FER_DESCR and $FER_DATA for bb(.des,.cdf,.nc)

Just to note, we have typed in:
use "/gulfstream/cmb243/carlos/xcjha_TS.nc"

and it has worked for all the sequential files.

Any insight would be greatly appreciated,
Carlos S.

Carlos Szembek
Yale University
Atmosphere, Ocean and Climate Dynamics
Kline Geology Lab
210 Whitney Ave, Rm 256
New Haven, CT 06511

[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement