<div dir="ltr"><div><div>Hi,<br><br></div>There must be more going on to this script than is shown. The printed output does not align with print statements in the script, and I don't believe an addfiles command works with ".txt" files. The error message is coming from asciiread(), which does not appear anywhere in the script you've shown. In any case, the error message is telling you that there is no variable names AOT_550 in the files. Are there other error messages from the script?<br><br></div><div>Rick<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 16, 2017 at 8:41 AM, <span dir="ltr"><<a href="mailto:najib.yusuf@carnasrda.com" target="_blank">najib.yusuf@carnasrda.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
-------- Original Message --------<br>
Subject: Deriving monthly mean from files of ten years data<br>
Date: 2017-06-16 10:00<br>
From: <a href="mailto:najib.yusuf@carnasrda.com">najib.yusuf@carnasrda.com</a><br>
To: <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
Cc: <a href="mailto:shea@ucar.edu">shea@ucar.edu</a><br>
<br>
Dear ncl experts,<br>
<br>
<br>
I am trying to derived monthly mean (for example all January, all<br>
February....all December) mean from 10 files (0-9) years of Julian date,<br>
so I can plot the mean on the bulk of the data. I tried but I got an<br>
error;<br>
<br>
<br>
<br>
<br>
; to derive the mean of the data<br>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;<br>
wkdir = "./"<br>
fil_dat = "AOT_550"<br>
; list all AOT files for different years<br>
files = systemfunc("ls " + wkdir +"AOT_550*.txt")<br>
print(files)<br>
<br>
; read years (files)<br>
files10 = files(0:9)<br>
print(files10)<br>
f = addfiles(files10, "r")<br>
AOT = addfiles_GetVar(f,files10,"<wbr>AOT_550")<br>
time = addfiles_GetVar(f,files10,"<wbr>time")<br>
<br>
; get date<br>
t1=calendar_decode2(time,0)<br>
; get day of year<br>
printVarSummary(t1)<br>
ndays = 365<br>
doy = ndays<br>
doy(9) = 365<br>
print(doy)<br>
<br>
; read only monthly mean (not sure?)<br>
AOT_550_all12 = AOT_550_all12(0:11)<br>
print(AOT_550_all12)<br>
<br>
f = addfiles(files12, "r")<br>
AOT = addfiles_GetVar(f,AOT_550_<wbr>all12,"AOT_550_all")<br>
time = addfiles_GetVar(f,AOT_550_<wbr>all12,"time")<br>
; get date<br>
t1=calendar_decode2(time,0)<br>
; get day of year<br>
printVarSummary(t1)<br>
doy=day_of_year(floattoint(t1(<wbr>:,0)),floattoint(t1(:,1)),<wbr>floattoint(t1(:,2)))<br>
; move to mid-months<br>
doy=doy-15<br>
doy(11:9) = 365 ;<br>
print(doy)<br>
AOT_550_all12 = AOT<br>
<br>
printVarSummary(AOT)<br>
<br>
Variable: variables<br>
Type: string<br>
Total Size: 56 bytes<br>
7 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [7]<br>
Coordinates:<br>
Number Of Attributes: 1<br>
_FillValue : missing<br>
(0) Day<br>
(1) AOT_675<br>
(2) AOT_500<br>
(3) AOT_440<br>
(4) 440-675Angstrom<br>
(5) ╬▒<br>
(6) AOT_550<br>
<br>
<br>
Variable: files (subsection)<br>
Type: string<br>
Total Size: 8 bytes<br>
1 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [1]<br>
Coordinates:<br>
(0) /home/model-user/AOT_550_2014.<wbr>txt<br>
warning:asciiread: End of file reached and only (157) elements were read<br>
from the file, filling remaining elements with the default missing value<br>
for the requested type<br>
<br>
Variable: z1<br>
Type: string<br>
Total Size: 2928 bytes<br>
366 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [366]<br>
Coordinates:<br>
Number Of Attributes: 1<br>
_FillValue : missing<br>
<br>
Variable: new_str<br>
Type: string<br>
Total Size: 20496 bytes<br>
2562 values<br>
Number of Dimensions: 2<br>
Dimensions and sizes: [366] x [7]<br>
Coordinates:<br>
Number Of Attributes: 1<br>
_FillValue : missing<br>
<br>
<br>
Variable: variables<br>
Type: string<br>
Total Size: 56 bytes<br>
7 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [7]<br>
Coordinates:<br>
Number Of Attributes: 1<br>
_FillValue : missing<br>
(0) Day<br>
(1) AOT_675<br>
(2) AOT_500<br>
(3) AOT_440<br>
(4) 440-675Angstrom<br>
(5) ╬▒<br>
(6) AOT_550<br>
<br>
Variable: AOT_550_all<br>
Type: float<br>
Total Size: 14600 bytes<br>
3650 values<br>
Number of Dimensions: 2<br>
Dimensions and sizes: [years | 10] x [days | 365]<br>
Coordinates:<br>
Number Of Attributes: 1<br>
_FillValue : 9.96921e+36<br>
<br>
<br>
Variable: files<br>
Type: string<br>
Total Size: 80 bytes<br>
10 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [10]<br>
Coordinates:<br>
(0) /home/model-user/AOT_550_2005.<wbr>txt<br>
(1) /home/model-user/AOT_550_2006.<wbr>txt<br>
(2) /home/model-user/AOT_550_2007.<wbr>txt<br>
(3) /home/model-user/AOT_550_2008.<wbr>txt<br>
(4) /home/model-user/AOT_550_2009.<wbr>txt<br>
(5) /home/model-user/AOT_550_2010.<wbr>txt<br>
(6) /home/model-user/AOT_550_2011.<wbr>txt<br>
(7) /home/model-user/AOT_550_2012.<wbr>txt<br>
(8) /home/model-user/AOT_550_2013.<wbr>txt<br>
(9) /home/model-user/AOT_550_2014.<wbr>txt<br>
<br>
<br>
Variable: files10<br>
Type: string<br>
Total Size: 80 bytes<br>
10 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [10]<br>
Coordinates:<br>
(0) /home/model-user/AOT_550_2005.<wbr>txt<br>
(1) /home/model-user/AOT_550_2006.<wbr>txt<br>
(2) /home/model-user/AOT_550_2007.<wbr>txt<br>
(3) /home/model-user/AOT_550_2008.<wbr>txt<br>
(4) /home/model-user/AOT_550_2009.<wbr>txt<br>
(5) /home/model-user/AOT_550_2010.<wbr>txt<br>
(6) /home/model-user/AOT_550_2011.<wbr>txt<br>
(7) /home/model-user/AOT_550_2012.<wbr>txt<br>
(8) /home/model-user/AOT_550_2013.<wbr>txt<br>
(9) /home/model-user/AOT_550_2014.<wbr>txt<br>
fatal:No valid instance of variable AOT_550 found in file list<br>
fatal:["Execute.c":8575]:<wbr>Execute: Error occurred at or near line 6095 in<br>
file<br>
/home/model-user/NCL/ncl-6.3.<wbr>0/lib/ncarg/nclscripts/csm/<wbr>contributed.ncl<br>
<br>
<br>
Please assist to put me through.<br>
<br>
Thank you for your time.<br>
<br>
<br>
Najib<br>
______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br></div>