[ncl-talk] Wonder if there is any printVarSummary() equivalent function in pynio

谢瑾博 xiejinbo at mail.iap.ac.cn
Fri Jun 21 19:17:15 MDT 2019


Hi Rick,
I am currently trying the following code.



import os

import Nio,Ngl

dirc="/T0/xjb/Analysis/GWD/"

f    = Nio.open_file(os.path.join(dirc,"USGS_gtopo30_cube1.5min_to_128x256_c190611_IAP-720dir.nc"))

terr = f.variables["terr"][:,:,:]

terr_sp=terr[:,84,40]



terr_sp is a processed slice of the terr, I wonder which way could be used to do the PrinVarSummary() in this case? In the pynio, the example showed is only on f.variables than on other variables such as terr_sp.
Jinbo


-----原始邮件-----
发件人:"Rick Brownrigg" <brownrig at ucar.edu>
发送时间:2019-06-21 09:40:12 (星期五)
收件人: "谢瑾博" <xiejinbo at mail.iap.ac.cn>
抄送: Ncl-talk <ncl-talk at ucar.edu>
主题: Re: Re: Re: [ncl-talk] Wonder if there is any printVarSummary() equivalent function in pynio


Well, I think you can use it in any fashion that you could use print/printVarSummary in NCL. I would invite a little experimentation to see if you are getting what you need.


Rick




On Thu, Jun 20, 2019 at 7:01 PM 谢瑾博 <xiejinbo at mail.iap.ac.cn> wrote:

Sory for a little digging in this issue. The print() variables, as stated in this website, shows that the print summary can be done once a data is read in and has a reference f. I wonder if this can be used after I used an array that gets the variable and maybe another that process the data again once getting the variables from f? In the old ncl, printVarSummary can basically be used anywhere and any array, not restricted to a reference variable in f. Can this work for Nio?
yours,
Jinbo


-----原始邮件-----
发件人:"Rick Brownrigg" <brownrig at ucar.edu>
发送时间:2019-06-20 23:40:59 (星期四)
收件人: "谢瑾博" <xiejinbo at mail.iap.ac.cn>
抄送: Ncl-talk <ncl-talk at ucar.edu>
主题: Re: Re: [ncl-talk] Wonder if there is any printVarSummary() equivalent function in pynio


Yes, print() works for variables too;  this is from the documentation


https://www.pyngl.ucar.edu/Nio.shtml
Print a summary of a variable in the file
print f.variables['varName']

Here is a sample print of the variable "elev":
Variable: elev
Type: float
Total Size: 259200 bytes
            64800 values
Number of Dimensions: 2
Dimensions and sizes:   [lat | 180] x [lon | 360]
Coordinates: 
            lat: [89.5..-89.5]
            lon: [0.5..359.5]
Number of Attributes: 3
         units :        meters
         long_name :    median topography
         _FillValue :   -99999




On Wed, Jun 19, 2019 at 12:32 PM 谢瑾博 <xiejinbo at mail.iap.ac.cn> wrote:

Hi Rick,
Does this work for variables inside the program? Because printVarSummary() tends to work anywhere in the program, and sometimes we may want to know the attributes after a certain processing.
yours,
Jinbo


-----原始邮件-----
发件人:"Rick Brownrigg" <brownrig at ucar.edu>
发送时间:2019-06-20 01:45:35 (星期四)
收件人: "谢瑾博" <xiejinbo at mail.iap.ac.cn>
抄送: Ncl-talk <ncl-talk at ucar.edu>
主题: Re: [ncl-talk] Wonder if there is any printVarSummary() equivalent function in pynio


Hi,


I believe if you just print() the variable you get back from Nio.open_file(), it behaves like printVarSummary()


Rick



On Wed, Jun 19, 2019 at 1:02 AM 谢瑾博 via ncl-talk <ncl-talk at ucar.edu> wrote:

Dear Users,
I wonder if there is any printVarSummary()  equivalent function in the pynio, this is a very handy function to print the attributes summary of the variables.
yours,
Jinbo
_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk


--

Dr. Jinbo Xie
State Key Laboratory of Numerical Modeling for Atmospheric Sciences and Geophysical Fluid Dynamics (LASG)
Institute of Atmospheric Physics,Chinese Academy of Sciences 
e-mail: xiejinbo at mail.iap.ac.cn
Tel:86-10-8299-5419(o)

--

Dr. Jinbo Xie
State Key Laboratory of Numerical Modeling for Atmospheric Sciences and Geophysical Fluid Dynamics (LASG)
Institute of Atmospheric Physics,Chinese Academy of Sciences 
e-mail: xiejinbo at mail.iap.ac.cn
Tel:86-10-8299-5419(o)

--

Dr. Jinbo Xie
State Key Laboratory of Numerical Modeling for Atmospheric Sciences and Geophysical Fluid Dynamics (LASG)
Institute of Atmospheric Physics,Chinese Academy of Sciences 
e-mail: xiejinbo at mail.iap.ac.cn
Tel:86-10-8299-5419(o)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190622/d90d6bf3/attachment.html>


More information about the ncl-talk mailing list