Re: error in reading a variable from netcdf file

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Thu, 08 Jun 2006 15:24:24 -0600

Hi Si-Wan,

Mike's suggestion about using ncrename was the first thing I thought of
as well. But, Dennis Shea has a faster way:

pm2 = a->$"PM2.5"$

The $ signs only operate on text strings, which is why you have to
enclose PM2.5 in "".. For those of you not familiar with the use of the
$, they allow you to pass a text string into a addfile read-in /
read-out operation:

var = "SLP"
slparr = a->$var$
b->$var$ = slparr

Adam

Si-Wan Kim wrote:
> Hello all,
>
> I am trying to read a variable whose name is "PM2.5" from a netcdf file.
> I can read any variables like o3, co, and no2 except PM2.5.
>
> If I try to read "PM2.5", it gives me an error message. Syntax error
> before or near .5.
> Below is the part of ncl script.
> a=
> addfile("/wrk/d1/swkim/wrf2dat/pert/wrfn3d_d01_2004-"+sdate(imon-1)+"-"+sdate(iday-1)+".nc","r")
>
> pm2 = a->PM2.5
>
> The dot in the variable may be the problem.
> Is there anybody who experienced this problem? How can I read this?
> I appreciate your help. Thanks.
>
> Si-Wan
> CIRES & NOAA/ESRL/CSD
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jun 08 2006 - 15:24:24 MDT

This archive was generated by hypermail 2.2.0 : Mon Jun 12 2006 - 06:59:42 MDT