Add support for MATLAB datenum as an `astropy.time.Time` format
- Dominant language
- Python
- Stars
- 5.3k
- Forks
- 2.2k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 75
Description
### What is the problem this feature will solve?
Many scientific datasets use MATLAB's datenum format for timestamps. Astropy supports formats such as `jd`, `mjd`, `unix`, and `gps`, but not MATLAB `datenum`, requiring users to implement their own conversions.
### Describe the desired outcome
Add support for MATLAB datenum as a native `astropy.time.Time` format.
For example:
```python
from astropy.time import Time
t = Time(739252.5, format="datenum")
print(t.isot)
```
and
```python
t = Time("2024-01-01T12:00:00")
t.to_value("datenum")
```
This would provide a standard, well-tested way to convert between MATLAB datenum values and Astropy time objects.
### Additional context
One point that would need discussion is the precision of conversions between MATLAB datenum and other time formats. Since MATLAB datenum is represented as floating-point days, conversions to and from formats based on integer seconds may introduce small rounding errors at the microsecond or nanosecond level. It would be useful to clarify the expected precision and any limitations of such conversions.
Contributor guide
Research direction
Start at astropy.time.Time and compare the existing jd, mjd, unix, and gps formats to understand the format entry points. Validate the datenum conversion examples and settle the expected floating-point precision, including microsecond or nanosecond rounding limits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- matlab, python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100