<div dir="ltr"><div><div><div><div>"ListSet Type" could be used but the following may be easier.<br><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/ListSetType.shtml">https://www.ncl.ucar.edu/Document/Functions/Built-in/ListSetType.shtml</a><br>
<br></div><div>Also, your dats is type "short"<br><a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml">https://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml</a><br>
<br></div><div>========<br>Please see 'addfiles'<br><br><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml">https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml</a><br><br>
===<br> scrDir0 = "/d1/zhangg/prec/"<br></div> scrFile0= systemfunc("cd "+ scrDir0 +" ; ls TPCAS-CMFD_V0105_B-01_"+year+".nc"<br></div> print(srcFile0)<br><br></div> na = addfiles(srcDir0+srcFile0, "r")<br>
<strong> pp = short2flt( na[:}->prec(:,107,302))<br></strong></div><strong> printVarSummary(pp)<br></strong><div><div> <div><div><br> <br></div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Sat, Aug 2, 2014 at 10:35 AM, Yuqiang Zhang <span dir="ltr"><<a href="mailto:yuqiangzhang.thu@gmail.com" target="_blank">yuqiangzhang.thu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal"><span style="color:#1f497d">Hi,<u></u><u></u></span></p><p class="MsoNormal"><span style="color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal">
<span style="color:#1f497d">You can use this function “ListSetType” to read different dimensions data from multi files. <u></u><u></u></span></p><p class="MsoNormal"><span style="color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal">
<span style="color:#1f497d">Regards,<u></u><u></u></span></p><p class="MsoNormal"><span style="color:#1f497d">Yuqiang<u></u><u></u></span></p><p class="MsoNormal"><span style="color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal">
<b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:ncl-talk-bounces@ucar.edu" target="_blank">ncl-talk-bounces@ucar.edu</a> [mailto:<a href="mailto:ncl-talk-bounces@ucar.edu" target="_blank">ncl-talk-bounces@ucar.edu</a>] <b>On Behalf Of </b>guozfruit<br>
<b>Sent:</b> Saturday, August 02, 2014 11:38 AM<br><b>To:</b> NCL<br><b>Subject:</b> [ncl-talk] read separated files<u></u><u></u></span></p><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><div><div><p class="MsoNormal">
Hi all,<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I have 3-hr netcdf data in 12 separated files (ie for 12 months). I'm trying to extract one grid preciptation for the whole year. I have the problem about how to define one variable with different dimensions when I read data from different files. Could you please help me with it? Thanks.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">As below are the data info, and my script:<u></u><u></u></p></div><div><div><p class="MsoNormal">dimensions:<u></u><u></u></p></div><div><p class="MsoNormal">
lon = 700 ;<u></u><u></u></p></div><div><p class="MsoNormal">lat = 400 ;<u></u><u></u></p></div><div><p class="MsoNormal">time = UNLIMITED ;<u></u><u></u></p></div><div><div><p class="MsoNormal">short prec(time, lat, lon) ;<u></u><u></u></p>
</div><div><p class="MsoNormal"> prec:scale_factor = 0.002f ;<u></u><u></u></p></div><div><p class="MsoNormal"> prec:add_offset = 50.f ;<u></u><u></u></p></div><div><p class="MsoNormal"> prec:_Fill_Value = -32767s ;<u></u><u></u></p>
</div><div><p class="MsoNormal"> prec:missing_value = -32767s ;<u></u><u></u></p></div><div><p class="MsoNormal"> prec:units = "mm hr-1" ;<u></u><u></u></p></div><div><p class="MsoNormal"> prec:long_name = "Precipitation rate" ;<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div></div><div><p class="MsoNormal"><u></u> <u></u></p></div></div><div><p class="MsoNormal"> year = 2008<u></u><u></u></p></div><div><p class="MsoNormal"> mon = 12<u></u><u></u></p>
</div><div><p class="MsoNormal"> nhour = new(mon,integer)<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"> if(year .eq. 2008) then<u></u><u></u></p></div><div><p class="MsoNormal">
day_leap = (/31,29,31,30,31,30,31,31,30,31,30,31/)<u></u><u></u></p></div><div><p class="MsoNormal"> do i = 0,mon-1<u></u><u></u></p></div><div><p class="MsoNormal"> nhour(i) = day_leap(i)*8<u></u><u></u></p>
</div><div><p class="MsoNormal"> end do<u></u><u></u></p></div><div><p class="MsoNormal"> else<u></u><u></u></p></div><div><p class="MsoNormal"> day_nonleap = (/31,28,31,30,31,30,31,31,30,31,30,31/)<u></u><u></u></p>
</div><div><p class="MsoNormal"> do i = 0,mon-1<u></u><u></u></p></div><div><p class="MsoNormal"> nhour(i) = day_nonleap(i)*8<u></u><u></u></p></div><div><p class="MsoNormal"> end do<u></u><u></u></p></div><div><p class="MsoNormal">
end if<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><strong>pp = new((/12,nhour/),float)</strong><u></u><u></u></p></div><div><div><p class="MsoNormal">do imon = 1,12<u></u><u></u></p>
</div><div><p class="MsoNormal"> if(imon.lt.10) then<u></u><u></u></p></div><div><p class="MsoNormal"> mon3 = "0"+imon<u></u><u></u></p></div><div><p class="MsoNormal"> else<u></u><u></u></p></div>
<div><p class="MsoNormal"> mon3 = ""+imon<u></u><u></u></p></div><div><p class="MsoNormal"> end if<u></u><u></u></p></div><div><p class="MsoNormal"> scrDir0 = "/d1/zhangg/prec/"<u></u><u></u></p>
</div><div><p class="MsoNormal"> do ifl = 0,nhour(imon-1)-1<u></u><u></u></p></div><div><p class="MsoNormal"> na = addfile(scrDir0+"prec_ITPCAS-CMFD_V0105_B-01_"+year+mon3+".nc","r")<u></u><u></u></p>
</div><div><p class="MsoNormal"> <strong> pp(imon-1,ifl) = na->prec(:,107,302)</strong><u></u><u></u></p></div><div><p class="MsoNormal"> end do<u></u><u></u></p></div><div><p class="MsoNormal"> end do<u></u><u></u></p>
</div></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div></div><div><p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p></div><div><div><p class="MsoNormal">
X<u></u><u></u></p></div></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>