示例#1
0
## dates of interest: (year, month, day, hour)
## should be have #hrs as a multiple of 24
date1 = D.DateTime(2001, 6, 1)
date2 = D.DateTime(2001, 6, 4, 23)

## output files
oFile1 = "var_aver.nc"

## variable of interest
varName = "o3"

##------------------------------------------------------------##

## scan the files from the search string for date range
## returns an iofilescan object
fs = ioT.scan(searchStr, date1, date2)

## print some diagnostics
print fs

## Extract the variable
print "Extracting %s ..." % varName
var = fs(varName)

## To average over time, you need to setup
## the time axis' bounds
cdutil.setTimeBoundsDaily(var.getTime(), frequency=24)

## average over the 0th axis, ie. time
var_average = ioT.binAverager(var, 0)
示例#2
0
文件: scan_var.py 项目: AZed/uvcdat
## dates of interest: (year, month, day, hour)
date1 = D.DateTime(2001,6,1,6)
date2 = D.DateTime(2001,6,4,18)

## output files
oFile1 = "var_multiday.nc"

## variable of interest
varName = "o3"

##------------------------------------------------------------##


## scan the files from the search string for date range
## returns an iofilescan object
fs = ioT.scan(searchStr, date1, date2)

## print some diagnostics
print fs

## Extract the variable
print "Extracting %s ..." %varName
var = fs(varName)

## write to a file
g = ioT.open(oFile1, "w")
g.write(var)
g.close()

## close iofilescan object
fs.close()