Thank you I will do the needful<span></span><br><br>On Wednesday, September 10, 2014, Jatin Kala <<a href="mailto:jatin.kala.jk@gmail.com">jatin.kala.jk@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>You can do this in one line using CDO
tools:<br>
<a href="https://code.zmaw.de/projects/cdo" target="_blank">https://code.zmaw.de/projects/cdo</a><br>
<br>
cdo monmean <a href="http://input_file.nc" target="_blank">input_file.nc</a> <a href="http://outputfile.nc" target="_blank">outputfile.nc</a><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 href="http://www.ncl.ucar.edu/Document/Language/loops.shtml" target="_blank">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 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 href="http://nhsce_v01r01_19661004_20140602.nc" target="_blank">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></fieldset>
<br>
<pre>_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a>
</pre>
</blockquote>
<br>
</div>
</blockquote>