.. highlightlang:: us .. index:: auto_ReplaceTextFromNCFile .. _auto_replacetextfromncfile: auto_ReplaceTextFromNCFile ========================== .. us.tag auto_ReplaceTextFromNCFile ENGLISH :ref:`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 (:file:`.NC`) file. .. function:: nReplaced = auto_ReplaceTextFromNCFile(hPage, ssNCFileName) nReplaced = auto_ReplaceTextFromNCFile(hPage, ssNCFileName, bEdit) nReplaced = auto_ReplaceTextFromNCFile(hPage, ncid) nReplaced = auto_ReplaceTextFromNCFile(hPage, ncid, bEdit) .. us.return **Return Value** *nReplaced* is the number of replaced strings. If no text is replaced or an error occurs, the value 0 will be returned. .. us.params **Parameters** .. uparam:: hPage *hPage* is a page handle. *hPage* is the return value of :ref:`auto_LoadTemplate`. .. uparam:: ssNCFileName *ssNCFileName* is the complete netCDF file name. The function :ref:`auto_ImportData` returns the NC file name for the specified data file. .. uparam:: ncid *ncid* is the id of an open NC2 file. .. uparam:: 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). .. us.comment **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: :ref:`text-placeholder`. .. us.example **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(); } .. seealso:: :ref:`overview-automation`, :ref:`auto_ReplaceText`, :ref:`auto_ReplaceTextDialog`, :ref:`auto_ImportData` :sub:`id-424919`