Re: Variable input error: what am I doing wrong?

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed Oct 05 2011 - 15:45:43 MDT

Hi Gerry,
When you use 'addfiles' rather than 'addfile', you get a file list variable rather than a file variable. It requires a different syntax.
Try
model2Sst=model2[:]->t
and
Time = model2[:]->time

You can say 'model2[0]' in order to "reference a file".
 -dave

On Oct 5, 2011, at 3:09 PM, Gerald Creager wrote:

> I'm trying to assign values to a variable from a netcdf file (ncl_filedump output for the file is attached). A sample snippet of code is attached. Note the error... And, note that line 6 does, in fact load the data into 'model2'.
>
> ncl 30> model2Sst=model2->t
> fatal:(model2) does not reference a filencl 0> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> ncl 1> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ncl 2> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> ncl 3> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/calendar_decode2.ncl"
> ncl 4>
> ncl 5> fnameModel2=systemfunc ("ls fcast_20100*.nc") ; files location
> ncl 6> model2=addfiles(fnameModel2, "r")
> ncl 7> type="x11"
> ncl 8> Time=model2->time
> fatal:(model2) does not reference a file
> fatal:Execute: Error occurred at or near line 8
>
> fatal:Execute: Error occurred at or near line 30
>
> Thanks, Gerry
> -
> Gerry Creager -- gerry.creager@tamu.edu
> Texas Mesonet -- AATLT, Texas A&M University
> Cell: 979.229.5301 Office: 979.458.4020 FAX: 979.862.3983
> Office: 1700 Research Parkway Ste 160, TAMU, College Station, TX 77843
> <nclfiledump-model2.txt>_______________________________________________
> 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 Wed Oct 5 15:45:51 2011

This archive was generated by hypermail 2.1.8 : Sun Oct 09 2011 - 13:05:26 MDT