202202UTC = datetime .timezone .utc
203203
204204
205+ @_api .caching_module_getattr
206+ class __getattr__ :
207+ JULIAN_OFFSET = _api .deprecated ("3.7" )(property (lambda self : 1721424.5 ))
208+ # Julian date at 0000-12-31
209+ # note that the Julian day epoch is achievable w/
210+ # np.datetime64('-4713-11-24T12:00:00'); datetime64 is proleptic
211+ # Gregorian and BC has a one-year offset. So
212+ # np.datetime64('0000-12-31') - np.datetime64('-4713-11-24T12:00') =
213+ # 1721424.5
214+ # Ref: https://en.wikipedia.org/wiki/Julian_day
215+
216+
205217def _get_tzinfo (tz = None ):
206218 """
207219 Generate tzinfo from a string or return tzinfo. If None,
@@ -225,12 +237,6 @@ def _get_tzinfo(tz=None):
225237# Time-related constants.
226238EPOCH_OFFSET = float (datetime .datetime (1970 , 1 , 1 ).toordinal ())
227239# EPOCH_OFFSET is not used by matplotlib
228- JULIAN_OFFSET = 1721424.5 # Julian date at 0000-12-31
229- # note that the Julian day epoch is achievable w/
230- # np.datetime64('-4713-11-24T12:00:00'); datetime64 is proleptic
231- # Gregorian and BC has a one-year offset. So
232- # np.datetime64('0000-12-31') - np.datetime64('-4713-11-24T12:00') = 1721424.5
233- # Ref: https://en.wikipedia.org/wiki/Julian_day
234240MICROSECONDLY = SECONDLY + 1
235241HOURS_PER_DAY = 24.
236242MIN_PER_HOUR = 60.
@@ -457,6 +463,7 @@ def date2num(d):
457463 return d if iterable else d [0 ]
458464
459465
466+ @_api .deprecated ("3.7" )
460467def julian2num (j ):
461468 """
462469 Convert a Julian date (or sequence) to a Matplotlib date (or sequence).
@@ -476,10 +483,11 @@ def julian2num(j):
476483 ep0 = np .datetime64 ('0000-12-31T00:00:00' , 'h' ).astype (float ) / 24.
477484 # Julian offset defined above is relative to 0000-12-31, but we need
478485 # relative to our current epoch:
479- dt = JULIAN_OFFSET - ep0 + ep
486+ dt = __getattr__ ( " JULIAN_OFFSET" ) - ep0 + ep
480487 return np .subtract (j , dt ) # Handles both scalar & nonscalar j.
481488
482489
490+ @_api .deprecated ("3.7" )
483491def num2julian (n ):
484492 """
485493 Convert a Matplotlib date (or sequence) to a Julian date (or sequence).
@@ -498,7 +506,7 @@ def num2julian(n):
498506 ep0 = np .datetime64 ('0000-12-31T00:00:00' , 'h' ).astype (float ) / 24.
499507 # Julian offset defined above is relative to 0000-12-31, but we need
500508 # relative to our current epoch:
501- dt = JULIAN_OFFSET - ep0 + ep
509+ dt = __getattr__ ( " JULIAN_OFFSET" ) - ep0 + ep
502510 return np .add (n , dt ) # Handles both scalar & nonscalar j.
503511
504512
0 commit comments