Re: NCL Errors

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri, 4 Jan 2008 10:04:55 -0700 (MST)

On Fri, 4 Jan 2008, Asher, Vinit N wrote:

> Hi users,
>
> I have been consistently getting the following error in my NCL scripts for implementing vectors and streamlines.
>
> either the variable f isnt defined or the variable U is not a variable in the file.
>
> Even while trying the same NCL code as present on the website examples I got the same error. Kindly help.
>
> Vinit Asher.

Hi Vinit,

When you get error:

   either the variable f isn't defined or the variable U is not a
   variable in the file.

there could be one of two things happening. First, "f" must be a
variable that's pointing to a file opened by "addfile" (or "addfiles",
but I'm not going into that here). Secondly, "U" must be a variable on
the file opened with "addfile".

For example, if you do:

     f = addfile("afile.nc","r")
     u = f->U

you are opening the netCDF file "afile.nc" and trying to pull off a
variable called "U". If "U" is not a variable on the file, then you
will get the above error message.

To check what variables are on the file, add the following
to your NCL script after the "addfile" command:

    print(f)

This will print some header information, plus information about all
the variables on the file, including their names.

Another thing you can do:

   varnames = getfilevarnames(f)
   print(varnames)

This will retrieve the names of all the variables on the file and
then print them out.

You don't even need to get into NCL to do the above. If you just want
to see what's on a file supported by NCL, you can use "ncl_filedump":

    ncl_filedump afile.nc

The above command will give you output similar to the "print(f)" command
above.

--Mary
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jan 04 2008 - 10:04:55 MST

This archive was generated by hypermail 2.2.0 : Mon Jan 07 2008 - 11:19:46 MST