>
> Hi,
>
> I'm dealing with a .cdf file from NOAA ftp(attached to this
> mail) which contain some
> variables. The names of variables are just like
> "Pac_ssta_coral.ssta","Pac_ssta_tree.ssta",
> and it seem that NCL can not work well with them. Another
> software,Grads, also can not
> work on these variables. And I think that it is caused by the
> variable names.
>
> Can NCl modify these variable names to some shorter ones? If
> not, Which software
> can do that in a simple way? Thanks!
>
>
> Lin
[Note: the original posting of this message didn't make it to
ncl-talk because there was too large of an attachment. However, I'm
sending the response back to the group so they can benefit.]
Hi Lin,
As you pointed out, NCL can't deal with the variable name
"Pac_ssta_tree.ssta", and this is because there's a period in the
name. Unfortunately, a period is one of those characters you can't
have in an NCL variable name, see:
http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml
However, there is a way around this when dealing with variable names
on a supported file. You can assign the name of the netCDF variable
to a NCL local variable, and then use a combination of the $...$
syntax and the local variable to retrieve the data:
a = addfile("data.cdf","r")
s = "Pac_ssta_tree.ssta"
x = a->$s$
You can also use this in conjunction with "getfilevarnames":
a = addfile("data.cdf","r")
vars = getfilevarnames()
nvars = dimsizes(vars)
do i=0,nvars-1
x = a->$s(i)$
...maybe do stuff with x...
delete(x)
end do
Cheers,
--Mary
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Dec 26 2006 - 15:23:54 MST
This archive was generated by hypermail 2.2.0 : Thu Dec 28 2006 - 09:40:18 MST