|
205 | 205 | UTC = datetime.timezone.utc
|
206 | 206 |
|
207 | 207 |
|
208 |
| -@_api.caching_module_getattr |
209 |
| -class __getattr__: |
210 |
| - JULIAN_OFFSET = _api.deprecated("3.7")(property(lambda self: 1721424.5)) |
211 |
| - # Julian date at 0000-12-31 |
212 |
| - # note that the Julian day epoch is achievable w/ |
213 |
| - # np.datetime64('-4713-11-24T12:00:00'); datetime64 is proleptic |
214 |
| - # Gregorian and BC has a one-year offset. So |
215 |
| - # np.datetime64('0000-12-31') - np.datetime64('-4713-11-24T12:00') = |
216 |
| - # 1721424.5 |
217 |
| - # Ref: https://en.wikipedia.org/wiki/Julian_day |
218 |
| - |
219 |
| - |
220 | 208 | def _get_tzinfo(tz=None):
|
221 | 209 | """
|
222 | 210 | Generate `~datetime.tzinfo` from a string or return `~datetime.tzinfo`.
|
@@ -466,53 +454,6 @@ def date2num(d):
|
466 | 454 | return d if iterable else d[0]
|
467 | 455 |
|
468 | 456 |
|
469 |
| -@_api.deprecated("3.7") |
470 |
| -def julian2num(j): |
471 |
| - """ |
472 |
| - Convert a Julian date (or sequence) to a Matplotlib date (or sequence). |
473 |
| -
|
474 |
| - Parameters |
475 |
| - ---------- |
476 |
| - j : float or sequence of floats |
477 |
| - Julian dates (days relative to 4713 BC Jan 1, 12:00:00 Julian |
478 |
| - calendar or 4714 BC Nov 24, 12:00:00, proleptic Gregorian calendar). |
479 |
| -
|
480 |
| - Returns |
481 |
| - ------- |
482 |
| - float or sequence of floats |
483 |
| - Matplotlib dates (days relative to `.get_epoch`). |
484 |
| - """ |
485 |
| - ep = np.datetime64(get_epoch(), 'h').astype(float) / 24. |
486 |
| - ep0 = np.datetime64('0000-12-31T00:00:00', 'h').astype(float) / 24. |
487 |
| - # Julian offset defined above is relative to 0000-12-31, but we need |
488 |
| - # relative to our current epoch: |
489 |
| - dt = __getattr__("JULIAN_OFFSET") - ep0 + ep |
490 |
| - return np.subtract(j, dt) # Handles both scalar & nonscalar j. |
491 |
| - |
492 |
| - |
493 |
| -@_api.deprecated("3.7") |
494 |
| -def num2julian(n): |
495 |
| - """ |
496 |
| - Convert a Matplotlib date (or sequence) to a Julian date (or sequence). |
497 |
| -
|
498 |
| - Parameters |
499 |
| - ---------- |
500 |
| - n : float or sequence of floats |
501 |
| - Matplotlib dates (days relative to `.get_epoch`). |
502 |
| -
|
503 |
| - Returns |
504 |
| - ------- |
505 |
| - float or sequence of floats |
506 |
| - Julian dates (days relative to 4713 BC Jan 1, 12:00:00). |
507 |
| - """ |
508 |
| - ep = np.datetime64(get_epoch(), 'h').astype(float) / 24. |
509 |
| - ep0 = np.datetime64('0000-12-31T00:00:00', 'h').astype(float) / 24. |
510 |
| - # Julian offset defined above is relative to 0000-12-31, but we need |
511 |
| - # relative to our current epoch: |
512 |
| - dt = __getattr__("JULIAN_OFFSET") - ep0 + ep |
513 |
| - return np.add(n, dt) # Handles both scalar & nonscalar j. |
514 |
| - |
515 |
| - |
516 | 457 | def num2date(x, tz=None):
|
517 | 458 | """
|
518 | 459 | Convert Matplotlib dates to `~datetime.datetime` objects.
|
|
0 commit comments