CachingEOPProvider¶
CachingEOPProvider ¶
CachingEOPProvider(eop_type: str, max_age_seconds: int, auto_refresh: bool, interpolate: bool, extrapolate: str, filepath: str = None)
Caching EOP provider that automatically downloads updated files when stale.
This provider wraps a FileEOPProvider and adds automatic cache management. It checks the age of the EOP file and downloads updated versions when the file exceeds the maximum age value. If the file doesn't exist, it will be downloaded on initialization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eop_type | str | Type of EOP file - "C04" for IERS C04 format or "StandardBulletinA" for IERS finals2000A.all format | required |
max_age_seconds | int | Maximum age of file in seconds before triggering a refresh. Common values: 86400 (1 day), 604800 (7 days) | required |
auto_refresh | bool | If True, automatically checks file age and refreshes on every data access. If False, only checks on initialization and manual refresh() calls | required |
interpolate | bool | Enable linear interpolation between tabulated EOP values. Recommended: True for smoother data | required |
extrapolate | str | Behavior for dates outside EOP data range: "Hold" (use last known value), "Zero" (return 0.0), or "Error" (raise exception) | required |
filepath | str | Path to the EOP file (will be created if it doesn't exist). If None, uses default cache location: - StandardBulletinA: ~/.cache/brahe/finals.all.iau2000.txt - C04: ~/.cache/brahe/EOP_20_C04_one_file_1962-now.txt | None |
Raises:
| Type | Description |
|---|---|
RuntimeError | If file download fails or file is invalid |
Example
Initialize instance.
eop_type method descriptor ¶
eop_type() -> str
Get the EOP file type.
Returns:
| Name | Type | Description |
|---|---|---|
str | str | EOP type ("C04", "StandardBulletinA", etc.) |
extrapolation method descriptor ¶
extrapolation() -> str
Get the extrapolation method.
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Extrapolation method ("Hold", "Zero", or "Error") |
file_age method descriptor ¶
file_age() -> float
Get the age of the currently loaded EOP file in seconds.
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Age of the loaded file in seconds |
file_epoch method descriptor ¶
file_epoch() -> Epoch
Get the epoch when the EOP file was last loaded.
Returns:
| Name | Type | Description |
|---|---|---|
Epoch | Epoch | Epoch in UTC when file was loaded |
get_dxdy method descriptor ¶
get_eop method descriptor ¶
get_lod method descriptor ¶
get_pm method descriptor ¶
get_ut1_utc method descriptor ¶
interpolation method descriptor ¶
interpolation() -> bool
Check if interpolation is enabled.
Returns:
| Name | Type | Description |
|---|---|---|
bool | bool | True if interpolation is enabled |
mjd_last_dxdy method descriptor ¶
mjd_last_dxdy() -> float
Get the last MJD with valid celestial pole offset data.
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Last MJD with dX/dY data |
mjd_last_lod method descriptor ¶
mjd_last_lod() -> float
Get the last MJD with valid LOD data.
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Last MJD with length of day data |
mjd_max method descriptor ¶
mjd_max() -> float
Get the maximum MJD in the dataset.
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Maximum Modified Julian Date |
mjd_min method descriptor ¶
mjd_min() -> float
Get the minimum MJD in the dataset.
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Minimum Modified Julian Date |