Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ dependencies = [
"w3lib",
"typing-extensions>=4.12.0",
"StrEnum>=0.4.0",
"numpy",
]
dynamic = ["version"]

Expand All @@ -103,7 +104,6 @@ dev = [
"tox",
"build",
"ruff",
"numpy",
]

[project.urls]
Expand Down
6 changes: 3 additions & 3 deletions src/czml3/examples/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@
-5993978.3578334,
3085604.46208182,
-2127529.51573296,
37792.10937600001,
37792.0,
-6130101.19290489,
3515932.23049969,
9264.18885075031,
Expand Down Expand Up @@ -1177,7 +1177,7 @@
-6161212.76191318,
3460356.43482851,
-87207.9167899129,
73212.755328,
73212.0,
-6154907.45142338,
3472367.94593854,
7596.60346604248,
Expand Down Expand Up @@ -1341,7 +1341,7 @@
-6177229.98169397,
3320382.63185734,
-879217.258095039,
85019.62118399999,
85019.0,
-6162999.06701901,
3457830.12375349,
7561.5554257676,
Expand Down
3 changes: 3 additions & 0 deletions src/czml3/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sys
from typing import Any

import numpy as np
from dateutil.parser import isoparse as parse_iso_date
from pydantic import (
Field,
Expand Down Expand Up @@ -81,6 +82,8 @@ def check_values(num_points: int, values: list[Any]):
raise TypeError(
f"Input values must have either {num_points} or N * {num_points + 1} values, where N is the number of time-tagged samples."
)
if len(values) % (num_points + 1) == 0 and np.any(np.diff(values[::4]) <= 0):
raise TypeError("Time values must be increasing.")


def check_reference(r):
Expand Down
6 changes: 3 additions & 3 deletions tests/simple.czml
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@
36900,-3994146.68251508,1353941.93189576,-5674612.94646658,
37200,-5258447.49803637,2337295.48282856,-4108116.98999385,
37500,-5993978.3578334,3085604.46208182,-2127529.51573296,
37792.10937600001,-6130101.19290489,3515932.23049969,9264.18885075031,
37792.0,-6130101.19290489,3515932.23049969,9264.18885075031,
37792.10937600001,-6130384.46590958,3515584.20899647,6695.95297313175,
37800,-6125874.41162028,3522668.06783492,65343.2925253213,
38100,-5639991.96555162,3604984.9649137,2253983.5554605,
Expand Down Expand Up @@ -931,7 +931,7 @@
72600,-5202391.35629523,2238791.87144665,-4232583.77922341,
72900,-5983183.28985049,3000731.20227799,-2274741.09719522,
73200,-6161212.76191318,3460356.43482851,-87207.9167899129,
73212.755328,-6154907.45142338,3472367.94593854,7596.60346604248,
73212.0,-6154907.45142338,3472367.94593854,7596.60346604248,
73212.755328,-6154869.70054271,3472314.27813954,7580.8794079691,
73500,-5717448.81578568,3570745.1629146,2109098.31104496,
73800,-4696169.83114091,3320482.84120077,4091785.03705666,
Expand Down Expand Up @@ -972,7 +972,7 @@
84300,-4796522.04551855,1896876.29005214,-4836079.84361999,
84600,-5777706.24779571,2746906.16140639,-3009492.61314694,
84900,-6177229.98169397,3320382.63185734,-879217.258095039,
85019.62118399999,-6162999.06701901,3457830.12375349,7561.5554257676,
85019.0,-6162999.06701901,3457830.12375349,7561.5554257676,
85019.62118399999,-6162974.43645965,3457855.60563033,7854.92641443949,
85200,-5953637.85681474,3558954.7436216,1340197.97209599,
85500,-5128782.17352735,3438064.29435161,3423588.54273433,
Expand Down
5 changes: 5 additions & 0 deletions tests/test_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -1648,3 +1648,8 @@ def test_position_list_of_lists_with_bad_references():
values=[["1#this"], ["1#this", "2#this"]]
),
)


def test_check_increasing_time():
with pytest.raises(TypeError):
Cartesian3Value(values=[0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0])
Loading