Inquiries about a file in CDAT
![]() |
![]() |
![]() | |
| Contents | Previous | Next |
Goal: Learn how to inquiry about a file in CDAT.
Here are some very useful inquiry commands that you can use to learn about the variables and their dimensions stored in a file.
# open example NetCDF file
import cdms, os, sys
filepath = os.path.join(sys.prefix, 'sample_data/clt.nc')
f = cdms.open( filepath )
# print the list of all variables in the file
f.listvariable()
['clt','u','v']
# or equivalent
f.listvariables()
f.showvariable()
# print a list of the dimensions in the file
f.listdimension()
['plev', 'latitude1', 'latitude2', 'time1', 'longitude1',
'longitude2', 'longitude', 'time', 'latitude', 'plev1', 'time2']
# print the file's defined global attributes
f.listglobal()
['center', 'comments', 'Conventions', 'model']
# print a list of the dims of variable 'u'
f.showdimension('u')
Dimension names of u in file /home/mccoy20/utils/cdat/sample_data/clt.nc:
['time1', 'plev', 'latitude1', 'longitude1']
![]() |
![]() |
![]() | |
| Contents | Previous | Next |


