<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:΢ÈíÑźÚ
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi, Dennis,<br>Thanks a lot for your involvement. Yes, as Dave pointed out, both <br>getvardims(f) and getfiledimsizes(f) work fine. However, I'm seeking a function,<br>like , getfiledims(f,"Lat") , which will give me the number of the dimension "Lat" in the netcdf file.<br>This seems not available yet. <br> I hope I make my problem clear enough this time and sorry for any confusions in previous emails.<br>Best wishes,<br>Ting<br><br><div><hr id="stopSpelling">Date: Fri, 24 Apr 2015 15:01:52 -0600<br>Subject: Re: [ncl-talk] how to get the dimension size in netcdf file<br>From: shea@ucar.edu<br>To: leiting2002@hotmail.com<br>CC: dbrown@ucar.edu; abrammer@albany.edu; ncl-talk@ucar.edu<br><br><div dir="ltr">Is this what you want?<br><br>Remember 'f' (below) has a dual nature ... It is both a variable and a file reference<br><br> f = addfile("...","r")<br> <br><div> dNames= getvardims(f) <br> dSizes = getfiledimsizes(f) <br> print (dNames+" "+dSizes)<br><br></div></div><div class="ecxgmail_extra"><br><div class="ecxgmail_quote">On Fri, Apr 24, 2015 at 2:45 PM, LeiTing <span dir="ltr"><<a href="mailto:leiting2002@hotmail.com" target="_blank">leiting2002@hotmail.com</a>></span> wrote:<br><blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex;">
<div><div dir="ltr">Dave and Alan, <br>My apology for causing that misunderstanding.<br>Dave, you are right! I missed that function is aksing for a dim size of a variable. <br>In my case, those dimensions are only defined however not used for any variables, which are still significant. <br>Thanks again.<br>Best,<br>Ting<br><br><div>> Date: Fri, 24 Apr 2015 14:25:53 -0600<span><br>> Subject: Re: [ncl-talk] how to get the dimension size in netcdf file<br>> From: <a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a><br></span>> To: <a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a><br>> CC: <a href="mailto:leiting2002@hotmail.com" target="_blank">leiting2002@hotmail.com</a>; <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><div><div class="h5"><br>> <br>> getfilevardimsizes gets the sizes of the dimensions the apply to a<br>> specific variable. I thought the question was how to get the size of a<br>> dimension by name from the file without specifying a particular<br>> variable.<br>> -dave<br>> <br>> <br>> On Fri, Apr 24, 2015 at 12:53 PM, Alan Brammer <<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a>> wrote:<br>> > Isn't that functionality in this function?<br>> > <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/getfilevardimsizes.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Built-in/getfilevardimsizes.shtml</a><br>> ><br>> ><br>> > Alan.<br>> ><br>> > On 24 April 2015 at 14:36, David Brown <<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a>> wrote:<br>> >><br>> >> Well we would need to create another function to do that. We will<br>> >> consider it. Thanks for the suggestion.<br>> >> -dave<br>> >><br>> >> On Fri, Apr 24, 2015 at 12:32 PM, LeiTing <<a href="mailto:leiting2002@hotmail.com" target="_blank">leiting2002@hotmail.com</a>> wrote:<br>> >> > Dave,<br>> >> > Thank you so much. That is already the solution I need.<br>> >> > However, can NCL be "smarter" that ,say, I can directly ask for the size<br>> >> > of<br>> >> > a named dimension?<br>> >> > I know I can do it after using the function you pointed out, however,<br>> >> > I'm<br>> >> > just wondering if there are some tip that directly do it.<br>> >> > Thanks a lot.<br>> >> > Ting<br>> >> ><br>> >> >> Date: Fri, 24 Apr 2015 12:01:50 -0600<br>> >> >> Subject: Re: [ncl-talk] how to get the dimension size in netcdf file<br>> >> >> From: <a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a><br>> >> >> To: <a href="mailto:leiting2002@hotmail.com" target="_blank">leiting2002@hotmail.com</a><br>> >> >> CC: <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>> >> ><br>> >> >><br>> >> >> Hi Ting,<br>> >> >> getfiledimsizes is the function to use.<br>> >> >> See<br>> >> >><br>> >> >> <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/getfiledimsizes.shtml" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Built-in/getfiledimsizes.shtml</a><br>> >> >><br>> >> >> The example shows how to get the dimensions names along with the sizes.<br>> >> >> -dave<br>> >> >><br>> >> >><br>> >> >> On Fri, Apr 24, 2015 at 10:12 AM, LeiTing <<a href="mailto:leiting2002@hotmail.com" target="_blank">leiting2002@hotmail.com</a>><br>> >> >> wrote:<br>> >> >> > Dear Ncl folks,<br>> >> >> > I apologize first if this is a duplicated question though I haven't<br>> >> >> > found<br>> >> >> > it.<br>> >> >> > I have a netcdf file (the "sparse grid" by NSSL), with ncdump output<br>> >> >> > as<br>> >> >> > ^^^^^^^^^^^^<br>> >> >> > dimensions:<br>> >> >> > Lat = 236 ;<br>> >> >> > Lon = 355 ;<br>> >> >> > pixel = 12596 ;<br>> >> >> > variables:<br>> >> >> > float RefQC(pixel) ;<br>> >> >> > ..............................<br>> >> >> > VV<br>> >> >> ><br>> >> >> > I want to get the dimension lat and lon, which can 't be obtained by<br>> >> >> > ,say,<br>> >> >> > dimsize (RefQC).<br>> >> >> > They are also not global attributes.<br>> >> >> > Hence, I 'm lost on how to access those definitions of "lat" and<br>> >> >> > "lon"<br>> >> >> > in<br>> >> >> > the netcdf file.<br>> >> >> > Your help is appreciated.<br>> >> >> > Best wishes,<br>> >> >> > Ting<br>> >> >> ><br>> >> >> ><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>> >> _______________________________________________<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>> ><br></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></div>                                            </div></body>
</html>