<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">A full ncl_filedump would be clearer.  </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Though maybe it&#39;s because you&#39;re blindly copying the global attributes.  </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">do i=0,dimsizes(global_attnames)-</span><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">1</span></div><div class="gmail_default"><font color="#000000">   print(&quot;Attribute &quot; + </font><span style="font-family:verdana,sans-serif">global_attnames</span><font color="#000000">(i) + &quot; = &quot; + fin@$</font><span style="font-family:verdana,sans-serif">global_attnames</span><font color="#000000">(i)$)  ;; check what you&#39;re copying over. </font><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">  if(global_attnames(i).eq.&quot;VAR&quot;) </div><div class="gmail_default"><span style="color:rgb(0,0,0);font-size:13px">    ncdf@$global_attnames(i)$  = 2   ;; Manually edit the global attribute you&#39;re concerned about. </span></div><div class="gmail_default"><font color="#000000">  else<br></font><span style="font-family:arial,sans-serif;color:rgb(0,0,0);font-size:13px">    ncdf@$global_attnames(i)$ = fin@$global_attnames(i)$ ;-- write globalattribute to new netcdf file</span><br style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;color:rgb(0,0,0);font-size:13px">  end if</span></div><div class="gmail_default"><span style="font-family:arial,sans-serif;color:rgb(0,0,0);font-size:13px">end do</span><br></div><div class="gmail_default"><br></div><div class="gmail_default"><font color="#000000">or  just after the loop reset the attribute to whatever you fancy. </font></div><div class="gmail_default"><span style="color:rgb(0,0,0);font-size:13px"><br></span></div><div class="gmail_default"><span style="color:rgb(0,0,0);font-size:13px">ncdf@VAR = 2</span><br></div><div class="gmail_default"><span style="font-family:arial,sans-serif;color:rgb(0,0,0);font-size:13px"><br></span></div><div class="gmail_default"><span style="font-family:arial,sans-serif;color:rgb(0,0,0);font-size:13px"><br></span></div><div class="gmail_default"><span style="font-family:arial,sans-serif;color:rgb(0,0,0);font-size:13px">Alan. </span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 17, 2015 at 6:43 PM, Luo, Chao <span dir="ltr">&lt;<a href="mailto:chao.luo@eas.gatech.edu" target="_blank">chao.luo@eas.gatech.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi, here is what I did.<br>
<br>
---------------------------<br>
<br>
begin<br>
<br>
fin = addfile(METCRO2D_148x112_20110701,&quot;r&quot;)<br>
ncdf      = addfile(<a href="http://out.nc" rel="noreferrer" target="_blank">out.nc</a>,&quot;c&quot;)<br>
<br>
<br>
global_attnames = getvaratts(fin) ;-- retrieve the global attributes from input file<br>
do i=0,dimsizes(global_attnames)-1<br>
ncdf@$global_attnames(i)$ = fin@$global_attnames(i)$ ;-- write globalattribute to new netcdf file<br>
end do<br>
<br>
names    = getfilevarnames(fin); extract all variable names<br>
<br>
;do i = 0, dimsizes(names)-1<br>
do i = 0, 1                 ; write out two variable<br>
ncdf-&gt;$names(i)$ = fin-&gt;$names(i)$<br>
end do<br>
<br>
end<br>
<br>
--------------------------<br>
<br>
But the dimensions of output netcdf file (<a href="http://out.nc" rel="noreferrer" target="_blank">out.nc</a>) still are:<br>
<br>
dimensions:<br>
        TSTEP = UNLIMITED ; // (25 currently)<br>
        DATE-TIME = 2 ;<br>
        LAY = 1 ;<br>
        VAR = 40 ;<br>
        ROW = 112 ;<br>
        COL = 148 ;<br>
<br>
The dimensions of output file should be:<br>
<br>
dimensions:<br>
        TSTEP = UNLIMITED ; // (25 currently)<br>
        DATE-TIME = 2 ;<br>
        LAY = 1 ;<br>
        VAR = 2 ;<br>
        ROW = 112 ;<br>
        COL = 148 ;<br>
<br>
I don&#39;t know how to change VAR = 40 to VAR = 2 in output file.<br>
<br>
Thanks very much,<br>
<br>
Chao<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
----- Original Message -----<br>
From: &quot;Dennis Shea&quot; &lt;<a href="mailto:shea@ucar.edu">shea@ucar.edu</a>&gt;<br>
To: &quot;Chao Luo&quot; &lt;<a href="mailto:chao.luo@eas.gatech.edu">chao.luo@eas.gatech.edu</a>&gt;<br>
Cc: &quot;ncl-talk Talk&quot; &lt;<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>&gt;<br>
Sent: Thursday, September 17, 2015 1:33:44 PM<br>
Subject: Re: [ncl-talk] netcdf TFLAG dimension<br>
<br>
The description provides no information that can be used to help<br>
diagnose the problem, Try again<br>
<br>
On Wed, Sep 16, 2015 at 1:29 PM, Luo, Chao &lt;<a href="mailto:chao.luo@eas.gatech.edu">chao.luo@eas.gatech.edu</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; I extracted couple variables from a netcdf file (with 40 variables) and<br>
&gt; write out to a new netcdf file with dimension and TFLAG information. But the<br>
&gt; new file&#39;s still has dimension: VAR =40, which is same as the original<br>
&gt; netcdf file. The VAR should be equal to 2 (VAR=2) in new netcdf file. I<br>
&gt; don&#39;t know how to change it by NCL.<br>
&gt; Very appreciate any help and suggestions.<br>
&gt;<br>
&gt; Chao<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; ncl-talk mailing list<br>
&gt; <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
&gt; List instructions, subscriber options, unsubscribe:<br>
&gt; <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
&gt;<br>
_______________________________________________<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/mailman/listinfo/ncl-talk</a><br>
</div></div></blockquote></div><br></div>