In [3]:
#hideme
from IPython.core.display import Image
Image(filename='img/UV-CDAT_logo.png')
Out[3]:
Ultra-scale Visualization Climate Data Analysis Tools (UV-CDAT)
* Ubuntu, CentOS, RedHat & MacOS
GUI Intro / Demo
Exercise 2 : Opening a NetCDF file
In [ ]:
import cdms2
DATAPATH = './data/Obs/mo/sst/HadISST/'
# open the nc file throgh cdms2 module
f = cdms2.open(DATAPATH + 'sst_HadISST_Climatology_1961-1990.nc')
# You can query the file
print f.listvariables()
In [ ]:
# You can “access” the data through file variable
x = f['sst']
# You can get some information about the variables by
x.info()
In [ ]:
# or read all of it into memory
y = f('sst') # Causion : It will load the whole data into RAM memory
y.info()
In [ ]:
# You can also find out what class the object x or y belong to
print x.__class__
# Close the file
f.close() # do remeber we opened the nc file throgh 'f' file object
In [ ]:
%load scripts/demo_1.py
In [ ]:
a = raw_input("emne")
In [ ]:
import cdtime
In [ ]:
r = cdtime.reltime(19, "days since 2011-5-1")
r
In [ ]:
dir(r)
In [ ]:
c = cdtime.comptime(2011, 5, 20)
c
In [ ]:
dir(c)
In [ ]:
c1 = c.torel("days since 2011-1-1")
print "Comptime - ", c
print "Relative - ", c1
In [ ]:
r1 = r.tocomp()
print "Relative - ", r
print "Component - ", r1
In [4]:
#hideme
Image(filename='img/ma.png')
Out[4]:
In [5]:
#hideme
Image(filename='img/ma2.png')
Out[5]:
Arulalan.TDate : 17.02.2014 Project Associate, Centre for Atmospheic Sciences, Indian Institute of Technology Delhi, India. Blog : http://tuxcoder.wordpress.com Repo : https://github.com/arulalant/UV-CDAT-IPython-Notebooks