RE: [ncl-talk] addfile trouble

From: Debasish Pai Mazumder <debasish_at_nyahnyahspammersnyahnyah>
Date: Sat, 10 Mar 2007 14:41:49 -0900

Dear Erik,

The dimensions of your variable SKINTEMP are time =1, south_north =89,
west_east=149.
When you read the variable you use

             st = a->SKINTEMP(1,:,:)

But in NCL dimension is starting from zero. So when you use 1 in place of
your time dimension , your program looks for second dimension of time but
you time is one dimensional. So you need to use st = a->SKINTEMP(0,:,:)
instead of what you use. I guess this is also true for your other variable
with one time dimension.

Thanks
Debasish

 -----Original Message-----
From: ncl-talk-bounces_at_ucar.edu [mailto:ncl-talk-bounces_at_ucar.edu] On Behalf
Of Erik Noble
Sent: Saturday, March 10, 2007 1:30 PM
To: ncl-talk_at_ucar.edu
Subject: addfile trouble

Hi NCL

I am simply trying to plot Reanalysis data over a certain regaion. I
am having trouble reading in the data.

I keep getting the error :
fatal:Subscript out of range, error in subscript #0

Why am I getting this error?
If my data file is described as follows:

netcdf met_em.d01.2005-08-28_12:00:00 {
dimensions:
         Time = UNLIMITED ; // (1 currently)
         DateStrLen = 19 ;
         west_east = 149 ;
         south_north = 89 ;
         num_metgrid_levels = 27 ;
         num_sm_levels = 4 ;
         num_st_levels = 4 ;
         south_north_stag = 90 ;
         west_east_stag = 150 ;
         z-dimension0012 = 12 ;
         z-dimension0016 = 16 ;
         z-dimension0024 = 24 ;

  float SKINTEMP(Time, south_north, west_east) ;
                 SKINTEMP:FieldType = 104 ;
                 SKINTEMP:MemoryOrder = "XY " ;
                 SKINTEMP:units = "K" ;
                 SKINTEMP:description = "Skin temperature (can use for
SST also)" ;
                 SKINTEMP:stagger = "M" ;
float PSFC(Time, south_north, west_east) ;
                 PSFC:FieldType = 104 ;
                 PSFC:MemoryOrder = "XY " ;
                 PSFC:units = "Pa" ;
                 PSFC:description = "Surface Pressure" ;
                 PSFC:stagger = "M" ;

and my NCL code up to the point where I read in the data is as
follows, why the error?

;---------------------------------------------------------------------------
-
; Begin plotting code
;---------------------------------------------------------------------------
-
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
;************************************************
begin
;************************************************
; read in netCDF file
;************************************************
   a = addfile("/ptmp/noble/WPS/met_em.d01.2005-08-28_12:00:00.nc","r")
;************************************************
; read in variables
;************************************************
   slp= a->PMSL(1,:,:)
   st = a->SKINTEMP(1,:,:)
   st =(st-273)*(9/5)+32 ;SkinTemp in F

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Mar 10 2007 - 16:41:49 MST

This archive was generated by hypermail 2.2.0 : Mon Mar 12 2007 - 11:26:34 MDT