auto_ReplaceTextFromNCFileΒΆ

auto_ReplaceTextFromNCFile searches the given page for bookmarks (strings enclosed in dollar signs, Example $Origin$) and replaces the text with attribute values from the given netCDF (.NC) file.

nReplaced = auto_ReplaceTextFromNCFile(hPage, ssNCFileName)
nReplaced = auto_ReplaceTextFromNCFile(hPage, ssNCFileName, bEdit)
nReplaced = auto_ReplaceTextFromNCFile(hPage, ncid)
nReplaced = auto_ReplaceTextFromNCFile(hPage, ncid, bEdit)

Return Value

nReplaced is the number of replaced strings. If no text is replaced or an error occurs, the value 0 will be returned.

Parameters

hPage

hPage is a page handle. hPage is the return value of auto_LoadTemplate.

ssNCFileName

ssNCFileName is the complete netCDF file name. The function auto_ImportData returns the NC file name for the specified data file.

ncid

ncid is the id of an open NC2 file.

bEdit

If bEdit is TRUE (1) the placeholder text will be copied into the object name. In this case the text object can be edited by a double-click on the grouped object. Default value is FALSE (0).

Comment

The placeholder in the IPW file must be enclosed in dollar symbols. Example: $Origin$. The text within the $ symbols must agree with a text in the global attributes of the specified NC file. The place-holder text is case sensitive. Values will be transfomed into strings. If the NC attribute contains a vector, the elements will separated by a comma followed by a blank.

To access attributes of a specific variable, the variable name must be separated from the attribute name with a period. Example: $Torque.long_name$.

See also: Text Placeholder.

Example

auto_AddToUI("Examples", "Example 1: Map", "RS_Example1");
def RS_Example1()
{
    auto_SetFileNameDialogInit("*.xls", GetRootDirectory() + "samples/");
    svFile = auto_GetFileNameDialog(1);
    if (svFile[1] == "DLG_CANCEL") {
    return;
    }
    hPage = auto_LoadTemplate("Example.ipw");
    svFile[1] = auto_ImportData(svFile[1]);
    auto_LoadDataset("Diagramm 1", "N", "EWGMOM", "EWGLST");
    auto_LoadDataset("Diagramm 2", "N", "EWGMOM", "BEEWG");
    auto_ReplaceTextFromNCFile(hPage, svFile[1]);
    auto_ScaleAxes();
    auto_UpdatePage();
}

id-424919