NCL Home > Documentation > Language

Variable Assignment

If a file variable has hyphens in the name (e.g., Data-Set-14), then a special technique is required to read in the variable because NCL treats hyphens as minus symbols:

    ncl> print(in->Data-Set-14) 
    fatal:Either file (in) isn't defined or variable (Data) is not a variable
    in the file
    fatal:Execute: Error occurred at or near line 24
To get around this problem, make the name of the variable a string, and enclose the string in "$"s:


    var_string = "Data-Set-14"