<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">You can do this in one line using CDO
tools:<br>
<a class="moz-txt-link-freetext" href="https://code.zmaw.de/projects/cdo">https://code.zmaw.de/projects/cdo</a><br>
<br>
cdo monmean input_file.nc outputfile.nc<br>
<br>
And with regards to your script, there is no "for" and "end" in
NCL!<br>
You should use "do" and "end do"<br>
<a class="moz-txt-link-freetext" href="http://www.ncl.ucar.edu/Document/Language/loops.shtml">http://www.ncl.ucar.edu/Document/Language/loops.shtml</a><br>
<br>
Please read the documentation.<br>
<br>
<br>
<br>
<br>
On 10/09/14 2:55 PM, Ipshita Majhi wrote:<br>
</div>
<blockquote
cite="mid:CA+ObMNCd2vi=jre4Zx1LVmX8Mre3sf_s6SBpQzx3cN2Maf0Oaw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>Dear NCL<br>
<br>
</div>
How can I convert a weekly data to monthly and the
time of the data is in georgian form:-<br>
</div>
Here are the global attributes for it<br>
<br>
netcdf nhsce_v01r01_19661004_20140602 {<br>
dimensions:<br>
cols = 88 ;<br>
rows = 88 ;<br>
time = UNLIMITED ; // (2487 currently)<br>
variables:<br>
char coord_system ;<br>
coord_system:grid_mapping_name =
"latitude_longitude" ;<br>
coord_system:longitude_of_central_meridian = 0.
;<br>
coord_system:semimajor_axis = 6378137 ;<br>
coord_system:semiminor_axis = 6356752.3 ;<br>
int time(time) ;<br>
time:standard_name = "time" ;<br>
time:long_name = "time" ;<br>
time:units = "days since 1966-10-03" ;<br>
time:axis = "T" ;<br>
time:valid_range = 7, 17409 ;<br>
time:calendar = "gregorian" ;<br>
float snow_cover_threshold ;<br>
snow_cover_threshold:standard_name =
"surface_snow_area_fraction" ;<br>
snow_cover_threshold:long_name = "threshold for
the snow_cover_extent measurement" ;<br>
snow_cover_threshold:units = "1" ;<br>
<br>
***********************************************************************<br>
</div>
<br>
</div>
Here is my code and one of the fatal error is that i is
undefined<br>
<br>
; This program is to calculate the area average for snow for
all the data period<br>
;*******************************************<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
;*******************************************<br>
<br>
;The intention is to average the sce for each year and for
each month<br>
<br>
a=addfile("~/Documents/Snow_cover_IMS/<a
moz-do-not-send="true"
href="http://nhsce_v01r01_19661004_20140602.nc">nhsce_v01r01_19661004_20140602.nc</a>","r")<br>
<br>
sce=a->snow_cover_extent(0,:,:)<br>
<br>
t=a->time<br>
asciiwrite("time.txt",t); saving time as a text file<br>
<br>
;Reading in the same text file<br>
<br>
time=asciiread("~/Documents/Snow_cover_IMS/NCL_codes/time.txt",-1,"float")<br>
<br>
jan=new((/47,2/); I want the data to go from 1966 to 2012
with one column with year information and other with data
from sce<br>
feb=new((/47,2/);<br>
mar=new((/47,2/);<br>
apr=new((/47,2/); <br>
may=new((/47,2/);<br>
june=new((/47,2/);<br>
july=new((/47,2/);<br>
aug=new((/47,2/);<br>
sept=new((/47,2/);<br>
oct=new((/47,2/);<br>
nov=new((/47,2/);<br>
dec=new((/47,2/);<br>
<br>
x = ispan (1,10,1) <br>
years=ispan(1966,2012,1)<br>
month=ispan(1,12,1)<br>
<br>
for i=0,dimsizes(time)-1,7; since I saved time as a text
file and the date appears in a horizontal manner I am
attaching the txt file <br>
;better clarity <br>
t(nyr)==year(i)<br>
if time(nyr+1)==1<br>
jan(i)=(year(i),sce(i,:,:))<br>
else if time(nyr+1)==2<br>
feb(i)=(year(i),sce(i,:,:))<br>
else if time(nyr+1)==3<br>
mar(i)=(year(i),sce(i,:,:))<br>
else if time(nyr+1)==4<br>
apr(i)=(year(i),sce(i,:,:))<br>
else if time(nyr+1)==5<br>
may(i)=(year(i),sce(i,:,:))<br>
else if time(nyr+1)==6<br>
june(i)=(year(i),sce(i,;,:))<br>
else if time(nyr+1)==7<br>
july(i)=(year(i),sce(i,:,:))<br>
else if time(nyr+1)==8<br>
aug(i)=(year(i),sce(i,:,:))<br>
else if time(nyr+1)==9<br>
sept(i)=(year(i),sce(i,:,:))<br>
else if time(nyr+1)==10<br>
oct(i)=(year(i),sce(i,:,:))<br>
else if time(nyr+1)==10<br>
nov(i)=(year(i),sce(i,:,:))<br>
else<br>
dec(i)=(year(i),sce(i,:,:))<br>
i=i+1<br>
end<br>
<br>
</div>
what is missing in the code!<br>
<br>
</div>
I would be grateful for any guidance<br>
<br>
Best Regards<br>
Ipshita<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
<a class="moz-txt-link-freetext" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a>
</pre>
</blockquote>
<br>
</body>
</html>