<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Try the script below.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Wei</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">----------</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style><div class="gmail_default" style><font face="verdana, sans-serif"> fn = "your-wrf-file-to-be-splited"</font></div><div class="gmail_default" style><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style><font face="verdana, sans-serif"> f = addfile(fn, "r")</font></div><div class="gmail_default" style><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style><font face="verdana, sans-serif"> times = f->Times</font></div><div class="gmail_default" style><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style><font face="verdana, sans-serif"> ntimes = dimsizes(times)</font></div><div class="gmail_default" style><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style><font face="verdana, sans-serif"> print("dimsizes(times)=" + dimsizes(times))</font></div><div class="gmail_default" style><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style><font face="verdana, sans-serif">;------------------------------------------------------------</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> fvarnames = getfilevarnames(f)</font></div><div class="gmail_default" style><font face="verdana, sans-serif">;print(fvarnames)</font></div><div class="gmail_default" style><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style><font face="verdana, sans-serif"> fattnames = getvaratts(f)</font></div><div class="gmail_default" style><font face="verdana, sans-serif">;print(fattnames)</font></div><div class="gmail_default" style><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style><font face="verdana, sans-serif"> fAtt = True ; assign file attributes</font></div><div class="gmail_default" style><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style><font face="verdana, sans-serif"> do n = 0, dimsizes(fattnames) - 1</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> fAtt@$fattnames(n)$ = f@$fattnames(n)$</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> end do</font></div><div class="gmail_default" style><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style><font face="verdana, sans-serif"> do i = 0, ntimes(0) - 1</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> fon = fi + "_part_" + i + ".nc"</font></div><div class="gmail_default" style><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style><font face="verdana, sans-serif"> system("/bin/rm -f " + fon)</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> fo = addfile(fon, "c")</font></div><div class="gmail_default" style><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style><font face="verdana, sans-serif"> fileattdef(fo, fAtt)</font></div><div class="gmail_default" style><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style><font face="verdana, sans-serif"> do n = 0, dimsizes(fvarnames) - 1</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> vn = str_sub_str(fvarnames(n), "/", "")</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> vdims := getfilevardims(f, vn)</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> nvdims := dimsizes(vdims)</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> print("Processing var " + n + ": <" + vn + ">, nvdims = " + nvdims)</font></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style><div class="gmail_default" style><font face="verdana, sans-serif"> if(nvdims .eq. 1) then</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> v := f->$vn$(i:i)</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> end if</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> if(nvdims .eq. 2) then</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> v := f->$vn$(i:i, :)</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> end if</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> if(nvdims .eq. 3) then</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> v := f->$vn$(i:i, :, :)</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> end if</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> if(nvdims .eq. 4) then</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> v := f->$vn$(i:i, :, :, :)</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> end if</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> if(nvdims .eq. 5) then</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> v := f->$vn$(i:i, :, :, :, :)</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> end if</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> fo->$vn$ = v</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> end do</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> end do</font></div><div class="gmail_default" style><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style><font face="verdana, sans-serif"> delete(fAtt)</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> delete(fvarnames)</font></div><div class="gmail_default" style><font face="verdana, sans-serif"> delete(fattnames)</font></div><div style="font-family:verdana,sans-serif"><br></div></div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><font face="tahoma, sans-serif">================================================</font><div><font face="tahoma, sans-serif">1850 Table Mesa Dr.</font></div><div><font face="tahoma, sans-serif">Boulder, CO 80307</font></div><div><font face="tahoma, sans-serif">Phone: 303-497-8924</font></div></div></div></div>
<br><div class="gmail_quote">On Sat, Apr 18, 2015 at 8:51 AM, Muhammad Omer Mughal <span dir="ltr"><<a href="mailto:m.mughal1@postgrad.curtin.edu.au" target="_blank">m.mughal1@postgrad.curtin.edu.au</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi All </p>
<p><br>
</p>
<p>I tried to split the wrf out file using the following script.</p>
<p><br>
</p>
<p>#!/bin/bash <br>
<br>
n=136<br>
<br>
for ((i=1; i<=n; i++)){<br>
ncks -O -d Time,$i wrfout_d01_2009-07-08_00:00:<a href="http://00.nc" target="_blank">00.nc</a> $<a href="http://i.nc" target="_blank">i.nc</a><br>
}<br>
</p>
<div>
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<div style="font-family:Tahoma;font-size:13px"><br>
<div style="font-family:Tahoma;font-size:13px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">I am now trying to rename the file similar to wrfout_d01_2009-07-08_00:00:<a href="http://00.nc" target="_blank">00.nc</a> .I am now trying to renam all the files such that
I am able to update date and hour in the wrf output file format.I am using the following for it.<br>
<br>
foreach file('ls *.nc')<br>
? ncra -n 136,5,3 wrfout_d01_2009-07-0*.nc wrfout_d01_2009-07-08_00:00:<a href="http://00.nc" target="_blank">00.nc</a><br>
? end<br>
but this is'nt working .I also wrote the attached ncl script and tried to link that to csh but that also didn't worked . I would appreciate if some one can help me urgently.<br>
<br>
<br>
</span></div>
<div style="color:rgb(33,33,33);font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font face="Times New Roman,serif" size="3"><span style="font-size:12pt"><font face="Arial Bold" size="2" color="#1F497D"><span style="font-size:11pt">Muhammad Omer Mughal</span></font></span></font></div>
<div style="color:rgb(33,33,33);font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font face="Times New Roman,serif" size="3"><span style="font-size:12pt"><font face="Arial Bold" size="2" color="#1F497D"><span style="font-size:11pt">MSc BSc Mechanical Engineering</span></font><font face="Arial,sans-serif" size="1" color="#1F497D"><span style="font-size:8pt"><br>
</span></font><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt">PhD Research Scholar</span></font></span></font></div>
<div style="color:rgb(33,33,33);font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font face="Times New Roman,serif" size="3"><span style="font-size:12pt"><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt">Remote Sensing and Satellite Research Group</span></font></span></font></div>
<div style="color:rgb(33,33,33);font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font face="Times New Roman,serif" size="3"><span style="font-size:12pt"><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt">Department of Imaging and Applied Physics</span></font><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt"><br>
Curtin University</span></font><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt"><br>
</span></font><font face="Calibri,sans-serif" size="2" color="#1F497D"><span style="font-size:11pt"><br>
</span></font><font face="Arial Bold" size="2" color="#1F497D"><span style="font-size:9pt">Curtin University</span></font><font face="Arial Bold" size="2" color="#1F497D"><span style="font-size:9pt"><br>
</span></font><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt">Tel |</span></font><font face="Arial Bold" size="2" color="#1F497D"><span style="font-size:9pt"> </span></font><font face="Arial,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt">+61
8 9266 7962</span></font><font face="Calibri,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt"> </span></font><font face="Calibri,sans-serif" size="1" color="#1F497D"><span style="font-size:7pt"><br>
</span></font><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt">Fax |</span></font><font face="Arial Bold" size="2" color="#1F497D"><span style="font-size:9pt"> </span></font><font face="Arial,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt">+61
8 9266 2377</span></font><font face="Arial,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt"><br>
</span></font><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt">Mobile |</span></font><font face="Calibri,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt"> </span></font><font face="Arial,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt">0470 237 525</span></font></span></font></div>
</div>
</div>
</div>
</div>
</div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>