Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
6de2f78
add cftime formatter
cvanelteren Sep 10, 2025
3b67756
add unittest
cvanelteren Sep 10, 2025
27e4e8e
add converter and register units
cvanelteren Sep 10, 2025
6f0f547
Apply suggestion from @Copilot
cvanelteren Sep 10, 2025
fb16610
add cftime dep
cvanelteren Sep 10, 2025
95e0bc3
add more unittests
cvanelteren Sep 10, 2025
0902895
fix some tests
cvanelteren Sep 10, 2025
489b0f0
rm debug
cvanelteren Sep 10, 2025
c164b28
add more points
cvanelteren Sep 10, 2025
dda122a
revert regex
cvanelteren Sep 10, 2025
f03f94c
fix resolution
cvanelteren Sep 10, 2025
febd860
add more tests and redo resolution computation
cvanelteren Sep 11, 2025
2621564
fix f strings
cvanelteren Sep 11, 2025
9e76c41
add more tests for coverage
cvanelteren Sep 11, 2025
4376869
Update ultraplot/ticker.py
cvanelteren Sep 11, 2025
1f12ac1
rename classes
cvanelteren Sep 11, 2025
032efa8
rename classes
cvanelteren Sep 11, 2025
aa0cc87
Update ultraplot/ticker.py
cvanelteren Sep 11, 2025
ace5a78
Update ultraplot/ticker.py
cvanelteren Sep 11, 2025
6731455
safe casting for non-greg calendars
cvanelteren Sep 11, 2025
f1c5f9b
check that resolution is correct
cvanelteren Sep 11, 2025
a3f133c
check resolution in test_auto_datetime_locator_tick_values
cvanelteren Sep 11, 2025
68cd5af
setters to rc
cvanelteren Sep 29, 2025
3890c53
add validators
cvanelteren Sep 29, 2025
9802c0e
replace real_world_calendar with internal cftime variable
cvanelteren Sep 29, 2025
d158adf
use calendar attr lookup
cvanelteren Sep 29, 2025
7ece0f9
mv max_display_ticks to rc and spelling
cvanelteren Sep 29, 2025
34a1d3c
update defaults
cvanelteren Sep 29, 2025
1113209
update defaults
cvanelteren Sep 29, 2025
920cd51
rename standard_unit time_unit
cvanelteren Sep 29, 2025
6d3bcd8
fix typo
cvanelteren Sep 29, 2025
2995c62
remove debug
cvanelteren Sep 29, 2025
8e050ab
remove try block in test
cvanelteren Sep 29, 2025
405ab10
Merge branch 'main' into feat-add-no-greg-timeformatting
beckermr Sep 29, 2025
9bbb8dc
get calendars from private var
cvanelteren Sep 29, 2025
2af6751
rm type info from default data range
cvanelteren Sep 29, 2025
3daf445
simplify type registry
cvanelteren Sep 29, 2025
e072d8d
Replace datetime specific objects with general datetime
cvanelteren Sep 29, 2025
46dcf71
More replacements
cvanelteren Sep 29, 2025
0575585
Update ultraplot/tests/test_tickers.py
cvanelteren Sep 30, 2025
6dcd213
Update ultraplot/ticker.py
cvanelteren Sep 30, 2025
b0b5d4f
rm resolution format in ticker
cvanelteren Oct 3, 2025
16ed4c0
make standard a bit less extreme
cvanelteren Oct 3, 2025
c9de5c3
make standard a bit less extreme
cvanelteren Oct 3, 2025
ef8a4d3
Merge branch 'main' into feat-add-no-greg-timeformatting
cvanelteren Oct 3, 2025
8acfdd0
rm dead comment
cvanelteren Oct 3, 2025
cbbf538
more tests
cvanelteren Oct 5, 2025
d7a74d8
refactor tests
cvanelteren Oct 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ dependencies:
- sphinx-design
- networkx
- pyarrow
- cftime
- pip:
- git+https://github.com/ultraplot/UltraTheme.git
58 changes: 58 additions & 0 deletions ultraplot/internals/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,37 @@ def _validate_belongs(value): # noqa: E306
return _validate_belongs


_CFTIME_RESOLUTIONS = (
"SECONDLY",
"MINUTELY",
"HOURLY",
"DAILY",
"MONTHLY",
"YEARLY",
)


def _validate_cftime_resolution_format(units: dict) -> dict:
if not isinstance(units, dict):
raise ValueError("Cftime units expects a dict")

for resolution, format_ in units.items():
unit = _validate_cftime_resolution(resolution)

# Delegate format parsing to cftime
_rc_ultraplot_default["cftime.time_resolution_format"].update(units)
return _rc_ultraplot_default["cftime.time_resolution_format"]


def _validate_cftime_resolution(unit: str) -> str:
if not isinstance(unit, str):
raise TypeError("Time unit cftime is expecting str")
if unit in _CFTIME_RESOLUTIONS:
return unit
msg = f"Unit not understood. Got {unit} expected one of: {_CFTIME_RESOLUTIONS}"
raise ValueError(msg)


def _validate_cmap(subtype):
"""
Validate the colormap or cycle. Possibly skip name registration check
Expand Down Expand Up @@ -997,6 +1028,33 @@ def copy(self):
_validate_fontweight,
"Font weight for column labels on the bottom of the figure.",
),
"cftime.time_unit": (
"days since 2000-01-01",
_validate_string,
"Time unit for non-Gregorian calendars.",
),
"cftime.resolution": (
"DAILY",
_validate_cftime_resolution,
"Default time resolution for non-Gregorian calendars.",
),
"cftime.time_resolution_format": (
{
"SECONDLY": "%S",
"MINUTELY": "%M",
"HOURLY": "%H",
"DAILY": "%d",
"MONTHLY": "%m",
"YEARLY": "%Y",
},
_validate_cftime_resolution_format,
"Dict used for formatting non-Gregorian calendars.",
),
"cftime.max_display_ticks": (
7,
_validate_int,
"Number of ticks to display for cftime units.",
),
# Coastlines
"coast": (False, _validate_bool, "Toggles coastline lines on and off."),
"coast.alpha": (
Expand Down
Loading