<div dir="ltr">Thank you for informing me about CDO I did use and it worked out.<div>Best Regards</div><div>Ipshita</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 10, 2014 at 12:08 AM, Jatin Kala <span dir="ltr">&lt;<a href="mailto:jatin.kala.jk@gmail.com" target="_blank">jatin.kala.jk@gmail.com</a>&gt;</span> 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 &quot;for&quot; and &quot;end&quot; in
      NCL!<br>
      You should use &quot;do&quot; and &quot;end do&quot;<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.<div><div class="h5"><br>
      <br>
      <br>
      <br>
      <br>
      On 10/09/14 2:55 PM, Ipshita Majhi wrote:<br>
    </div></div></div>
    <blockquote type="cite"><div><div class="h5">
      <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" target="_blank">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>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><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></div><br></div>