<div dir="auto">Hey Enric, <div dir="auto">You can create an array with your desired time steps and then loop through that array: </div><div dir="auto"><br></div><div dir="auto">ihours = (/1, 5, 12, 30/)</div><div dir="auto">do i=0,dimsizes(ihours)-1</div><div dir="auto">... </div><div dir="auto">th2(ihours(i),...) </div><div dir="auto">end do</div><br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">Il 10 dic 2016 12:52 PM, &quot;Agud Pique, Enric&quot; &lt;<a href="mailto:eagud.q@ccma.cat">eagud.q@ccma.cat</a>&gt; ha scritto:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
The following code extract a variable from a wrfout file, modify the variable and save it again. This is for all the nTimes of the simulation. But, I would like to do it for only some hours of the simulation. How can I do it for exemple, for time 5,6,7,29, 30,31 if nTimes is for exemple 55?<br>
<br>
Thank you, best<br>
<br>
Enric<br>
<br>
#####Code#######<br>
<br>
begin<br>
<br>
f = addfile(met_name,&quot;rw&quot;)<br>
<br>
;<br>
; Extract variable<br>
th2 = f-&gt;TH2<br>
<br>
;<br>
; Determine dimensions of the th2 field<br>
;<br>
dims = dimsizes(th2)<br>
nTimes = dims(0)<br>
south_north = dims(1)<br>
west_east = dims(2)<br>
<br>
print(&quot;nTimes dimension: &quot;+nTimes)<br>
print(&quot;South-North dimension: &quot;+south_north)<br>
print(&quot;West-East dimension: &quot;+west_east)<br>
<br>
<br>
;<br>
; Modify the th2 as needed<br>
;<br>
iTime = 0<br>
do l=0, nTimes-1<br>
;do l=(/&quot;5&quot;,&quot;6&quot;,&quot;7&quot;,&quot;29&quot;,&quot;30&quot;,&quot;31&quot;<wbr>/)<br>
do j=0,south_north-1<br>
do i=0,west_east-1<br>
   th2(l,j,i) = th2(l,j,i) + 1  ; increase Th2+ 1<br>
end do<br>
end do<br>
end do<br>
;print(th2)<br>
<br>
f-&gt;TH2 = th2<br>
<br>
end<br>
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br></div></div>