From: <js...@us...> - 2008-06-05 01:19:02
|
Revision: 5392 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5392&view=rev Author: jswhit Date: 2008-06-04 18:18:55 -0700 (Wed, 04 Jun 2008) Log Message: ----------- change num2date/date2num default behavior so it is same as matplotlib's. Modified Paths: -------------- trunk/toolkits/basemap/Changelog trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2008-06-04 19:11:39 UTC (rev 5391) +++ trunk/toolkits/basemap/Changelog 2008-06-05 01:18:55 UTC (rev 5392) @@ -1,3 +1,5 @@ + * change default behaviour of num2date and date2num to be + the same as matplotlib counterparts. version 0.99 (svn revision 5344) * fix to warpimage method for API change in matplotlib 0.98.0. * updated pyproj to 1.8.6. Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-06-04 19:11:39 UTC (rev 5391) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-06-05 01:18:55 UTC (rev 5392) @@ -3263,7 +3263,7 @@ f = pupynere._LocalFile(file,maskandscale) return f -def num2date(times,units,calendar='standard'): +def num2date(times,units='days since 0001-01-01 00:00:00',calendar='proleptic_gregorian'): """ Return datetime objects given numeric time values. The units of the numeric time values are described by the units argument @@ -3271,10 +3271,9 @@ UTC with no time-zone offset, even if the specified units contain a time-zone offset. - Like the matplotlib num2date function, except that it allows - for different units and calendars. Behaves the same if - units = 'days since 001-01-01 00:00:00' and - calendar = 'proleptic_gregorian'. + Default behavior is the same as the matplotlib num2date function + but the reference time and calendar can be changed via the + 'units' and 'calendar' keywords. Arguments: @@ -3282,8 +3281,8 @@ units - a string of the form '<time units> since <reference time>' describing the time units. <time units> can be days, hours, minutes - or seconds. <reference time> is the time origin. A valid choice - would be units='hours since 1800-01-01 00:00:00 -6:00'. + or seconds. <reference time> is the time origin. + Default is 'days since 0001-01-01 00:00:00'. calendar - describes the calendar used in the time calculations. All the values currently defined in the CF metadata convention @@ -3291,7 +3290,7 @@ Valid calendars 'standard', 'gregorian', 'proleptic_gregorian' 'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'. Default is 'standard'/'gregorian', which is a mixed - Julian/Gregorian calendar. + Julian/Gregorian calendar. Defalut 'proleptic_gregorian'. Returns a datetime instance, or an array of datetime instances. @@ -3306,7 +3305,7 @@ cdftime = netcdftime.utime(units,calendar=calendar) return cdftime.num2date(times) -def date2num(dates,units,calendar='standard'): +def date2num(dates,units='days since 0001-01-01 00:00:00',calendar='proleptic_gregorian'): """ Return numeric time values given datetime objects. The units of the numeric time values are described by the units argument @@ -3315,10 +3314,9 @@ time-zone offset in units, it will be applied to the returned numeric values. - Like the matplotlib date2num function, except that it allows - for different units and calendars. Behaves the same if - units = 'days since 0001-01-01 00:00:00' and - calendar = 'proleptic_gregorian'. + Default behavior is the same as the matplotlib date2num function + but the reference time and calendar can be changed via the + 'units' and 'calendar' keywords. Arguments: @@ -3327,8 +3325,8 @@ units - a string of the form '<time units> since <reference time>' describing the time units. <time units> can be days, hours, minutes - or seconds. <reference time> is the time origin. A valid choice - would be units='hours since 1800-01-01 00:00:00 -6:00'. + or seconds. <reference time> is the time origin. + Default is 'days since 0001-01-01 00:00:00'. calendar - describes the calendar used in the time calculations. All the values currently defined in the CF metadata convention @@ -3336,7 +3334,7 @@ Valid calendars 'standard', 'gregorian', 'proleptic_gregorian' 'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'. Default is 'standard'/'gregorian', which is a mixed - Julian/Gregorian calendar. + Julian/Gregorian calendar. Default 'proleptic_gregorian'. Returns a numeric time value, or an array of numeric time values. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |