-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
criteriaargclim was messing up criteriaarg and useless commented out, probably should take all code out, but in case of 'custom' criteria func it might be usefull so letting it in
- Loading branch information
1 parent
45d9879
commit 4386f6a
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import cdms2 | ||
import numpy | ||
|
||
data = [1,]*12+[2,]*12 | ||
|
||
print data | ||
|
||
months = range(24) | ||
|
||
t=cdms2.createAxis(months) | ||
t.designateTime() | ||
t.units="months since 2014" | ||
|
||
import cdutil | ||
|
||
cdutil.setTimeBoundsMonthly(t) | ||
import MV2,numpy | ||
data = numpy.array(data) | ||
data=MV2.array(data) | ||
data.setAxis(0,t) | ||
print t.asComponentTime() | ||
djf = cdutil.times.DJF(data) | ||
djfc = cdutil.times.DJF.climatology(data) | ||
print djf | ||
assert(numpy.allclose(djf[0],1.) and numpy.allclose(djf[1],1.6666667) and numpy.allclose(djf[2],2.)) | ||
print djfc | ||
assert(numpy.allclose(djfc,1.625)) | ||
djf = cdutil.times.DJF(data,criteriaarg=[.5,None]) | ||
djfc = cdutil.times.DJF.climatology(data,criteriaarg=[.5,None]) | ||
|
||
print djf | ||
assert(numpy.ma.allclose(djf[0],1.) and numpy.ma.allclose(djf[1],1.6666667) and numpy.ma.allclose(djf[2],numpy.ma.masked)) | ||
print djfc | ||
assert(numpy.allclose(djfc,1.4)) |