<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 = &quot;latitude_longitude&quot; ;<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 = &quot;time&quot; ;<br>        time:long_name = &quot;time&quot; ;<br>        time:units = &quot;days since 1966-10-03&quot; ;<br>        time:axis = &quot;T&quot; ;<br>        time:valid_range = 7, 17409 ;<br>        time:calendar = &quot;gregorian&quot; ;<br>    float snow_cover_threshold ;<br>        snow_cover_threshold:standard_name = &quot;surface_snow_area_fraction&quot; ;<br>        snow_cover_threshold:long_name = &quot;threshold for the snow_cover_extent measurement&quot; ;<br>        snow_cover_threshold:units = &quot;1&quot; ;<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 &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;<br>;*******************************************<br><br>;The intention is to average the sce for each year and for each month<br><br>a=addfile(&quot;~/Documents/Snow_cover_IMS/<a href="http://nhsce_v01r01_19661004_20140602.nc">nhsce_v01r01_19661004_20140602.nc</a>&quot;,&quot;r&quot;)<br><br>sce=a-&gt;snow_cover_extent(0,:,:)<br><br>t=a-&gt;time<br>asciiwrite(&quot;time.txt&quot;,t); saving time as a text file<br><br>;Reading in the same text file<br><br> time=asciiread(&quot;~/Documents/Snow_cover_IMS/NCL_codes/time.txt&quot;,-1,&quot;float&quot;)<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>