login

strmem.gsf

Top / GrADS / script / strmem.gsf

Japanese / English

Name

strmem() - Store/Load strings.

Synopsis

ret = strmem( set, name, str )
 
ret = strmem( get, name )

Description

This function aims to recycle script variables in different scripts. Normally, it is recommended to use wrapper functions getstr() and setstr(). strmem() uses GrADS variable to store script variable. Using strmem() after opening control file is recommended, since GrADS variable is available after opening it. If no control file is opened, strmem() creates dummy control file grads_strmem.dummy.ctl in /var/tmp by default. If you want to change this default directory, change below line in strmem.gsf:

path = '/var/tmp'

The dummy control file sometimes remains in case the script exits abnormally. strmem.gsf cannot run if the dummy file exists, so try the following when you encounter error:

rm /var/tmp/grads_strmem_dummy.ctl

Options and Return values

set or get
"set" when saving strings, "get" when getting strings.
name
Variable name.
str
String to be stored.
ret
Stored string when getting strings ("get").

Script source code