Re: How to read a variable with "\(" in name?

From: Strada, Susanna <susanna.strada_at_nyahnyahspammersnyahnyah>
Date: Tue Mar 04 2014 - 05:26:59 MST

Thank you very much for your helpfulness, Wei and Dennis!

I changed "varname" as Wei suggested and it worked!
Now NCL reads the variable.

Many thanks!

Best regards,
Susanna

On Mar 3, 2014, at 7:03 PM, Wei Huang <huangwei@ucar.edu<mailto:huangwei@ucar.edu>> wrote:

Susanna,

Try change:

    varname = "cos\(SZA\)"
    cos_SZA = f->$varname$

to:

    varname = "cos(SZA)"
    cos_SZA = f->$varname$

You may try ncl_filedump first to check out the variable names in NCL.

Wei

huangwei@ucar.edu<mailto:huangwei@ucar.edu>
VETS/CISL
National Center for Atmospheric Research
P.O. Box 3000 (1850 Table Mesa Dr.)
Boulder, CO 80307-3000 USA
(303) 497-8924

On Mar 3, 2014, at 4:39 PM, "Strada, Susanna" <susanna.strada@yale.edu<mailto:susanna.strada@yale.edu>> wrote:

Dear all,

I'm trying to read from a NetCDF file a variable named "cos\(SZA\)".
I obtained the name from the header of the file; the variable refers to the cosine of the Solar Zenith Angle.

Using ncdump -v cos\(SZA\) and the Panoply software, I checked that the variable contains data and that these values are consistent (positive, lower than 1).

I tried using the $…$ syntax since I saw that you use this method for variable names that contain "-" symbols. (from the NCL-Talk Archives, message: "Re: Read variable with parenthesis in name?").

    varname = "cos\(SZA\)"
    cos_SZA = f->$varname$

Unfortunately, it didn't work for my case and I got the following error message (same as without the $…$ syntax):

fatal:["Execute.c":5900]:variable (cos\(SZA\)) is not in file (f)

Does anyone have a suggestion to figure out this issue?

Many thanks for your help!

Best,
Susanna
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Mar 4 05:27:18 2014

This archive was generated by hypermail 2.1.8 : Fri Mar 14 2014 - 15:08:52 MDT