Erik,
The problem is in the array constructor (/ ... /), not the "new" 
function.  nt is a scalar, LAT and LON are 1-D arrays.  Therefore 
NCL can't make sense out of (/nt,LAT,LON/).  Try this (untested):
nlats = dimsizes (LAT)
nlons = dimsizes (LON)
daily_arr = new((/nt,nlats,nlons/),float)
Dave Allured
CU/CIRES Climate Diagnostics Center (CDC)
http://cires.colorado.edu/science/centers/cdc/
NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
http://www.cdc.noaa.gov/psd1/
Erik Noble wrote:
> Hi. 
> Could I have help understanding why this error is occurring when 
> creating an array in NCL?
> When I create the array with numbers, I have no problem:
> ncl 17> daily_arr = new((/29,15,21/),float)   
> ncl 18> 
> 
> Yet, when I try to use scripting, I get an error:
> ncl 23> daily_arr = new((/nt,LAT,LAN/),float)                           
>               
> fatal:_NclBuildArray: each element of a literal array must have the same 
> dimension sizes, at least one item doesn't
> 
> Also, where is this error described in the NCL docs?
> Thank you for your time ahead of time.
> Sincerely,
> Erik
> 
> bash-3.1$ ncl
>  Copyright (C) 1995-2007 - All Rights Reserved
>  University Corporation for Atmospheric Research
>  NCAR Command Language Version 5.0.0
>  The use of this software is governed by a License Agreement.
>  See http://www.ncl.ucar.edu/ for more details.
> ncl 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> a = 
> addfile("Daily_Region_2_WRF-GFS_SEP_1st-24-hours-forecasts-00Z.nc","r")
> ncl 4> lat2d = a->XLAT(0,0,:,:)                          ; WRF_grid lats
> ncl 5> lon2d = a->XLONG(0,0,:,:)                         ; WRF_grid lons
> ncl 6> rainnc = a->RAINNC  ; Total Grid Scale Precipitation
> ncl 7> rainc = a->RAINC   ; Accumulated Total Cumulus Precipitation
> ncl 8> times=a->Times
> ncl 9> 
> ncl 10> nt = times(:,0,0)    ; should be 29 days
> ncl 11> ;nt = 29  
> ncl 12> printVarSummary(nt)
> 
> 
> Variable: nt
> Type: character
> Total Size: 29 bytes
>             29 values
> Number of Dimensions: 1
> Dimensions and sizes:   [record | 29]
> Coordinates: 
> Number Of Attributes: 0
> ncl 13> LAT   = lat2d(:,0)
> ncl 14> LON   = lon2d(0,:)
> ncl 15> printVarSummary(LAT)
> 
> 
> Variable: LAT
> Type: float
> Total Size: 60 bytes
>             15 values
> Number of Dimensions: 1
> Dimensions and sizes:   [south_north | 15]
> Coordinates: 
> Number Of Attributes: 5
>   stagger :     
>   units :       degree_north
>   description : LATITUDE, SOUTH IS NEGATIVE
>   MemoryOrder : XY 
>   FieldType :   104
> ncl 16> printVarSummary(LON) 
> 
> 
> Variable: LON
> Type: float
> Total Size: 84 bytes
>             21 values
> Number of Dimensions: 1
> Dimensions and sizes:   [west_east | 21]
> Coordinates: 
> Number Of Attributes: 5
>   stagger :     
>   units :       degree_east
>   description : LONGITUDE, WEST IS NEGATIVE
>   MemoryOrder : XY 
>   FieldType :   104
> ncl 17> daily_arr = new((/29,15,21/),float)   
> ncl 18> printVarSummary(daily_arr)
> 
> 
> Variable: daily_arr
> Type: float
> Total Size: 36540 bytes
>             9135 values
> Number of Dimensions: 3
> Dimensions and sizes:   [29] x [15] x [21]
> Coordinates: 
> Number Of Attributes: 1
>   _FillValue :  -999
> ncl 19> delete(daily_arr)
> ncl 20> daily_arr = new((/29,LAT,LON/),float)
> fatal:_NclBuildArray: each element of a literal array must have the same 
> dimension sizes, at least one item doesn't
> fatal:Execute: Error occurred at or near line 20
> 
> ncl 21> delete(daily_arr)                     
> fatal:Variable (daily_arr) is undefined
> fatal:Execute: Error occurred at or near line 21
> 
> ncl 22> daily_arr = new((/nt,dimsizes(LAT),dimsizes(LON)/),float)
> fatal:_NclBuildArray: each element of a literal array must have the same 
> dimension sizes, at least one item doesn't
> fatal:Execute: Error occurred at or near line 22
>                                       
> ncl 23> daily_arr = new((/nt,LAT,LAN/),float)                           
>               
> fatal:_NclBuildArray: each element of a literal array must have the same 
> dimension sizes, at least one item doesn't
> fatal:Execute: Error occurred at or near line 23
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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 Mon Feb 09 2009 - 13:50:56 MST
This archive was generated by hypermail 2.2.0 : Thu Feb 12 2009 - 10:16:44 MST