Hi,
I want to calculate monthly mean daily variation. The files are splited every hour. When I use avg function, I have this error 'Number of subscripts do not match number of dimensions of variable,(1) Subscripts used, (2) Subscripts expected'.
Can anyone help me?Thanks.
The script and error are as below.
Best,
Guo
begin
fil0 = systemfunc("ls /d1/model/guoz/CTL/HRLDAS_MP/Run/Glees/200907*.LDASOUT_DOMAIN1")+".nc"
fil1 = systemfunc("ls /d1/model/guoz/BT/HRLDAS_MP/Run/Glees/200907*.LDASOUT_DOMAIN1")+".nc"
nfl = dimsizes(fil0)
S_CTL = new((/nfl,1/),float)
S_BT = new((/nfl,1/),float)
do ifl = 0,nfl-1
f = addfile(fil0(ifl),"r")
f1 = addfile(fil1(ifl),"r")
S_CTL = f->SSOIL(:,0,0)
S_BT = f1->SSOIL(:,0,0)
end do
; ListSetType (f,"cat")
print(dimsizes(fil0))
printVarSummary(S_CTL)
printVarSummary(S_BT)
nhour = 24
t=ispan(0,nhour-1,1)
m=new(nhour,float)
n=new(nhour,float)
; p=new(nhour,float)
do i=0,nhour-1
m(i)= avg(S_CTL(i::24))
n(i)= avg(S_BT(i::24))
; p(i)= avg(SOBS(i::24))
end do
print(m)
print(n)
Copyright (C) 1995-2009 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 5.1.0
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
(0) 744
Variable: S_CTL
Type: float
Total Size: 2976 bytes
744 values
Number of Dimensions: 2
Dimensions and sizes: [744] x [1]
Coordinates:
Number Of Attributes: 5
stagger : -
units : W m{-2}
description : Heat flux into the soil
MemoryOrder : XY
_FillValue : -999
Variable: S_BT
Type: float
Total Size: 2976 bytes
744 values
Number of Dimensions: 2
Dimensions and sizes: [744] x [1]
Coordinates:
Number Of Attributes: 5
stagger : -
units : W m{-2}
description : Heat flux into the soil
MemoryOrder : XY
_FillValue : -999
fatal:Number of subscripts do not match number of dimensions of variable,(1) Subscripts used, (2) Subscripts expected
fatal:Execute: Error occurred at or near line 30 in file 200907_H.ncl
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Feb 29 12:31:58 2012
This archive was generated by hypermail 2.1.8 : Mon Mar 05 2012 - 14:12:07 MST