Re: variable with zero elements

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Oct 18 2013 - 10:26:50 MDT

Hi Prince,

Did you try doing an ncdump -h on the file? This is the Unidata tool that behaves similarly to "ncl_filedump".

Or, you can try one of the "getfilevarxxx" functions in NCL, like "getfilevardimsizes":

a = addfile("wrfoutxxxx.nc","r")
print(getfilevardimsizes(a,"XLAT"))
print(getfilevardimsizes(a,"XLONG"))
print(getfilevardimsizes(a,"T2"))

You can also just print the dimensions on the file:

print(getfiledimsizes(a))

http://www.ncl.ucar.edu/Document/Functions/Built-in/getfiledimsizes.shtml
http://www.ncl.ucar.edu/Document/Functions/Built-in/getfilevardimsizes.shtml

It's possible that NCL is not dealing with this file very gracefully, if it was written improperly. For example, if somebody failed to define the dimension sizes on the file correctly, I'm not sure how NCL would deal with this.

Can you provide us with the file?

http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP

--Mary

On Oct 18, 2013, at 3:09 AM, Prince K XAVIER <prince.xavier@gmail.com> wrote:

> Hi NCL-talk,
>
> I encountered a very strange problem when writing an NCL script to read a WRF output file.
> Basically this wrfout file has not been written properly and I fail to read the XLAT/XLONG/T2 information.
> When I ncl_filedump, it correctly shows “ Dimensions and sizes [Time | XXX] x [south_north | XXX] x [west_east | XXX]”.
> But when we do a lat = f-> XLAT and print(lat), it shows the correct dimensions, but with no elements in the array.
>
> Is there a way to check whether a variable in a file has valid elements?
>
> Thanks,
> Prince
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Oct 18 10:27:00 2013

This archive was generated by hypermail 2.1.8 : Tue Oct 22 2013 - 10:35:27 MDT